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

Side by Side Diff: base/sys_info_unittest.cc

Issue 999623002: metrics/base: log whether drives have seek penalties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: slightly after rush hour Created 5 years, 9 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 "base/environment.h" 5 #include "base/environment.h"
6 #include "base/files/file_util.h" 6 #include "base/files/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 23 matching lines...) Expand all
34 } 34 }
35 35
36 TEST_F(SysInfoTest, AmountOfFreeDiskSpace) { 36 TEST_F(SysInfoTest, AmountOfFreeDiskSpace) {
37 // 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.
38 FilePath tmp_path; 38 FilePath tmp_path;
39 ASSERT_TRUE(base::GetTempDir(&tmp_path)); 39 ASSERT_TRUE(base::GetTempDir(&tmp_path));
40 EXPECT_GT(base::SysInfo::AmountOfFreeDiskSpace(tmp_path), 0) 40 EXPECT_GT(base::SysInfo::AmountOfFreeDiskSpace(tmp_path), 0)
41 << tmp_path.value(); 41 << tmp_path.value();
42 } 42 }
43 43
44 TEST_F(SysInfoTest, HasSeekPenalty) {
45 FilePath tmp_path;
46 ASSERT_TRUE(base::GetTempDir(&tmp_path));
47
48 bool unused;
49 bool success = base::SysInfo::HasSeekPenalty(tmp_path, &unused);
50 #if defined(OS_WIN)
51 EXPECT_TRUE(success);
52 #else
53 EXPECT_FALSE(success) << "Update if this gets implemented elsewhere.";
54 #endif
55 }
56
44 #if defined(OS_WIN) || defined(OS_MACOSX) 57 #if defined(OS_WIN) || defined(OS_MACOSX)
45 TEST_F(SysInfoTest, OperatingSystemVersionNumbers) { 58 TEST_F(SysInfoTest, OperatingSystemVersionNumbers) {
46 int32 os_major_version = -1; 59 int32 os_major_version = -1;
47 int32 os_minor_version = -1; 60 int32 os_minor_version = -1;
48 int32 os_bugfix_version = -1; 61 int32 os_bugfix_version = -1;
49 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, 62 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version,
50 &os_minor_version, 63 &os_minor_version,
51 &os_bugfix_version); 64 &os_bugfix_version);
52 EXPECT_GT(os_major_version, -1); 65 EXPECT_GT(os_major_version, -1);
53 EXPECT_GT(os_minor_version, -1); 66 EXPECT_GT(os_minor_version, -1);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, base::Time()); 159 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, base::Time());
147 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); 160 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
148 161
149 const char kLsbRelease3[] = 162 const char kLsbRelease3[] =
150 "CHROMEOS_RELEASE_NAME=Chromium OS\n"; 163 "CHROMEOS_RELEASE_NAME=Chromium OS\n";
151 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, base::Time()); 164 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, base::Time());
152 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS()); 165 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
153 } 166 }
154 167
155 #endif // OS_CHROMEOS 168 #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