| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "content/public/browser/notification_observer.h" | 27 #include "content/public/browser/notification_observer.h" |
| 28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
| 29 #include "content/public/browser/plugin_service.h" | 29 #include "content/public/browser/plugin_service.h" |
| 30 #include "content/public/browser/render_frame_host.h" | 30 #include "content/public/browser/render_frame_host.h" |
| 31 #include "content/public/browser/render_process_host.h" | 31 #include "content/public/browser/render_process_host.h" |
| 32 #include "content/public/browser/render_view_host.h" | 32 #include "content/public/browser/render_view_host.h" |
| 33 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
| 34 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
| 35 #include "content/public/test/browser_test_utils.h" | 35 #include "content/public/test/browser_test_utils.h" |
| 36 #include "content/public/test/test_utils.h" | 36 #include "content/public/test/test_utils.h" |
| 37 #include "media/cdm/cdm_paths.h" |
| 37 #include "net/dns/mock_host_resolver.h" | 38 #include "net/dns/mock_host_resolver.h" |
| 38 #include "net/test/embedded_test_server/embedded_test_server.h" | 39 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 39 #include "net/test/url_request/url_request_mock_http_job.h" | 40 #include "net/test/url_request/url_request_mock_http_job.h" |
| 40 | 41 |
| 41 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 42 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 42 | 43 |
| 43 #if defined(OS_MACOSX) | 44 #if defined(OS_MACOSX) |
| 44 #include "base/mac/scoped_nsautorelease_pool.h" | 45 #include "base/mac/scoped_nsautorelease_pool.h" |
| 45 #endif | 46 #endif |
| 46 | 47 |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 #if defined(ENABLE_PEPPER_CDMS) | 468 #if defined(ENABLE_PEPPER_CDMS) |
| 468 // The plugin successfully loaded above is blocked. | 469 // The plugin successfully loaded above is blocked. |
| 469 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, | 470 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, |
| 470 Normal) { | 471 Normal) { |
| 471 RunLoadPepperPluginTest(kClearKeyCdmPepperMimeType, false); | 472 RunLoadPepperPluginTest(kClearKeyCdmPepperMimeType, false); |
| 472 } | 473 } |
| 473 | 474 |
| 474 #if defined(WIDEVINE_CDM_AVAILABLE) && !defined(OS_CHROMEOS) | 475 #if defined(WIDEVINE_CDM_AVAILABLE) && !defined(OS_CHROMEOS) |
| 475 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, | 476 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, |
| 476 WidevineCdm) { | 477 WidevineCdm) { |
| 478 // Check that Widevine CDM is available and registered. |
| 479 base::FilePath adapter_path = |
| 480 GetPepperCdmPath(kWidevineCdmBaseDirectory, kWidevineCdmAdapterFileName); |
| 481 EXPECT_TRUE(base::PathExists(adapter_path)) << adapter_path.MaybeAsASCII(); |
| 482 EXPECT_TRUE(IsPepperCdmRegistered(kWidevineCdmPluginMimeType)); |
| 477 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true); | 483 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true); |
| 478 } | 484 } |
| 479 #endif // defined(WIDEVINE_CDM_AVAILABLE) && !defined(OS_CHROMEOS) | 485 #endif // defined(WIDEVINE_CDM_AVAILABLE) && !defined(OS_CHROMEOS) |
| 480 #endif // defined(ENABLE_PEPPER_CDMS) | 486 #endif // defined(ENABLE_PEPPER_CDMS) |
| 481 | 487 |
| 482 #if !defined(DISABLE_NACL) | 488 #if !defined(DISABLE_NACL) |
| 483 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, | 489 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, |
| 484 NaCl) { | 490 NaCl) { |
| 485 RunLoadPepperPluginTest("application/x-nacl", true); | 491 RunLoadPepperPluginTest("application/x-nacl", true); |
| 486 } | 492 } |
| 487 #endif // !defined(DISABLE_NACL) | 493 #endif // !defined(DISABLE_NACL) |
| 488 | 494 |
| 489 // The following tests verify that those same Pepper plugins do not work when | 495 // The following tests verify that those same Pepper plugins do not work when |
| 490 // JavaScript is blocked. | 496 // JavaScript is blocked. |
| 491 | 497 |
| 492 #if defined(ENABLE_PEPPER_CDMS) | 498 #if defined(ENABLE_PEPPER_CDMS) |
| 493 // A plugin with no special behavior is not blocked when JavaScript is blocked. | 499 // A plugin with no special behavior is not blocked when JavaScript is blocked. |
| 494 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, | 500 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, |
| 495 Normal) { | 501 Normal) { |
| 496 RunJavaScriptBlockedTest("load_clearkey_no_js.html", false); | 502 RunJavaScriptBlockedTest("load_clearkey_no_js.html", false); |
| 497 } | 503 } |
| 498 | 504 |
| 499 #if defined(WIDEVINE_CDM_AVAILABLE) | 505 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 500 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, | 506 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, |
| 501 WidevineCdm) { | 507 WidevineCdm) { |
| 508 // Check that Widevine CDM is available and registered. |
| 509 base::FilePath adapter_path = |
| 510 GetPepperCdmPath(kWidevineCdmBaseDirectory, kWidevineCdmAdapterFileName); |
| 511 EXPECT_TRUE(base::PathExists(adapter_path)) << adapter_path.MaybeAsASCII(); |
| 512 EXPECT_TRUE(IsPepperCdmRegistered(kWidevineCdmPluginMimeType)); |
| 502 RunJavaScriptBlockedTest("load_widevine_no_js.html", true); | 513 RunJavaScriptBlockedTest("load_widevine_no_js.html", true); |
| 503 } | 514 } |
| 504 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 515 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 505 #endif // defined(ENABLE_PEPPER_CDMS) | 516 #endif // defined(ENABLE_PEPPER_CDMS) |
| 506 | 517 |
| 507 #if !defined(DISABLE_NACL) | 518 #if !defined(DISABLE_NACL) |
| 508 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, | 519 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, |
| 509 NaCl) { | 520 NaCl) { |
| 510 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); | 521 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); |
| 511 } | 522 } |
| 512 #endif // !defined(DISABLE_NACL) | 523 #endif // !defined(DISABLE_NACL) |
| 513 | 524 |
| 514 #endif // defined(ENABLE_PLUGINS) | 525 #endif // defined(ENABLE_PLUGINS) |
| OLD | NEW |