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 3923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3934 policies.Set(key::kArcBackupRestoreEnabled, POLICY_LEVEL_MANDATORY, | 3934 policies.Set(key::kArcBackupRestoreEnabled, POLICY_LEVEL_MANDATORY, |
3935 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | 3935 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
3936 base::MakeUnique<base::FundamentalValue>(true), nullptr); | 3936 base::MakeUnique<base::FundamentalValue>(true), nullptr); |
3937 UpdateProviderPolicy(policies); | 3937 UpdateProviderPolicy(policies); |
3938 EXPECT_TRUE(pref->GetBoolean(prefs::kArcBackupRestoreEnabled)); | 3938 EXPECT_TRUE(pref->GetBoolean(prefs::kArcBackupRestoreEnabled)); |
3939 EXPECT_TRUE(pref->IsManagedPreference(prefs::kArcBackupRestoreEnabled)); | 3939 EXPECT_TRUE(pref->IsManagedPreference(prefs::kArcBackupRestoreEnabled)); |
3940 | 3940 |
3941 TearDownTest(); | 3941 TearDownTest(); |
3942 } | 3942 } |
3943 | 3943 |
| 3944 // Test ArcLocationServiceEnabled policy. |
| 3945 IN_PROC_BROWSER_TEST_F(ArcPolicyTest, ArcLocationServiceEnabled) { |
| 3946 SetUpTest(); |
| 3947 |
| 3948 const PrefService* const pref = browser()->profile()->GetPrefs(); |
| 3949 |
| 3950 // ARC Location Service is switched on by default. |
| 3951 EXPECT_TRUE(pref->GetBoolean(prefs::kArcLocationServiceEnabled)); |
| 3952 EXPECT_FALSE(pref->IsManagedPreference(prefs::kArcLocationServiceEnabled)); |
| 3953 |
| 3954 // Managed Location Service. |
| 3955 PolicyMap policies; |
| 3956 // AllowGeolocation |
| 3957 policies.Set(key::kDefaultGeolocationSetting, POLICY_LEVEL_MANDATORY, |
| 3958 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
| 3959 base::MakeUnique<base::FundamentalValue>(1), nullptr); |
| 3960 UpdateProviderPolicy(policies); |
| 3961 EXPECT_TRUE(pref->GetBoolean(prefs::kArcLocationServiceEnabled)); |
| 3962 EXPECT_FALSE(pref->IsManagedPreference(prefs::kArcLocationServiceEnabled)); |
| 3963 |
| 3964 // BlockGeolocation |
| 3965 policies.Set(key::kDefaultGeolocationSetting, POLICY_LEVEL_MANDATORY, |
| 3966 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
| 3967 base::MakeUnique<base::FundamentalValue>(2), nullptr); |
| 3968 UpdateProviderPolicy(policies); |
| 3969 EXPECT_FALSE(pref->GetBoolean(prefs::kArcLocationServiceEnabled)); |
| 3970 EXPECT_TRUE(pref->IsManagedPreference(prefs::kArcLocationServiceEnabled)); |
| 3971 |
| 3972 // AskGeolocation |
| 3973 policies.Set(key::kDefaultGeolocationSetting, POLICY_LEVEL_MANDATORY, |
| 3974 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
| 3975 base::MakeUnique<base::FundamentalValue>(3), nullptr); |
| 3976 UpdateProviderPolicy(policies); |
| 3977 EXPECT_TRUE(pref->GetBoolean(prefs::kArcLocationServiceEnabled)); |
| 3978 EXPECT_FALSE(pref->IsManagedPreference(prefs::kArcLocationServiceEnabled)); |
| 3979 |
| 3980 TearDownTest(); |
| 3981 } |
| 3982 |
3944 namespace { | 3983 namespace { |
3945 const char kTestUser1[] = "test1@domain.com"; | 3984 const char kTestUser1[] = "test1@domain.com"; |
3946 } // anonymous namespace | 3985 } // anonymous namespace |
3947 | 3986 |
3948 class ChromeOSPolicyTest : public PolicyTest { | 3987 class ChromeOSPolicyTest : public PolicyTest { |
3949 public: | 3988 public: |
3950 ChromeOSPolicyTest() {} | 3989 ChromeOSPolicyTest() {} |
3951 | 3990 |
3952 void SetUpCommandLine(base::CommandLine* command_line) override { | 3991 void SetUpCommandLine(base::CommandLine* command_line) override { |
3953 PolicyTest::SetUpCommandLine(command_line); | 3992 PolicyTest::SetUpCommandLine(command_line); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4075 | 4114 |
4076 SetEmptyPolicy(); | 4115 SetEmptyPolicy(); |
4077 // Policy not set. | 4116 // Policy not set. |
4078 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4117 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
4079 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4118 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
4080 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4119 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
4081 } | 4120 } |
4082 #endif // defined(OS_CHROMEOS) | 4121 #endif // defined(OS_CHROMEOS) |
4083 | 4122 |
4084 } // namespace policy | 4123 } // namespace policy |
OLD | NEW |