| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 #include "extensions/browser/extension_system.h" | 161 #include "extensions/browser/extension_system.h" |
| 162 #include "extensions/browser/process_manager.h" | 162 #include "extensions/browser/process_manager.h" |
| 163 #include "extensions/browser/scoped_ignore_content_verifier_for_test.h" | 163 #include "extensions/browser/scoped_ignore_content_verifier_for_test.h" |
| 164 #include "extensions/browser/test_extension_registry_observer.h" | 164 #include "extensions/browser/test_extension_registry_observer.h" |
| 165 #include "extensions/browser/uninstall_reason.h" | 165 #include "extensions/browser/uninstall_reason.h" |
| 166 #include "extensions/common/constants.h" | 166 #include "extensions/common/constants.h" |
| 167 #include "extensions/common/extension.h" | 167 #include "extensions/common/extension.h" |
| 168 #include "extensions/common/extension_set.h" | 168 #include "extensions/common/extension_set.h" |
| 169 #include "extensions/common/features/feature_channel.h" | 169 #include "extensions/common/features/feature_channel.h" |
| 170 #include "extensions/common/manifest_handlers/shared_module_info.h" | 170 #include "extensions/common/manifest_handlers/shared_module_info.h" |
| 171 #include "media/media_features.h" |
| 171 #include "net/base/net_errors.h" | 172 #include "net/base/net_errors.h" |
| 172 #include "net/base/url_util.h" | 173 #include "net/base/url_util.h" |
| 173 #include "net/http/http_stream_factory.h" | 174 #include "net/http/http_stream_factory.h" |
| 174 #include "net/http/transport_security_state.h" | 175 #include "net/http/transport_security_state.h" |
| 175 #include "net/test/embedded_test_server/embedded_test_server.h" | 176 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 176 #include "net/test/url_request/url_request_failed_job.h" | 177 #include "net/test/url_request/url_request_failed_job.h" |
| 177 #include "net/test/url_request/url_request_mock_http_job.h" | 178 #include "net/test/url_request/url_request_mock_http_job.h" |
| 178 #include "net/url_request/url_request.h" | 179 #include "net/url_request/url_request.h" |
| 179 #include "net/url_request/url_request_filter.h" | 180 #include "net/url_request/url_request_filter.h" |
| 180 #include "net/url_request/url_request_interceptor.h" | 181 #include "net/url_request/url_request_interceptor.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 const base::FilePath::CharType kGoodUnpackedExt[] = | 272 const base::FilePath::CharType kGoodUnpackedExt[] = |
| 272 FILE_PATH_LITERAL("good_unpacked"); | 273 FILE_PATH_LITERAL("good_unpacked"); |
| 273 const base::FilePath::CharType kAppUnpackedExt[] = | 274 const base::FilePath::CharType kAppUnpackedExt[] = |
| 274 FILE_PATH_LITERAL("app"); | 275 FILE_PATH_LITERAL("app"); |
| 275 | 276 |
| 276 #if !defined(OS_MACOSX) | 277 #if !defined(OS_MACOSX) |
| 277 const base::FilePath::CharType kUnpackedFullscreenAppName[] = | 278 const base::FilePath::CharType kUnpackedFullscreenAppName[] = |
| 278 FILE_PATH_LITERAL("fullscreen_app"); | 279 FILE_PATH_LITERAL("fullscreen_app"); |
| 279 #endif // !defined(OS_MACOSX) | 280 #endif // !defined(OS_MACOSX) |
| 280 | 281 |
| 281 #if defined(ENABLE_WEBRTC) | 282 #if BUILDFLAG(ENABLE_WEBRTC) |
| 282 // Arbitrary port range for testing the WebRTC UDP port policy. | 283 // Arbitrary port range for testing the WebRTC UDP port policy. |
| 283 const char kTestWebRtcUdpPortRange[] = "10000-10100"; | 284 const char kTestWebRtcUdpPortRange[] = "10000-10100"; |
| 284 #endif | 285 #endif |
| 285 | 286 |
| 286 // Filters requests to the hosts in |urls| and redirects them to the test data | 287 // Filters requests to the hosts in |urls| and redirects them to the test data |
| 287 // dir through URLRequestMockHTTPJobs. | 288 // dir through URLRequestMockHTTPJobs. |
| 288 void RedirectHostsToTestData(const char* const urls[], size_t size) { | 289 void RedirectHostsToTestData(const char* const urls[], size_t size) { |
| 289 // Map the given hosts to the test data dir. | 290 // Map the given hosts to the test data dir. |
| 290 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); | 291 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); |
| 291 base::FilePath base_path; | 292 base::FilePath base_path; |
| (...skipping 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3479 | 3480 |
| 3480 IN_PROC_BROWSER_TEST_F(MediaRouterEnabledPolicyTest, MediaRouterEnabled) { | 3481 IN_PROC_BROWSER_TEST_F(MediaRouterEnabledPolicyTest, MediaRouterEnabled) { |
| 3481 EXPECT_TRUE(media_router::MediaRouterEnabled(browser()->profile())); | 3482 EXPECT_TRUE(media_router::MediaRouterEnabled(browser()->profile())); |
| 3482 } | 3483 } |
| 3483 | 3484 |
| 3484 IN_PROC_BROWSER_TEST_F(MediaRouterDisabledPolicyTest, MediaRouterDisabled) { | 3485 IN_PROC_BROWSER_TEST_F(MediaRouterDisabledPolicyTest, MediaRouterDisabled) { |
| 3485 EXPECT_FALSE(media_router::MediaRouterEnabled(browser()->profile())); | 3486 EXPECT_FALSE(media_router::MediaRouterEnabled(browser()->profile())); |
| 3486 } | 3487 } |
| 3487 #endif // defined(ENABLE_MEDIA_ROUTER) | 3488 #endif // defined(ENABLE_MEDIA_ROUTER) |
| 3488 | 3489 |
| 3489 #if defined(ENABLE_WEBRTC) | 3490 #if BUILDFLAG(ENABLE_WEBRTC) |
| 3490 // Sets the proper policy before the browser is started. | 3491 // Sets the proper policy before the browser is started. |
| 3491 template <bool enable> | 3492 template <bool enable> |
| 3492 class WebRtcUdpPortRangePolicyTest : public PolicyTest { | 3493 class WebRtcUdpPortRangePolicyTest : public PolicyTest { |
| 3493 public: | 3494 public: |
| 3494 WebRtcUdpPortRangePolicyTest() = default; | 3495 WebRtcUdpPortRangePolicyTest() = default; |
| 3495 void SetUpInProcessBrowserTestFixture() override { | 3496 void SetUpInProcessBrowserTestFixture() override { |
| 3496 PolicyTest::SetUpInProcessBrowserTestFixture(); | 3497 PolicyTest::SetUpInProcessBrowserTestFixture(); |
| 3497 PolicyMap policies; | 3498 PolicyMap policies; |
| 3498 if (enable) { | 3499 if (enable) { |
| 3499 policies.Set(key::kWebRtcUdpPortRange, POLICY_LEVEL_MANDATORY, | 3500 policies.Set(key::kWebRtcUdpPortRange, POLICY_LEVEL_MANDATORY, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 3524 | 3525 |
| 3525 IN_PROC_BROWSER_TEST_F(WebRtcUdpPortRangeDisabledPolicyTest, | 3526 IN_PROC_BROWSER_TEST_F(WebRtcUdpPortRangeDisabledPolicyTest, |
| 3526 WebRtcUdpPortRangeDisabled) { | 3527 WebRtcUdpPortRangeDisabled) { |
| 3527 std::string port_range; | 3528 std::string port_range; |
| 3528 const PrefService::Preference* pref = | 3529 const PrefService::Preference* pref = |
| 3529 user_prefs::UserPrefs::Get(browser()->profile()) | 3530 user_prefs::UserPrefs::Get(browser()->profile()) |
| 3530 ->FindPreference(prefs::kWebRTCUDPPortRange); | 3531 ->FindPreference(prefs::kWebRTCUDPPortRange); |
| 3531 pref->GetValue()->GetAsString(&port_range); | 3532 pref->GetValue()->GetAsString(&port_range); |
| 3532 EXPECT_TRUE(port_range.empty()); | 3533 EXPECT_TRUE(port_range.empty()); |
| 3533 } | 3534 } |
| 3534 #endif // defined(ENABLE_WEBRTC) | 3535 #endif // BUILDFLAG(ENABLE_WEBRTC) |
| 3535 | 3536 |
| 3536 // Tests the ComponentUpdater's EnabledComponentUpdates group policy by | 3537 // Tests the ComponentUpdater's EnabledComponentUpdates group policy by |
| 3537 // calling the OnDemand interface. It uses the network interceptor to inspect | 3538 // calling the OnDemand interface. It uses the network interceptor to inspect |
| 3538 // the presence of the updatedisabled="true" attribute in the update check | 3539 // the presence of the updatedisabled="true" attribute in the update check |
| 3539 // request. The update check request is expected to fail, since CUP fails. | 3540 // request. The update check request is expected to fail, since CUP fails. |
| 3540 class ComponentUpdaterPolicyTest : public PolicyTest { | 3541 class ComponentUpdaterPolicyTest : public PolicyTest { |
| 3541 public: | 3542 public: |
| 3542 ComponentUpdaterPolicyTest(); | 3543 ComponentUpdaterPolicyTest(); |
| 3543 ~ComponentUpdaterPolicyTest() override; | 3544 ~ComponentUpdaterPolicyTest() override; |
| 3544 | 3545 |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4225 | 4226 |
| 4226 SetEmptyPolicy(); | 4227 SetEmptyPolicy(); |
| 4227 // Policy not set. | 4228 // Policy not set. |
| 4228 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4229 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
| 4229 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4230 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
| 4230 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4231 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| 4231 } | 4232 } |
| 4232 #endif // defined(OS_CHROMEOS) | 4233 #endif // defined(OS_CHROMEOS) |
| 4233 | 4234 |
| 4234 } // namespace policy | 4235 } // namespace policy |
| OLD | NEW |