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

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: . Created 7 years, 3 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
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 "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/platform_test.h" 10 #include "testing/platform_test.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 112
113 TEST_F(SysInfoTest, GoogleChromeOSLsbReleaseTime) { 113 TEST_F(SysInfoTest, GoogleChromeOSLsbReleaseTime) {
114 const char* kLsbRelease = "CHROMEOS_RELEASE_VERSION=1.2.3.4"; 114 const char* kLsbRelease = "CHROMEOS_RELEASE_VERSION=1.2.3.4";
115 double lsb_release_time = 12345; 115 double lsb_release_time = 12345;
116 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, lsb_release_time); 116 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, lsb_release_time);
117 base::Time parsed_lsb_release_time = base::SysInfo::GetLsbReleaseTime(); 117 base::Time parsed_lsb_release_time = base::SysInfo::GetLsbReleaseTime();
118 EXPECT_EQ(lsb_release_time, parsed_lsb_release_time.ToDoubleT()); 118 EXPECT_EQ(lsb_release_time, parsed_lsb_release_time.ToDoubleT());
119 } 119 }
120 120
121 TEST_F(SysInfoTest, IsRunningOnChromeOS) {
122 base::SysInfo::SetChromeOSVersionInfoForTest("", 0);
123 EXPECT_FALSE(base::SysInfo::IsRunningOnChromeOS());
124
125 const char* kLsbRelease1 =
126 "CHROMEOS_RELEASE_NAME=Non Chrome OS\n"
127 "CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
128 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease1, 0);
129 EXPECT_FALSE(base::SysInfo::IsRunningOnChromeOS());
130
131 const char* kLsbRelease2 =
132 "CHROMEOS_RELEASE_NAME=Chrome OS\n"
133 "CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
134 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, 0);
135 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
136
137 const char* kLsbRelease3 =
138 "CHROMEOS_RELEASE_NAME=Chromium OS\n";
139 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, 0);
140 EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
141 }
142
121 #endif // OS_CHROMEOS 143 #endif // OS_CHROMEOS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698