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