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 3971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3982 policies.Set(key::kArcBackupRestoreEnabled, POLICY_LEVEL_MANDATORY, | 3982 policies.Set(key::kArcBackupRestoreEnabled, POLICY_LEVEL_MANDATORY, |
3983 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | 3983 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
3984 base::MakeUnique<base::FundamentalValue>(true), nullptr); | 3984 base::MakeUnique<base::FundamentalValue>(true), nullptr); |
3985 UpdateProviderPolicy(policies); | 3985 UpdateProviderPolicy(policies); |
3986 EXPECT_TRUE(pref->GetBoolean(prefs::kArcBackupRestoreEnabled)); | 3986 EXPECT_TRUE(pref->GetBoolean(prefs::kArcBackupRestoreEnabled)); |
3987 EXPECT_TRUE(pref->IsManagedPreference(prefs::kArcBackupRestoreEnabled)); | 3987 EXPECT_TRUE(pref->IsManagedPreference(prefs::kArcBackupRestoreEnabled)); |
3988 | 3988 |
3989 TearDownTest(); | 3989 TearDownTest(); |
3990 } | 3990 } |
3991 | 3991 |
| 3992 // Test ArcLocationServiceEnabled policy. |
| 3993 IN_PROC_BROWSER_TEST_F(ArcPolicyTest, ArcLocationServiceEnabled) { |
| 3994 SetUpTest(); |
| 3995 |
| 3996 const PrefService* const pref = browser()->profile()->GetPrefs(); |
| 3997 |
| 3998 // ARC Location Service is switched on by default. |
| 3999 EXPECT_TRUE(pref->GetBoolean(prefs::kArcLocationServiceEnabled)); |
| 4000 EXPECT_FALSE(pref->IsManagedPreference(prefs::kArcLocationServiceEnabled)); |
| 4001 |
| 4002 // Managed Location Service. |
| 4003 PolicyMap policies; |
| 4004 // AllowGeolocation |
| 4005 policies.Set(key::kDefaultGeolocationSetting, POLICY_LEVEL_MANDATORY, |
| 4006 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
| 4007 base::MakeUnique<base::FundamentalValue>(1), nullptr); |
| 4008 UpdateProviderPolicy(policies); |
| 4009 EXPECT_TRUE(pref->GetBoolean(prefs::kArcLocationServiceEnabled)); |
| 4010 EXPECT_FALSE(pref->IsManagedPreference(prefs::kArcLocationServiceEnabled)); |
| 4011 |
| 4012 // BlockGeolocation |
| 4013 policies.Set(key::kDefaultGeolocationSetting, POLICY_LEVEL_MANDATORY, |
| 4014 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
| 4015 base::MakeUnique<base::FundamentalValue>(2), nullptr); |
| 4016 UpdateProviderPolicy(policies); |
| 4017 EXPECT_FALSE(pref->GetBoolean(prefs::kArcLocationServiceEnabled)); |
| 4018 EXPECT_TRUE(pref->IsManagedPreference(prefs::kArcLocationServiceEnabled)); |
| 4019 |
| 4020 // AskGeolocation |
| 4021 policies.Set(key::kDefaultGeolocationSetting, POLICY_LEVEL_MANDATORY, |
| 4022 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
| 4023 base::MakeUnique<base::FundamentalValue>(3), nullptr); |
| 4024 UpdateProviderPolicy(policies); |
| 4025 EXPECT_TRUE(pref->GetBoolean(prefs::kArcLocationServiceEnabled)); |
| 4026 EXPECT_FALSE(pref->IsManagedPreference(prefs::kArcLocationServiceEnabled)); |
| 4027 |
| 4028 TearDownTest(); |
| 4029 } |
| 4030 |
3992 namespace { | 4031 namespace { |
3993 const char kTestUser1[] = "test1@domain.com"; | 4032 const char kTestUser1[] = "test1@domain.com"; |
3994 } // anonymous namespace | 4033 } // anonymous namespace |
3995 | 4034 |
3996 class ChromeOSPolicyTest : public PolicyTest { | 4035 class ChromeOSPolicyTest : public PolicyTest { |
3997 public: | 4036 public: |
3998 ChromeOSPolicyTest() {} | 4037 ChromeOSPolicyTest() {} |
3999 | 4038 |
4000 void SetUpCommandLine(base::CommandLine* command_line) override { | 4039 void SetUpCommandLine(base::CommandLine* command_line) override { |
4001 PolicyTest::SetUpCommandLine(command_line); | 4040 PolicyTest::SetUpCommandLine(command_line); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4123 | 4162 |
4124 SetEmptyPolicy(); | 4163 SetEmptyPolicy(); |
4125 // Policy not set. | 4164 // Policy not set. |
4126 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4165 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
4127 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4166 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
4128 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4167 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
4129 } | 4168 } |
4130 #endif // defined(OS_CHROMEOS) | 4169 #endif // defined(OS_CHROMEOS) |
4131 | 4170 |
4132 } // namespace policy | 4171 } // namespace policy |
OLD | NEW |