Chromium Code Reviews| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/environment.h" | 7 #include "base/environment.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 } | 37 } |
| 38 | 38 |
| 39 TEST_F(SysInfoTest, AmountOfFreeDiskSpace) { | 39 TEST_F(SysInfoTest, AmountOfFreeDiskSpace) { |
| 40 // We aren't actually testing that it's correct, just that it's sane. | 40 // We aren't actually testing that it's correct, just that it's sane. |
| 41 FilePath tmp_path; | 41 FilePath tmp_path; |
| 42 ASSERT_TRUE(base::GetTempDir(&tmp_path)); | 42 ASSERT_TRUE(base::GetTempDir(&tmp_path)); |
| 43 EXPECT_GT(base::SysInfo::AmountOfFreeDiskSpace(tmp_path), 0) | 43 EXPECT_GT(base::SysInfo::AmountOfFreeDiskSpace(tmp_path), 0) |
| 44 << tmp_path.value(); | 44 << tmp_path.value(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 TEST_F(SysInfoTest, GetDiskSpaceInfo) { | |
| 48 // We aren't actually testing that it's correct, just that it's sane. | |
| 49 FilePath tmp_path; | |
| 50 ASSERT_TRUE(base::GetTempDir(&tmp_path)); | |
| 51 int64_t available = 0; | |
| 52 int64_t total = 0; | |
| 53 EXPECT_TRUE(base::SysInfo::GetDiskSpaceInfo(tmp_path, &available, &total)); | |
| 54 EXPECT_GT(available, 0) << tmp_path.value(); | |
|
Dan Beam
2016/06/09 17:20:13
what if the disk is full? do we want to handle th
fukino
2016/06/10 01:33:36
I updated it to _GE, and I changed the initial val
| |
| 55 EXPECT_GT(total, 0) << tmp_path.value(); | |
| 56 } | |
| 57 | |
| 47 #if defined(OS_WIN) || defined(OS_MACOSX) | 58 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 48 TEST_F(SysInfoTest, OperatingSystemVersionNumbers) { | 59 TEST_F(SysInfoTest, OperatingSystemVersionNumbers) { |
| 49 int32_t os_major_version = -1; | 60 int32_t os_major_version = -1; |
| 50 int32_t os_minor_version = -1; | 61 int32_t os_minor_version = -1; |
| 51 int32_t os_bugfix_version = -1; | 62 int32_t os_bugfix_version = -1; |
| 52 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, | 63 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, |
| 53 &os_minor_version, | 64 &os_minor_version, |
| 54 &os_bugfix_version); | 65 &os_bugfix_version); |
| 55 EXPECT_GT(os_major_version, -1); | 66 EXPECT_GT(os_major_version, -1); |
| 56 EXPECT_GT(os_minor_version, -1); | 67 EXPECT_GT(os_minor_version, -1); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, base::Time()); | 160 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, base::Time()); |
| 150 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); | 161 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); |
| 151 | 162 |
| 152 const char kLsbRelease3[] = | 163 const char kLsbRelease3[] = |
| 153 "CHROMEOS_RELEASE_NAME=Chromium OS\n"; | 164 "CHROMEOS_RELEASE_NAME=Chromium OS\n"; |
| 154 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, base::Time()); | 165 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, base::Time()); |
| 155 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); | 166 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); |
| 156 } | 167 } |
| 157 | 168 |
| 158 #endif // OS_CHROMEOS | 169 #endif // OS_CHROMEOS |
| OLD | NEW |