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

Side by Side Diff: base/sys_info_unittest.cc

Issue 23904025: Move IsRunningOnChromeOS to SysInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge fix Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « base/sys_info_chromeos.cc ('k') | chrome/browser/chromeos/app_mode/kiosk_app_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 TEST_F(SysInfoTest, GoogleChromeOSLsbReleaseTime) { 114 TEST_F(SysInfoTest, GoogleChromeOSLsbReleaseTime) {
115 const char* kLsbRelease = "CHROMEOS_RELEASE_VERSION=1.2.3.4"; 115 const char* kLsbRelease = "CHROMEOS_RELEASE_VERSION=1.2.3.4";
116 // Use a fake time that can be safely displayed as a string. 116 // Use a fake time that can be safely displayed as a string.
117 const base::Time lsb_release_time(base::Time::FromDoubleT(12345.6)); 117 const base::Time lsb_release_time(base::Time::FromDoubleT(12345.6));
118 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, lsb_release_time); 118 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, lsb_release_time);
119 base::Time parsed_lsb_release_time = base::SysInfo::GetLsbReleaseTime(); 119 base::Time parsed_lsb_release_time = base::SysInfo::GetLsbReleaseTime();
120 EXPECT_DOUBLE_EQ(lsb_release_time.ToDoubleT(), 120 EXPECT_DOUBLE_EQ(lsb_release_time.ToDoubleT(),
121 parsed_lsb_release_time.ToDoubleT()); 121 parsed_lsb_release_time.ToDoubleT());
122 } 122 }
123 123
124 TEST_F(SysInfoTest, IsRunningOnChromeOS) {
125 base::SysInfo::SetChromeOSVersionInfoForTest("", base::Time());
126 EXPECT_FALSE(base::SysInfo::IsRunningOnChromeOS());
127
128 const char* kLsbRelease1 =
129 "CHROMEOS_RELEASE_NAME=Non Chrome OS\n"
130 "CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
131 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease1, base::Time());
132 EXPECT_FALSE(base::SysInfo::IsRunningOnChromeOS());
133
134 const char* kLsbRelease2 =
135 "CHROMEOS_RELEASE_NAME=Chrome OS\n"
136 "CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
137 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, base::Time());
138 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
139
140 const char* kLsbRelease3 =
141 "CHROMEOS_RELEASE_NAME=Chromium OS\n";
142 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, base::Time());
143 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
144 }
145
124 #endif // OS_CHROMEOS 146 #endif // OS_CHROMEOS
OLDNEW
« no previous file with comments | « base/sys_info_chromeos.cc ('k') | chrome/browser/chromeos/app_mode/kiosk_app_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698