| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/environment.h" | 5 #include "base/environment.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/sys_info.h" | 7 #include "base/sys_info.h" |
| 8 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 TEST_F(SysInfoTest, NumProcs) { | 23 TEST_F(SysInfoTest, NumProcs) { |
| 24 // We aren't actually testing that it's correct, just that it's sane. | 24 // We aren't actually testing that it's correct, just that it's sane. |
| 25 EXPECT_GE(base::SysInfo::NumberOfProcessors(), 1); | 25 EXPECT_GE(base::SysInfo::NumberOfProcessors(), 1); |
| 26 } | 26 } |
| 27 | 27 |
| 28 TEST_F(SysInfoTest, AmountOfMem) { | 28 TEST_F(SysInfoTest, AmountOfMem) { |
| 29 // We aren't actually testing that it's correct, just that it's sane. | 29 // We aren't actually testing that it's correct, just that it's sane. |
| 30 EXPECT_GT(base::SysInfo::AmountOfPhysicalMemory(), 0); | 30 EXPECT_GT(base::SysInfo::AmountOfPhysicalMemory(), 0); |
| 31 EXPECT_GT(base::SysInfo::AmountOfPhysicalMemoryMB(), 0); | 31 EXPECT_GT(base::SysInfo::AmountOfPhysicalMemoryMB(), 0); |
| 32 // The maxmimal amount of virtual memory can be zero which means unlimited. |
| 33 EXPECT_GE(base::SysInfo::AmountOfVirtualMemory(), 0); |
| 32 } | 34 } |
| 33 | 35 |
| 34 TEST_F(SysInfoTest, AmountOfFreeDiskSpace) { | 36 TEST_F(SysInfoTest, AmountOfFreeDiskSpace) { |
| 35 // We aren't actually testing that it's correct, just that it's sane. | 37 // We aren't actually testing that it's correct, just that it's sane. |
| 36 FilePath tmp_path; | 38 FilePath tmp_path; |
| 37 ASSERT_TRUE(base::GetTempDir(&tmp_path)); | 39 ASSERT_TRUE(base::GetTempDir(&tmp_path)); |
| 38 EXPECT_GT(base::SysInfo::AmountOfFreeDiskSpace(tmp_path), 0) | 40 EXPECT_GT(base::SysInfo::AmountOfFreeDiskSpace(tmp_path), 0) |
| 39 << tmp_path.value(); | 41 << tmp_path.value(); |
| 40 } | 42 } |
| 41 | 43 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, base::Time()); | 139 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, base::Time()); |
| 138 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); | 140 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); |
| 139 | 141 |
| 140 const char* kLsbRelease3 = | 142 const char* kLsbRelease3 = |
| 141 "CHROMEOS_RELEASE_NAME=Chromium OS\n"; | 143 "CHROMEOS_RELEASE_NAME=Chromium OS\n"; |
| 142 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, base::Time()); | 144 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, base::Time()); |
| 143 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); | 145 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); |
| 144 } | 146 } |
| 145 | 147 |
| 146 #endif // OS_CHROMEOS | 148 #endif // OS_CHROMEOS |
| OLD | NEW |