scoped_running_on_chromeos.cc 812 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "base/test/scoped_running_on_chromeos.h"
  5. #include "base/system/sys_info.h"
  6. #include "base/time/time.h"
  7. namespace base {
  8. namespace test {
  9. namespace {
  10. // Chrome OS /etc/lsb-release values that make SysInfo::IsRunningOnChromeOS()
  11. // return true.
  12. const char kLsbRelease[] =
  13. "CHROMEOS_RELEASE_NAME=Chrome OS\n"
  14. "CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
  15. } // namespace
  16. ScopedRunningOnChromeOS::ScopedRunningOnChromeOS() {
  17. SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, Time());
  18. }
  19. ScopedRunningOnChromeOS::~ScopedRunningOnChromeOS() {
  20. SysInfo::ResetChromeOSVersionInfoForTest();
  21. }
  22. } // namespace test
  23. } // namespace base