| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "chrome/browser/extensions/extension_management_constants.h" | 47 #include "chrome/browser/extensions/extension_management_constants.h" |
| 48 #include "chrome/browser/extensions/extension_management_test_util.h" | 48 #include "chrome/browser/extensions/extension_management_test_util.h" |
| 49 #include "chrome/browser/extensions/extension_service.h" | 49 #include "chrome/browser/extensions/extension_service.h" |
| 50 #include "chrome/browser/extensions/shared_module_service.h" | 50 #include "chrome/browser/extensions/shared_module_service.h" |
| 51 #include "chrome/browser/extensions/unpacked_installer.h" | 51 #include "chrome/browser/extensions/unpacked_installer.h" |
| 52 #include "chrome/browser/extensions/updater/extension_cache_fake.h" | 52 #include "chrome/browser/extensions/updater/extension_cache_fake.h" |
| 53 #include "chrome/browser/extensions/updater/extension_updater.h" | 53 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 54 #include "chrome/browser/infobars/infobar_service.h" | 54 #include "chrome/browser/infobars/infobar_service.h" |
| 55 #include "chrome/browser/interstitials/security_interstitial_page.h" | 55 #include "chrome/browser/interstitials/security_interstitial_page.h" |
| 56 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" | 56 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" |
| 57 #include "chrome/browser/io_thread.h" |
| 57 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 58 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 58 #include "chrome/browser/media/media_stream_devices_controller.h" | 59 #include "chrome/browser/media/media_stream_devices_controller.h" |
| 59 #include "chrome/browser/media/router/media_router_feature.h" | 60 #include "chrome/browser/media/router/media_router_feature.h" |
| 60 #include "chrome/browser/metrics/variations/chrome_variations_service_client.h" | 61 #include "chrome/browser/metrics/variations/chrome_variations_service_client.h" |
| 61 #include "chrome/browser/net/prediction_options.h" | 62 #include "chrome/browser/net/prediction_options.h" |
| 62 #include "chrome/browser/net/url_request_mock_util.h" | 63 #include "chrome/browser/net/url_request_mock_util.h" |
| 63 #include "chrome/browser/plugins/plugin_prefs.h" | 64 #include "chrome/browser/plugins/plugin_prefs.h" |
| 64 #include "chrome/browser/policy/cloud/test_request_interceptor.h" | 65 #include "chrome/browser/policy/cloud/test_request_interceptor.h" |
| 65 #include "chrome/browser/policy/profile_policy_connector.h" | 66 #include "chrome/browser/policy/profile_policy_connector.h" |
| 66 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 67 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 // Verify that it can be force-enabled too. | 1347 // Verify that it can be force-enabled too. |
| 1347 browser()->profile()->GetPrefs()->SetBoolean(prefs::kDisableSpdy, true); | 1348 browser()->profile()->GetPrefs()->SetBoolean(prefs::kDisableSpdy, true); |
| 1348 policies.Set(key::kDisableSpdy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 1349 policies.Set(key::kDisableSpdy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 1349 POLICY_SOURCE_CLOUD, | 1350 POLICY_SOURCE_CLOUD, |
| 1350 base::WrapUnique(new base::FundamentalValue(false)), nullptr); | 1351 base::WrapUnique(new base::FundamentalValue(false)), nullptr); |
| 1351 UpdateProviderPolicy(policies); | 1352 UpdateProviderPolicy(policies); |
| 1352 content::RunAllPendingInMessageLoop(); | 1353 content::RunAllPendingInMessageLoop(); |
| 1353 EXPECT_TRUE(net::HttpStreamFactory::spdy_enabled()); | 1354 EXPECT_TRUE(net::HttpStreamFactory::spdy_enabled()); |
| 1354 } | 1355 } |
| 1355 | 1356 |
| 1357 namespace { |
| 1358 |
| 1359 // The following helpers retrieve whether https:// URL stripping is |
| 1360 // enabled for PAC scripts. It needs to run on the IO thread. |
| 1361 void GetPacHttpsUrlStrippingEnabledOnIOThread(IOThread* io_thread, |
| 1362 bool* enabled) { |
| 1363 *enabled = io_thread->PacHttpsUrlStrippingEnabled(); |
| 1364 } |
| 1365 |
| 1366 bool GetPacHttpsUrlStrippingEnabled() { |
| 1367 bool enabled; |
| 1368 base::RunLoop loop; |
| 1369 BrowserThread::PostTaskAndReply( |
| 1370 BrowserThread::IO, FROM_HERE, |
| 1371 base::Bind(&GetPacHttpsUrlStrippingEnabledOnIOThread, |
| 1372 g_browser_process->io_thread(), base::Unretained(&enabled)), |
| 1373 loop.QuitClosure()); |
| 1374 loop.Run(); |
| 1375 return enabled; |
| 1376 } |
| 1377 |
| 1378 } // namespace |
| 1379 |
| 1380 // Verifies that stripping of https:// URLs before sending to PAC scripts can |
| 1381 // be disabled via a policy. Also verifies that stripping is enabled by |
| 1382 // default. |
| 1383 IN_PROC_BROWSER_TEST_F(PolicyTest, DisablePacHttpsUrlStripping) { |
| 1384 // Stripping is enabled by default. |
| 1385 EXPECT_TRUE(GetPacHttpsUrlStrippingEnabled()); |
| 1386 |
| 1387 // Disable it via a policy. |
| 1388 PolicyMap policies; |
| 1389 policies.Set(key::kPacHttpsUrlStrippingEnabled, POLICY_LEVEL_MANDATORY, |
| 1390 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
| 1391 base::WrapUnique(new base::FundamentalValue(false)), nullptr); |
| 1392 UpdateProviderPolicy(policies); |
| 1393 content::RunAllPendingInMessageLoop(); |
| 1394 |
| 1395 // It should now reflect as disabled. |
| 1396 EXPECT_FALSE(GetPacHttpsUrlStrippingEnabled()); |
| 1397 } |
| 1398 |
| 1356 IN_PROC_BROWSER_TEST_F(PolicyTest, DisabledPlugins) { | 1399 IN_PROC_BROWSER_TEST_F(PolicyTest, DisabledPlugins) { |
| 1357 // Verifies that plugins can be forced to be disabled by policy. | 1400 // Verifies that plugins can be forced to be disabled by policy. |
| 1358 | 1401 |
| 1359 // Verify that the Flash plugin exists and that it can be enabled and disabled | 1402 // Verify that the Flash plugin exists and that it can be enabled and disabled |
| 1360 // by the user. | 1403 // by the user. |
| 1361 std::vector<content::WebPluginInfo> plugins; | 1404 std::vector<content::WebPluginInfo> plugins; |
| 1362 GetPluginList(&plugins); | 1405 GetPluginList(&plugins); |
| 1363 const content::WebPluginInfo* flash = GetFlashPlugin(plugins); | 1406 const content::WebPluginInfo* flash = GetFlashPlugin(plugins); |
| 1364 if (!flash) | 1407 if (!flash) |
| 1365 return; | 1408 return; |
| (...skipping 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4060 | 4103 |
| 4061 SetEmptyPolicy(); | 4104 SetEmptyPolicy(); |
| 4062 // Policy not set. | 4105 // Policy not set. |
| 4063 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4106 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
| 4064 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4107 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
| 4065 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4108 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| 4066 } | 4109 } |
| 4067 #endif // defined(OS_CHROMEOS) | 4110 #endif // defined(OS_CHROMEOS) |
| 4068 | 4111 |
| 4069 } // namespace policy | 4112 } // namespace policy |
| OLD | NEW |