Commit bdd7bca7 authored by Timothy Loh's avatar Timothy Loh Committed by Commit Bot

Fix PluginVmFilesTest to properly clear LSB-Release

The PluginVmFilesTest currently uses SetChromeOSVersionInfoForTest, but
this affects global state which is currently causing subsequent runs
of the unrelated PluginVmManager tests to fail. This CL changes this to
use the ScopedSetRunningOnChromeOSForTesting object instead.

Bug: 957477
Change-Id: Ie639e796aef536cd28bb884a310252b267b15270
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1611072Reviewed-by: default avatarJoel Hockey <joelhockey@chromium.org>
Commit-Queue: Timothy Loh <timloh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659421}
parent ecd5d8b5
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/system/sys_info.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/chromeos/file_manager/path_util.h" #include "chrome/browser/chromeos/file_manager/path_util.h"
#include "chrome/browser/chromeos/scoped_set_running_on_chromeos_for_testing.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -28,14 +28,20 @@ class PluginVmFilesTest : public testing::Test { ...@@ -28,14 +28,20 @@ class PluginVmFilesTest : public testing::Test {
void SetUp() override { void SetUp() override {
profile_ = std::make_unique<TestingProfile>(); profile_ = std::make_unique<TestingProfile>();
base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time()); fake_release_ =
std::make_unique<chromeos::ScopedSetRunningOnChromeOSForTesting>(
kLsbRelease, base::Time());
} }
void TearDown() override { profile_.reset(); } void TearDown() override {
fake_release_.reset();
profile_.reset();
}
protected: protected:
content::TestBrowserThreadBundle thread_bundle_; content::TestBrowserThreadBundle thread_bundle_;
std::unique_ptr<TestingProfile> profile_; std::unique_ptr<TestingProfile> profile_;
std::unique_ptr<chromeos::ScopedSetRunningOnChromeOSForTesting> fake_release_;
}; };
TEST_F(PluginVmFilesTest, DirNotExists) { TEST_F(PluginVmFilesTest, DirNotExists) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment