OLD | NEW |
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, | 106 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, |
107 &os_minor_version, | 107 &os_minor_version, |
108 &os_bugfix_version); | 108 &os_bugfix_version); |
109 EXPECT_EQ(0, os_major_version); | 109 EXPECT_EQ(0, os_major_version); |
110 EXPECT_EQ(0, os_minor_version); | 110 EXPECT_EQ(0, os_minor_version); |
111 EXPECT_EQ(0, os_bugfix_version); | 111 EXPECT_EQ(0, os_bugfix_version); |
112 } | 112 } |
113 | 113 |
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 base::Time lsb_release_time = base::Time::Now(); | 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 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, lsb_release_time); | 118 base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, lsb_release_time); |
118 base::Time parsed_lsb_release_time = base::SysInfo::GetLsbReleaseTime(); | 119 base::Time parsed_lsb_release_time = base::SysInfo::GetLsbReleaseTime(); |
119 EXPECT_EQ(lsb_release_time.ToDoubleT(), | 120 EXPECT_DOUBLE_EQ(lsb_release_time.ToDoubleT(), |
120 parsed_lsb_release_time.ToDoubleT()); | 121 parsed_lsb_release_time.ToDoubleT()); |
121 } | 122 } |
122 | 123 |
123 #endif // OS_CHROMEOS | 124 #endif // OS_CHROMEOS |
OLD | NEW |