| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 11 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
| 12 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 14 #include "chrome/browser/net/url_request_mock_util.h" | 14 #include "chrome/browser/net/url_request_mock_util.h" |
| 15 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 15 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_commands.h" | 18 #include "chrome/browser/ui/browser_commands.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
| 22 #include "chrome/test/base/test_launcher_utils.h" |
| 22 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
| 23 #include "components/content_settings/core/browser/cookie_settings.h" | 24 #include "components/content_settings/core/browser/cookie_settings.h" |
| 24 #include "components/content_settings/core/browser/host_content_settings_map.h" | 25 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/notification_observer.h" | 27 #include "content/public/browser/notification_observer.h" |
| 27 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
| 28 #include "content/public/browser/plugin_service.h" | 29 #include "content/public/browser/plugin_service.h" |
| 29 #include "content/public/browser/render_frame_host.h" | 30 #include "content/public/browser/render_frame_host.h" |
| 30 #include "content/public/browser/render_process_host.h" | 31 #include "content/public/browser/render_process_host.h" |
| 31 #include "content/public/browser/render_view_host.h" | 32 #include "content/public/browser/render_view_host.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 #if defined(ENABLE_PLUGINS) | 322 #if defined(ENABLE_PLUGINS) |
| 322 class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest { | 323 class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest { |
| 323 protected: | 324 protected: |
| 324 // Registers any CDM plugins not registered by default. | 325 // Registers any CDM plugins not registered by default. |
| 325 void SetUpCommandLine(base::CommandLine* command_line) override { | 326 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 326 #if defined(ENABLE_PEPPER_CDMS) | 327 #if defined(ENABLE_PEPPER_CDMS) |
| 327 // Append the switch to register the External Clear Key CDM. | 328 // Append the switch to register the External Clear Key CDM. |
| 328 base::FilePath::StringType pepper_plugins = BuildPepperCdmRegistration( | 329 base::FilePath::StringType pepper_plugins = BuildPepperCdmRegistration( |
| 329 kClearKeyCdmBaseDirectory, kClearKeyCdmAdapterFileName, | 330 kClearKeyCdmBaseDirectory, kClearKeyCdmAdapterFileName, |
| 330 kClearKeyCdmDisplayName, kClearKeyCdmPepperMimeType); | 331 kClearKeyCdmDisplayName, kClearKeyCdmPepperMimeType); |
| 331 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | |
| 332 // The CDM must be registered when it is a component. | |
| 333 pepper_plugins.append(FILE_PATH_LITERAL(",")); | |
| 334 pepper_plugins.append(BuildPepperCdmRegistration( | |
| 335 kWidevineCdmBaseDirectory, kWidevineCdmAdapterFileName, | |
| 336 kWidevineCdmDisplayName, kWidevineCdmPluginMimeType)); | |
| 337 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | |
| 338 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, | 332 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
| 339 pepper_plugins); | 333 pepper_plugins); |
| 340 #endif // defined(ENABLE_PEPPER_CDMS) | 334 #endif // defined(ENABLE_PEPPER_CDMS) |
| 341 | 335 |
| 342 #if !defined(DISABLE_NACL) | 336 #if !defined(DISABLE_NACL) |
| 343 // Ensure NaCl can run. | 337 // Ensure NaCl can run. |
| 344 command_line->AppendSwitch(switches::kEnableNaCl); | 338 command_line->AppendSwitch(switches::kEnableNaCl); |
| 345 #endif | 339 #endif |
| 346 } | 340 } |
| 347 | 341 |
| 342 #if defined(ENABLE_PEPPER_CDMS) |
| 343 void SetUpDefaultCommandLine(base::CommandLine* command_line) override { |
| 344 base::CommandLine default_command_line(base::CommandLine::NO_PROGRAM); |
| 345 InProcessBrowserTest::SetUpDefaultCommandLine(&default_command_line); |
| 346 test_launcher_utils::RemoveCommandLineSwitch( |
| 347 default_command_line, switches::kDisableComponentUpdate, command_line); |
| 348 } |
| 349 #endif // defined(ENABLE_PEPPER_CDMS) |
| 350 |
| 348 void RunLoadPepperPluginTest(const char* mime_type, bool expect_loaded) { | 351 void RunLoadPepperPluginTest(const char* mime_type, bool expect_loaded) { |
| 349 const char* expected_result = expect_loaded ? "Loaded" : "Not Loaded"; | 352 const char* expected_result = expect_loaded ? "Loaded" : "Not Loaded"; |
| 350 content::WebContents* web_contents = | 353 content::WebContents* web_contents = |
| 351 browser()->tab_strip_model()->GetActiveWebContents(); | 354 browser()->tab_strip_model()->GetActiveWebContents(); |
| 352 | 355 |
| 353 base::string16 expected_title(base::ASCIIToUTF16(expected_result)); | 356 base::string16 expected_title(base::ASCIIToUTF16(expected_result)); |
| 354 content::TitleWatcher title_watcher(web_contents, expected_title); | 357 content::TitleWatcher title_watcher(web_contents, expected_title); |
| 355 | 358 |
| 356 // GetTestUrl assumes paths, so we must append query parameters to result. | 359 // GetTestUrl assumes paths, so we must append query parameters to result. |
| 357 GURL file_url = ui_test_utils::GetTestUrl( | 360 GURL file_url = ui_test_utils::GetTestUrl( |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 #endif // defined(ENABLE_PEPPER_CDMS) | 505 #endif // defined(ENABLE_PEPPER_CDMS) |
| 503 | 506 |
| 504 #if !defined(DISABLE_NACL) | 507 #if !defined(DISABLE_NACL) |
| 505 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, | 508 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, |
| 506 NaCl) { | 509 NaCl) { |
| 507 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); | 510 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); |
| 508 } | 511 } |
| 509 #endif // !defined(DISABLE_NACL) | 512 #endif // !defined(DISABLE_NACL) |
| 510 | 513 |
| 511 #endif // defined(ENABLE_PLUGINS) | 514 #endif // defined(ENABLE_PLUGINS) |
| OLD | NEW |