xref: /aosp_15_r20/external/cronet/base/android/sys_utils_unittest.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <stddef.h>
6 #include <unistd.h>
7 
8 #include "base/system/sys_info.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 
11 namespace base {
12 namespace android {
13 
TEST(SysUtils,AmountOfPhysicalMemory)14 TEST(SysUtils, AmountOfPhysicalMemory) {
15   // Check that the RAM size reported by sysconf() matches the one
16   // computed by base::SysInfo::AmountOfPhysicalMemory().
17   size_t sys_ram_size =
18       static_cast<size_t>(sysconf(_SC_PHYS_PAGES) * PAGE_SIZE);
19   EXPECT_EQ(sys_ram_size,
20             static_cast<size_t>(SysInfo::AmountOfPhysicalMemory()));
21 }
22 
23 }  // namespace android
24 }  // namespace base
25