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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: base/sys_info_unittest.cc
diff --git a/base/sys_info_unittest.cc b/base/sys_info_unittest.cc
index 730294eb008b6315d846dc38a436b914e006ebe6..b1293a6ab9a5d482c5c5f542ec831cc2d68fda7b 100644
--- a/base/sys_info_unittest.cc
+++ b/base/sys_info_unittest.cc
@@ -118,4 +118,26 @@ TEST_F(SysInfoTest, GoogleChromeOSLsbReleaseTime) {
EXPECT_EQ(lsb_release_time, parsed_lsb_release_time.ToDoubleT());
}
+TEST_F(SysInfoTest, IsRunningOnChromeOS) {
+ base::SysInfo::SetChromeOSVersionInfoForTest("", 0);
+ EXPECT_FALSE(base::SysInfo::IsRunningOnChromeOS());
+
+ const char* kLsbRelease1 =
+ "CHROMEOS_RELEASE_NAME=Non Chrome OS\n"
+ "CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
+ base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease1, 0);
+ EXPECT_FALSE(base::SysInfo::IsRunningOnChromeOS());
+
+ const char* kLsbRelease2 =
+ "CHROMEOS_RELEASE_NAME=Chrome OS\n"
+ "CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
+ base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, 0);
+ EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
+
+ const char* kLsbRelease3 =
+ "CHROMEOS_RELEASE_NAME=Chromium OS\n";
+ base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, 0);
+ EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
+}
+
#endif // OS_CHROMEOS

Powered by Google App Engine
This is Rietveld 408576698