Replace deprecated SetDomainStateForTesting with scoping class.
Bug: None Change-Id: I9370b99599f128d7379761c77ba9195be59baf71 Reviewed-on: https://chromium-review.googlesource.com/1187270 Commit-Queue: Roger Tawa <rogerta@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org> Reviewed-by: Devlin <rdevlin.cronin@chromium.org> Cr-Commit-Position: refs/heads/master@{#585863}
This commit is contained in:
base/win
chrome/browser
components/policy/core/common
@ -563,11 +563,6 @@ bool IsEnrolledToDomain() {
|
||||
return *GetDomainEnrollmentStateStorage();
|
||||
}
|
||||
|
||||
// This function is deprecated, prefer class ScopedDomainStateForTesting.
|
||||
void SetDomainStateForTesting(bool state) {
|
||||
*GetDomainEnrollmentStateStorage() = state;
|
||||
}
|
||||
|
||||
bool IsDeviceRegisteredWithManagement() {
|
||||
return *GetRegisteredWithManagementStateStorage();
|
||||
}
|
||||
|
@ -163,11 +163,6 @@ BASE_EXPORT bool IsDeviceRegisteredWithManagement();
|
||||
// or registered with an MDM.
|
||||
BASE_EXPORT bool IsEnterpriseManaged();
|
||||
|
||||
// Used by tests to mock any wanted state. Call with |state| set to true to
|
||||
// simulate being in a domain and false otherwise.
|
||||
// This function is deprecated, prefer class ScopedDomainStateForTesting below.
|
||||
BASE_EXPORT void SetDomainStateForTesting(bool state);
|
||||
|
||||
// Returns true if the current process can make USER32 or GDI32 calls such as
|
||||
// CreateWindow and CreateDC. Windows 8 and above allow the kernel component
|
||||
// of these calls to be disabled which can cause undefined behaviour such as
|
||||
|
@ -375,7 +375,7 @@ TEST(ExtensionSettingsPolicyHandlerTest, CheckPolicySettings) {
|
||||
TEST(ExtensionSettingsPolicyHandlerTest, ApplyPolicySettings) {
|
||||
// Mark as enterprise managed.
|
||||
#if defined(OS_WIN)
|
||||
base::win::SetDomainStateForTesting(true);
|
||||
base::win::ScopedDomainStateForTesting scoped_domain(true);
|
||||
#endif
|
||||
|
||||
std::string error;
|
||||
@ -408,7 +408,7 @@ TEST(ExtensionSettingsPolicyHandlerTest, ApplyPolicySettings) {
|
||||
#if defined(OS_WIN)
|
||||
TEST(ExtensionSettingsPolicyHandlerTest, NonManagedOffWebstoreExtension) {
|
||||
// Mark as not enterprise managed.
|
||||
base::win::SetDomainStateForTesting(false);
|
||||
base::win::ScopedDomainStateForTesting scoped_domain(false);
|
||||
|
||||
std::string error;
|
||||
std::unique_ptr<base::Value> policy_value =
|
||||
|
@ -2582,7 +2582,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionRecommendedInstallationMode) {
|
||||
|
||||
// Mark as enterprise managed.
|
||||
#if defined(OS_WIN)
|
||||
base::win::SetDomainStateForTesting(true);
|
||||
base::win::ScopedDomainStateForTesting scoped_domain(true);
|
||||
#endif
|
||||
|
||||
extensions::ExtensionService* service = extension_service();
|
||||
@ -2875,7 +2875,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionMinimumVersionForceInstalled) {
|
||||
|
||||
// Mark as enterprise managed.
|
||||
#if defined(OS_WIN)
|
||||
base::win::SetDomainStateForTesting(true);
|
||||
base::win::ScopedDomainStateForTesting scoped_domain(true);
|
||||
#endif
|
||||
extensions::ExtensionRegistry* registry =
|
||||
extensions::ExtensionRegistry::Get(browser()->profile());
|
||||
|
@ -286,7 +286,7 @@ void RegistryTestHarness::SetUp() {
|
||||
ConfigurationPolicyProvider* RegistryTestHarness::CreateProvider(
|
||||
SchemaRegistry* registry,
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner) {
|
||||
base::win::SetDomainStateForTesting(true);
|
||||
base::win::ScopedDomainStateForTesting scoped_domain(true);
|
||||
std::unique_ptr<AsyncPolicyLoader> loader(
|
||||
new PolicyLoaderWin(task_runner, kTestPolicyKey));
|
||||
return new AsyncPolicyProvider(registry, std::move(loader));
|
||||
@ -406,11 +406,10 @@ class PolicyLoaderWinTest : public PolicyTestBase {
|
||||
// files in chrome/test/data/policy/gpo.
|
||||
static const base::char16 kTestPolicyKey[];
|
||||
|
||||
PolicyLoaderWinTest() {}
|
||||
PolicyLoaderWinTest() : scoped_domain_(false) {}
|
||||
~PolicyLoaderWinTest() override {}
|
||||
|
||||
void SetUp() override {
|
||||
base::win::SetDomainStateForTesting(false);
|
||||
PolicyTestBase::SetUp();
|
||||
|
||||
// Activate overrides of registry keys. gtest documentation guarantees
|
||||
@ -428,6 +427,7 @@ class PolicyLoaderWinTest : public PolicyTestBase {
|
||||
}
|
||||
|
||||
ScopedGroupPolicyRegistrySandbox registry_sandbox_;
|
||||
base::win::ScopedDomainStateForTesting scoped_domain_;
|
||||
};
|
||||
|
||||
const base::char16 PolicyLoaderWinTest::kTestPolicyKey[] =
|
||||
|
Reference in New Issue
Block a user