Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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_TRUE(arc_bridge_service->stopped()); | 3971 EXPECT_TRUE(arc_bridge_service->stopped()); |
| 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->FindPreference( | |
| 3985 prefs::kArcBackupRestoreEnabled)->IsManaged()); | |
| 3986 | |
| 3987 // Disable ARC Backup&Restore. | |
| 3988 PolicyMap policies; | |
| 3989 policies.Set(key::kArcBackupRestoreEnabled, POLICY_LEVEL_MANDATORY, | |
| 3990 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | |
| 3991 base::WrapUnique(new base::FundamentalValue(false)), nullptr); | |
|
Luis Héctor Chávez
2016/07/18 16:15:14
nit: Prefer base::MakeUnique<T>(...) over base::Wr
Sergey Poromov
2016/07/19 09:23:03
Done.
| |
| 3992 UpdateProviderPolicy(policies); | |
| 3993 EXPECT_FALSE(pref->GetBoolean(prefs::kArcBackupRestoreEnabled)); | |
| 3994 EXPECT_TRUE(pref->FindPreference( | |
| 3995 prefs::kArcBackupRestoreEnabled)->IsManaged()); | |
| 3996 | |
| 3997 // Enable ARC Backup&Restore. | |
| 3998 policies.Set(key::kArcBackupRestoreEnabled, POLICY_LEVEL_MANDATORY, | |
| 3999 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | |
| 4000 base::WrapUnique(new base::FundamentalValue(true)), nullptr); | |
| 4001 UpdateProviderPolicy(policies); | |
| 4002 EXPECT_TRUE(pref->GetBoolean(prefs::kArcBackupRestoreEnabled)); | |
| 4003 EXPECT_TRUE(pref->FindPreference( | |
| 4004 prefs::kArcBackupRestoreEnabled)->IsManaged()); | |
| 4005 | |
| 4006 TearDownTest(); | |
| 4007 } | |
| 4008 | |
| 3976 namespace { | 4009 namespace { |
| 3977 const char kTestUser1[] = "test1@domain.com"; | 4010 const char kTestUser1[] = "test1@domain.com"; |
| 3978 } // anonymous namespace | 4011 } // anonymous namespace |
| 3979 | 4012 |
| 3980 class ChromeOSPolicyTest : public PolicyTest { | 4013 class ChromeOSPolicyTest : public PolicyTest { |
| 3981 public: | 4014 public: |
| 3982 ChromeOSPolicyTest() {} | 4015 ChromeOSPolicyTest() {} |
| 3983 | 4016 |
| 3984 void SetUpCommandLine(base::CommandLine* command_line) override { | 4017 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 3985 PolicyTest::SetUpCommandLine(command_line); | 4018 PolicyTest::SetUpCommandLine(command_line); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4107 | 4140 |
| 4108 SetEmptyPolicy(); | 4141 SetEmptyPolicy(); |
| 4109 // Policy not set. | 4142 // Policy not set. |
| 4110 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4143 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
| 4111 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4144 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
| 4112 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4145 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| 4113 } | 4146 } |
| 4114 #endif // defined(OS_CHROMEOS) | 4147 #endif // defined(OS_CHROMEOS) |
| 4115 | 4148 |
| 4116 } // namespace policy | 4149 } // namespace policy |
| OLD | NEW |