| 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 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 | 1192 |
| 1193 // Go over all combinations of (undefined, true, false) for the | 1193 // Go over all combinations of (undefined, true, false) for the |
| 1194 // ForceGoogleSafeSearch policy. | 1194 // ForceGoogleSafeSearch policy. |
| 1195 for (int safe_search = 0; safe_search < 3; safe_search++) { | 1195 for (int safe_search = 0; safe_search < 3; safe_search++) { |
| 1196 // Override the Google safe search policy. | 1196 // Override the Google safe search policy. |
| 1197 ApplySafeSearchPolicy( | 1197 ApplySafeSearchPolicy( |
| 1198 nullptr, // ForceSafeSearch | 1198 nullptr, // ForceSafeSearch |
| 1199 safe_search == 0 // ForceGoogleSafeSearch | 1199 safe_search == 0 // ForceGoogleSafeSearch |
| 1200 ? nullptr | 1200 ? nullptr |
| 1201 : base::MakeUnique<base::FundamentalValue>(safe_search == 1), | 1201 : base::MakeUnique<base::FundamentalValue>(safe_search == 1), |
| 1202 nullptr, // ForceYouTubeSafetyMode | 1202 nullptr, // ForceYouTubeSafetyMode |
| 1203 nullptr // ForceYouTubeRestrict | 1203 nullptr); // ForceYouTubeRestrict |
| 1204 ); | |
| 1205 | 1204 |
| 1206 // Verify that the safe search pref behaves the way we expect. | 1205 // Verify that the safe search pref behaves the way we expect. |
| 1207 PrefService* prefs = browser()->profile()->GetPrefs(); | 1206 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 1208 EXPECT_EQ(safe_search != 0, | 1207 EXPECT_EQ(safe_search != 0, |
| 1209 prefs->IsManagedPreference(prefs::kForceGoogleSafeSearch)); | 1208 prefs->IsManagedPreference(prefs::kForceGoogleSafeSearch)); |
| 1210 EXPECT_EQ(safe_search == 1, | 1209 EXPECT_EQ(safe_search == 1, |
| 1211 prefs->GetBoolean(prefs::kForceGoogleSafeSearch)); | 1210 prefs->GetBoolean(prefs::kForceGoogleSafeSearch)); |
| 1212 | 1211 |
| 1213 // Verify that safe search actually works. | 1212 // Verify that safe search actually works. |
| 1214 CheckSafeSearch(safe_search == 1); | 1213 CheckSafeSearch(safe_search == 1); |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2086 | 2085 |
| 2087 policies.Set(key::kHomepageIsNewTabPage, POLICY_LEVEL_MANDATORY, | 2086 policies.Set(key::kHomepageIsNewTabPage, POLICY_LEVEL_MANDATORY, |
| 2088 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | 2087 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
| 2089 base::MakeUnique<base::FundamentalValue>(true), nullptr); | 2088 base::MakeUnique<base::FundamentalValue>(true), nullptr); |
| 2090 UpdateProviderPolicy(policies); | 2089 UpdateProviderPolicy(policies); |
| 2091 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME)); | 2090 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME)); |
| 2092 content::WaitForLoadStop(contents); | 2091 content::WaitForLoadStop(contents); |
| 2093 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), contents->GetURL()); | 2092 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), contents->GetURL()); |
| 2094 } | 2093 } |
| 2095 | 2094 |
| 2095 IN_PROC_BROWSER_TEST_F(PolicyTest, NewTabPageLocation) { |
| 2096 // Verifies that the New Tab page can be configured with policies. |
| 2097 PolicyMap policies; |
| 2098 policies.Set(key::kNewTabPageLocation, POLICY_LEVEL_MANDATORY, |
| 2099 POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT, |
| 2100 base::MakeUnique<base::StringValue>(chrome::kChromeUICreditsURL), |
| 2101 nullptr); |
| 2102 UpdateProviderPolicy(policies); |
| 2103 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 2104 EXPECT_EQ(chrome::kChromeUICreditsURL, |
| 2105 prefs->GetString(prefs::kNewTabPageLocationOverride)); |
| 2106 } |
| 2107 |
| 2096 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER) | 2108 #if defined(OS_MACOSX) && defined(ADDRESS_SANITIZER) |
| 2097 // Flaky on ASAN on Mac. See https://crbug.com/674497. | 2109 // Flaky on ASAN on Mac. See https://crbug.com/674497. |
| 2098 #define MAYBE_IncognitoEnabled DISABLED_IncognitoEnabled | 2110 #define MAYBE_IncognitoEnabled DISABLED_IncognitoEnabled |
| 2099 #else | 2111 #else |
| 2100 #define MAYBE_IncognitoEnabled IncognitoEnabled | 2112 #define MAYBE_IncognitoEnabled IncognitoEnabled |
| 2101 #endif | 2113 #endif |
| 2102 IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_IncognitoEnabled) { | 2114 IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_IncognitoEnabled) { |
| 2103 // Verifies that incognito windows can't be opened when disabled by policy. | 2115 // Verifies that incognito windows can't be opened when disabled by policy. |
| 2104 | 2116 |
| 2105 const BrowserList* active_browser_list = BrowserList::GetInstance(); | 2117 const BrowserList* active_browser_list = BrowserList::GetInstance(); |
| (...skipping 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4321 | 4333 |
| 4322 SetEmptyPolicy(); | 4334 SetEmptyPolicy(); |
| 4323 // Policy not set. | 4335 // Policy not set. |
| 4324 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4336 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
| 4325 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4337 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
| 4326 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4338 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| 4327 } | 4339 } |
| 4328 #endif // defined(OS_CHROMEOS) | 4340 #endif // defined(OS_CHROMEOS) |
| 4329 | 4341 |
| 4330 } // namespace policy | 4342 } // namespace policy |
| OLD | NEW |