Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: base/sys_info_unittest.cc

Issue 2052663003: Move implementation of QuotaManager.getVolumeInfo to base::SysInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add AmountOfTotalDiskSpace() instead of GetDiskSpaceInfo(). Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 22 matching lines...) Expand all
33 EXPECT_GT(base::SysInfo::AmountOfPhysicalMemory(), 0); 33 EXPECT_GT(base::SysInfo::AmountOfPhysicalMemory(), 0);
34 EXPECT_GT(base::SysInfo::AmountOfPhysicalMemoryMB(), 0); 34 EXPECT_GT(base::SysInfo::AmountOfPhysicalMemoryMB(), 0);
35 // The maxmimal amount of virtual memory can be zero which means unlimited. 35 // The maxmimal amount of virtual memory can be zero which means unlimited.
36 EXPECT_GE(base::SysInfo::AmountOfVirtualMemory(), 0); 36 EXPECT_GE(base::SysInfo::AmountOfVirtualMemory(), 0);
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_GE(base::SysInfo::AmountOfFreeDiskSpace(tmp_path), 0)
44 << tmp_path.value(); 44 << tmp_path.value();
45 } 45 }
46 46
47 TEST_F(SysInfoTest, AmountOfTotalDiskSpace) {
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 EXPECT_GT(base::SysInfo::AmountOfTotalDiskSpace(tmp_path), 0)
52 << tmp_path.value();
53 }
54
47 #if defined(OS_WIN) || defined(OS_MACOSX) 55 #if defined(OS_WIN) || defined(OS_MACOSX)
48 TEST_F(SysInfoTest, OperatingSystemVersionNumbers) { 56 TEST_F(SysInfoTest, OperatingSystemVersionNumbers) {
49 int32_t os_major_version = -1; 57 int32_t os_major_version = -1;
50 int32_t os_minor_version = -1; 58 int32_t os_minor_version = -1;
51 int32_t os_bugfix_version = -1; 59 int32_t os_bugfix_version = -1;
52 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, 60 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version,
53 &os_minor_version, 61 &os_minor_version,
54 &os_bugfix_version); 62 &os_bugfix_version);
55 EXPECT_GT(os_major_version, -1); 63 EXPECT_GT(os_major_version, -1);
56 EXPECT_GT(os_minor_version, -1); 64 EXPECT_GT(os_minor_version, -1);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, base::Time()); 157 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, base::Time());
150 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); 158 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
151 159
152 const char kLsbRelease3[] = 160 const char kLsbRelease3[] =
153 "CHROMEOS_RELEASE_NAME=Chromium OS\n"; 161 "CHROMEOS_RELEASE_NAME=Chromium OS\n";
154 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, base::Time()); 162 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, base::Time());
155 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); 163 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
156 } 164 }
157 165
158 #endif // OS_CHROMEOS 166 #endif // OS_CHROMEOS
OLDNEW
« no previous file with comments | « base/sys_info_posix.cc ('k') | base/sys_info_win.cc » ('j') | base/sys_info_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698