Index: chrome/browser/chromeos/scoped_set_running_on_chromeos_for_testing.h |
diff --git a/chrome/browser/chromeos/scoped_set_running_on_chromeos_for_testing.h b/chrome/browser/chromeos/scoped_set_running_on_chromeos_for_testing.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d58b6b674cf99625f2a31c79050bb9e1f537f749 |
--- /dev/null |
+++ b/chrome/browser/chromeos/scoped_set_running_on_chromeos_for_testing.h |
@@ -0,0 +1,31 @@ |
+// 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. |
+ |
+#ifndef CHROME_BROWSER_CHROMEOS_SCOPED_SET_RUNNING_ON_CHROMEOS_FOR_TESTING_H_ |
+#define CHROME_BROWSER_CHROMEOS_SCOPED_SET_RUNNING_ON_CHROMEOS_FOR_TESTING_H_ |
+ |
+#include <string> |
+ |
+#include "base/time/time.h" |
+ |
+namespace chromeos { |
+ |
+// unit_tests must always reset status of modified global singletons, |
+// otherwise later tests will fail, because they are run in the same process. |
+// |
+// This object resets LSB-Release to empty string on destruction, forcing |
+// is_running_on_chromeos() to return false. |
+class ScopedSetRunningOnChromeOSForTesting { |
+ public: |
+ ScopedSetRunningOnChromeOSForTesting(const std::string& lsb_release, |
+ const base::Time& lsb_release_time); |
+ ~ScopedSetRunningOnChromeOSForTesting(); |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(ScopedSetRunningOnChromeOSForTesting); |
+}; |
+ |
+} // namespace chromeos |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_SCOPED_SET_RUNNING_ON_CHROMEOS_FOR_TESTING_H_ |