Index: chrome/browser/chromeos/scoped_sys_info_chromeos_version_for_testing.cc |
diff --git a/chrome/browser/chromeos/scoped_sys_info_chromeos_version_for_testing.cc b/chrome/browser/chromeos/scoped_sys_info_chromeos_version_for_testing.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1851c63f29e61fc56b2a5c21067be03b355b057e |
--- /dev/null |
+++ b/chrome/browser/chromeos/scoped_sys_info_chromeos_version_for_testing.cc |
@@ -0,0 +1,21 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/chromeos/scoped_sys_info_chromeos_version_for_testing.h" |
+ |
+#include "base/sys_info.h" |
+ |
+namespace chromeos { |
+ |
+ScopedSetRunningOnChromeOSForTesting::ScopedSetRunningOnChromeOSForTesting( |
xiyuan
2017/05/26 19:14:35
ScopedSetRunningOnChromeOSForTesting and the file
Alexander Alekseev
2017/05/29 17:06:04
Done.
|
+ const std::string& lsb_release, |
+ const base::Time& lsb_release_time) { |
+ base::SysInfo::SetChromeOSVersionInfoForTest(lsb_release, lsb_release_time); |
xiyuan
2017/05/26 17:14:53
ScopedSetRunningOnChromeOSForTesting is necessary
Alexander Alekseev
2017/05/26 18:06:21
https://en.wikipedia.org/wiki/Environment_variable
xiyuan
2017/05/26 19:14:35
Oops. I messed it up with inherited env from paren
Alexander Alekseev
2017/05/29 17:06:04
I found that this is wrong. If you run unit_tests
xiyuan
2017/05/30 15:39:39
Acknowledged.
|
+} |
+ |
+ScopedSetRunningOnChromeOSForTesting::~ScopedSetRunningOnChromeOSForTesting() { |
+ base::SysInfo::SetChromeOSVersionInfoForTest("", base::Time()); |
xiyuan
2017/05/26 19:14:35
This does not restore to previous values. We shoul
Alexander Alekseev
2017/05/29 17:06:03
Done.
|
+} |
+ |
+} // namespace chromeos |