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

Unified Diff: chrome/browser/chromeos/scoped_sys_info_chromeos_version_for_testing.cc

Issue 2907493002: ChromeOS: Per-user time zone: refactor tests first. (Closed)
Patch Set: Update after review. Created 3 years, 7 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: 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

Powered by Google App Engine
This is Rietveld 408576698