xref: /aosp_15_r20/external/cronet/base/test/scoped_chromeos_version_info.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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_chromeos_version_info.h"
6 
7 #include <string_view>
8 
9 #include "base/system/sys_info.h"
10 
11 namespace base {
12 namespace test {
13 
ScopedChromeOSVersionInfo(std::string_view lsb_release,Time lsb_release_time)14 ScopedChromeOSVersionInfo::ScopedChromeOSVersionInfo(
15     std::string_view lsb_release,
16     Time lsb_release_time) {
17   SysInfo::SetChromeOSVersionInfoForTest(std::string(lsb_release),
18                                          lsb_release_time);
19 }
20 
~ScopedChromeOSVersionInfo()21 ScopedChromeOSVersionInfo::~ScopedChromeOSVersionInfo() {
22   SysInfo::ResetChromeOSVersionInfoForTest();
23 }
24 
25 }  // namespace test
26 }  // namespace base
27