Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 2188483003: Policy to control ARC Backup&Restore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Policy to control ARC Backup&Restore. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 3955 matching lines...) Expand 10 before | Expand all | Expand 10 after
3966 policies.Set(key::kArcEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 3966 policies.Set(key::kArcEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
3967 POLICY_SOURCE_CLOUD, 3967 POLICY_SOURCE_CLOUD,
3968 base::WrapUnique(new base::FundamentalValue(false)), nullptr); 3968 base::WrapUnique(new base::FundamentalValue(false)), nullptr);
3969 UpdateProviderPolicy(policies); 3969 UpdateProviderPolicy(policies);
3970 EXPECT_FALSE(pref->GetBoolean(prefs::kArcEnabled)); 3970 EXPECT_FALSE(pref->GetBoolean(prefs::kArcEnabled));
3971 EXPECT_EQ(arc::ArcBridgeService::State::STOPPED, arc_bridge_service->state()); 3971 EXPECT_EQ(arc::ArcBridgeService::State::STOPPED, arc_bridge_service->state());
3972 3972
3973 TearDownTest(); 3973 TearDownTest();
3974 } 3974 }
3975 3975
3976 // Test ArcBackupRestoreEnabled policy.
3977 IN_PROC_BROWSER_TEST_F(ArcPolicyTest, ArcBackupRestoreEnabled) {
3978 SetUpTest();
3979
3980 const PrefService* const pref = browser()->profile()->GetPrefs();
3981
3982 // ARC Backup & Restore is switched on by default.
3983 EXPECT_TRUE(pref->GetBoolean(prefs::kArcBackupRestoreEnabled));
3984 EXPECT_FALSE(pref->IsManagedPreference(prefs::kArcBackupRestoreEnabled));
3985
3986 // Disable ARC Backup & Restore.
3987 PolicyMap policies;
3988 policies.Set(key::kArcBackupRestoreEnabled, POLICY_LEVEL_MANDATORY,
3989 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
3990 base::MakeUnique<base::FundamentalValue>(false), nullptr);
3991 UpdateProviderPolicy(policies);
3992 EXPECT_FALSE(pref->GetBoolean(prefs::kArcBackupRestoreEnabled));
3993 EXPECT_TRUE(pref->IsManagedPreference(prefs::kArcBackupRestoreEnabled));
3994
3995 // Enable ARC Backup & Restore.
3996 policies.Set(key::kArcBackupRestoreEnabled, POLICY_LEVEL_MANDATORY,
3997 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
3998 base::MakeUnique<base::FundamentalValue>(true), nullptr);
3999 UpdateProviderPolicy(policies);
4000 EXPECT_TRUE(pref->GetBoolean(prefs::kArcBackupRestoreEnabled));
4001 EXPECT_TRUE(pref->IsManagedPreference(prefs::kArcBackupRestoreEnabled));
4002
4003 TearDownTest();
4004 }
4005
3976 namespace { 4006 namespace {
3977 const char kTestUser1[] = "test1@domain.com"; 4007 const char kTestUser1[] = "test1@domain.com";
3978 } // anonymous namespace 4008 } // anonymous namespace
3979 4009
3980 class ChromeOSPolicyTest : public PolicyTest { 4010 class ChromeOSPolicyTest : public PolicyTest {
3981 public: 4011 public:
3982 ChromeOSPolicyTest() {} 4012 ChromeOSPolicyTest() {}
3983 4013
3984 void SetUpCommandLine(base::CommandLine* command_line) override { 4014 void SetUpCommandLine(base::CommandLine* command_line) override {
3985 PolicyTest::SetUpCommandLine(command_line); 4015 PolicyTest::SetUpCommandLine(command_line);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
4107 4137
4108 SetEmptyPolicy(); 4138 SetEmptyPolicy();
4109 // Policy not set. 4139 // Policy not set.
4110 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); 4140 CheckSystemTimezoneAutomaticDetectionPolicyUnset();
4111 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); 4141 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false));
4112 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); 4142 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests());
4113 } 4143 }
4114 #endif // defined(OS_CHROMEOS) 4144 #endif // defined(OS_CHROMEOS)
4115 4145
4116 } // namespace policy 4146 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/configuration_policy_handler_list_factory.cc ('k') | chrome/test/data/policy/policy_test_cases.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698