Commit 3cedaa1b authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Fix lacros unit_tests

TBR=jamescook@chromium.org

Bug: 1152128
Change-Id: Iaa85708fe65d89099013859416fef2155a04c6ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2557764
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarYi Gu <yigu@chromium.org>
Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Reviewed-by: default avatarJoel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830732}
parent b8794c01
...@@ -6,30 +6,14 @@ ...@@ -6,30 +6,14 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/system/sys_info.h"
#include "base/test/scoped_path_override.h" #include "base/test/scoped_path_override.h"
#include "base/test/scoped_running_on_chromeos.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chromeos/crosapi/mojom/crosapi.mojom.h" #include "chromeos/crosapi/mojom/crosapi.mojom.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace { namespace {
const char kLsbRelease[] =
"CHROMEOS_RELEASE_NAME=Chrome OS\n"
"CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
// Overrides base::SysInfo::IsRunningOnChromeOS() to return true.
// TODO(jamescook): Switch to the shared helper once crrev.com/c/2538285 lands.
class ScopedIsRunningOnChromeOS {
public:
ScopedIsRunningOnChromeOS() {
base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
}
~ScopedIsRunningOnChromeOS() {
base::SysInfo::SetChromeOSVersionInfoForTest("", base::Time());
}
};
class LacrosChromeServiceDelegateImplTest : public testing::Test { class LacrosChromeServiceDelegateImplTest : public testing::Test {
public: public:
LacrosChromeServiceDelegateImplTest() = default; LacrosChromeServiceDelegateImplTest() = default;
...@@ -40,7 +24,7 @@ class LacrosChromeServiceDelegateImplTest : public testing::Test { ...@@ -40,7 +24,7 @@ class LacrosChromeServiceDelegateImplTest : public testing::Test {
~LacrosChromeServiceDelegateImplTest() override = default; ~LacrosChromeServiceDelegateImplTest() override = default;
private: private:
ScopedIsRunningOnChromeOS running_on_chromeos_; base::test::ScopedRunningOnChromeOS running_on_chromeos_;
// Ensure we restore the previous paths for subsequent tests. We don't // Ensure we restore the previous paths for subsequent tests. We don't
// actually use these paths, so just point them at /tmp to avoid // actually use these paths, so just point them at /tmp to avoid
// ScopedPathOverride from creating unnecessary temp directories. // ScopedPathOverride from creating unnecessary temp directories.
......
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