Chromium Code Reviews| Index: chrome/browser/content_settings/content_settings_browsertest.cc |
| diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc |
| index 39ca7adb5f5623dffb84b989a62c4efbfde6172d..27aab5037a4f018dd356370eba81ca5f9021db73 100644 |
| --- a/chrome/browser/content_settings/content_settings_browsertest.cc |
| +++ b/chrome/browser/content_settings/content_settings_browsertest.cc |
| @@ -32,14 +32,17 @@ |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/web_contents.h" |
| +#include "content/public/common/content_constants.h" |
| #include "content/public/common/content_switches.h" |
| #include "content/public/common/mhtml_generation_params.h" |
| #include "content/public/test/browser_test_utils.h" |
| +#include "content/public/test/ppapi_test_utils.h" |
| #include "content/public/test/test_utils.h" |
| #include "media/cdm/cdm_paths.h" |
| #include "net/dns/mock_host_resolver.h" |
| #include "net/test/embedded_test_server/embedded_test_server.h" |
| #include "net/test/url_request/url_request_mock_http_job.h" |
| +#include "ppapi/shared_impl/ppapi_switches.h" |
| #include "testing/gmock/include/gmock/gmock.h" |
| #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| @@ -47,11 +50,6 @@ |
| #include "base/mac/scoped_nsautorelease_pool.h" |
| #endif |
| -#if defined(ENABLE_PEPPER_CDMS) |
|
raymes
2016/09/26 08:18:29
I'm not sure if this was specifically testing some
tommycli
2016/09/26 16:29:44
xhwang, can you verify that changing this to test
|
| -#include "chrome/browser/media/pepper_cdm_test_constants.h" |
| -#include "chrome/browser/media/pepper_cdm_test_helper.h" |
| -#endif |
| - |
| using content::BrowserThread; |
| using net::URLRequestMockHTTPJob; |
| @@ -342,16 +340,9 @@ IN_PROC_BROWSER_TEST_F(ContentSettingsTest, RedirectCrossOrigin) { |
| #if defined(ENABLE_PLUGINS) |
| class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest { |
| protected: |
| - // Registers any CDM plugins not registered by default. |
| void SetUpCommandLine(base::CommandLine* command_line) override { |
| -#if defined(ENABLE_PEPPER_CDMS) |
| - // Append the switch to register the External Clear Key CDM. |
| - base::FilePath::StringType pepper_plugins = BuildPepperCdmRegistration( |
| - kClearKeyCdmBaseDirectory, kClearKeyCdmAdapterFileName, |
| - kClearKeyCdmDisplayName, kClearKeyCdmPepperMimeType); |
| - command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
| - pepper_plugins); |
| -#endif // defined(ENABLE_PEPPER_CDMS) |
| + // This plugin is treated like Flash by Content Settings. |
| + ASSERT_TRUE(ppapi::RegisterPowerSaverTestPlugin(command_line)); |
| #if !defined(DISABLE_NACL) |
| // Ensure NaCl can run. |
| @@ -359,14 +350,12 @@ class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest { |
| #endif |
| } |
| -#if defined(ENABLE_PEPPER_CDMS) |
| void SetUpDefaultCommandLine(base::CommandLine* command_line) override { |
| base::CommandLine default_command_line(base::CommandLine::NO_PROGRAM); |
| InProcessBrowserTest::SetUpDefaultCommandLine(&default_command_line); |
| test_launcher_utils::RemoveCommandLineSwitch( |
| default_command_line, switches::kDisableComponentUpdate, command_line); |
| } |
| -#endif // defined(ENABLE_PEPPER_CDMS) |
| void RunLoadPepperPluginTest(const char* mime_type, bool expect_loaded) { |
| const char* expected_result = expect_loaded ? "Loaded" : "Not Loaded"; |
| @@ -469,26 +458,19 @@ class PepperContentSettingsSpecialCasesJavaScriptBlockedTest |
| } |
| }; |
| -#if defined(ENABLE_PEPPER_CDMS) |
| // A sanity check to verify that the plugin that is used as a baseline below |
| // can be loaded. |
| IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesTest, Baseline) { |
| - HostContentSettingsMapFactory::GetForProfile(browser()->profile()) |
| - ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, |
| - CONTENT_SETTING_ALLOW); |
| - |
| - RunLoadPepperPluginTest(kClearKeyCdmPepperMimeType, true); |
| + RunLoadPepperPluginTest(content::kTestPluginMimeType, true); |
| } |
| -#endif // defined(ENABLE_PEPPER_CDMS) |
| // The following tests verify that Pepper plugins that use JavaScript settings |
| // instead of Plugins settings still work when Plugins are blocked. |
| -#if defined(ENABLE_PEPPER_CDMS) |
| // The plugin successfully loaded above is blocked. |
| IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, |
| Normal) { |
| - RunLoadPepperPluginTest(kClearKeyCdmPepperMimeType, false); |
| + RunLoadPepperPluginTest(content::kTestPluginMimeType, false); |
| } |
| #if defined(WIDEVINE_CDM_AVAILABLE) && !defined(OS_CHROMEOS) |
| @@ -502,7 +484,6 @@ IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, |
| RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true); |
| } |
| #endif // defined(WIDEVINE_CDM_AVAILABLE) && !defined(OS_CHROMEOS) |
| -#endif // defined(ENABLE_PEPPER_CDMS) |
| #if !defined(DISABLE_NACL) |
| IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, |
| @@ -514,11 +495,10 @@ IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, |
| // The following tests verify that those same Pepper plugins do not work when |
| // JavaScript is blocked. |
| -#if defined(ENABLE_PEPPER_CDMS) |
| // A plugin with no special behavior is not blocked when JavaScript is blocked. |
| IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, |
| Normal) { |
| - RunJavaScriptBlockedTest("load_clearkey_no_js.html", false); |
| + RunJavaScriptBlockedTest("load_test_plugin_no_js.html", false); |
| } |
| #if defined(WIDEVINE_CDM_AVAILABLE) |
| @@ -532,7 +512,6 @@ IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, |
| RunJavaScriptBlockedTest("load_widevine_no_js.html", true); |
| } |
| #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| -#endif // defined(ENABLE_PEPPER_CDMS) |
| #if !defined(DISABLE_NACL) |
| IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, |