1f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// found in the LICENSE file.
4f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
5f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include <unistd.h>
6f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
7116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "base/sys_info.h"
8f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "testing/gtest/include/gtest/gtest.h"
9f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
10f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace base {
11f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)namespace android {
12f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
13f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)TEST(SysUtils, AmountOfPhysicalMemory) {
14f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Check that the RAM size reported by sysconf() matches the one
15116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // computed by base::SysInfo::AmountOfPhysicalMemory().
16f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  size_t sys_ram_size =
17f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)      static_cast<size_t>(sysconf(_SC_PHYS_PAGES) * PAGE_SIZE);
18116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  EXPECT_EQ(sys_ram_size,
19116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch            static_cast<size_t>(SysInfo::AmountOfPhysicalMemory()));
20f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}
21f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
22f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}  // namespace android
23f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)}  // namespace base
24