Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(783)

Unified Diff: chrome/browser/content_settings/content_settings_browsertest.cc

Issue 2356053002: [HBD] Only use Plugin Content Settings for Flash. (Closed)
Patch Set: fix prerender tests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..07438265fed367ea127b9fcd3220087789c38b96 100644
--- a/chrome/browser/content_settings/content_settings_browsertest.cc
+++ b/chrome/browser/content_settings/content_settings_browsertest.cc
@@ -6,6 +6,7 @@
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
@@ -17,6 +18,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/test_launcher_utils.h"
@@ -32,14 +34,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 +52,6 @@
#include "base/mac/scoped_nsautorelease_pool.h"
#endif
-#if defined(ENABLE_PEPPER_CDMS)
-#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 +342,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 +352,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);
xhwang 2016/09/26 23:44:50 The test related to the CDM is special that the CD
tommycli 2016/09/27 18:51:07 We should probably still test the CDM, since users
}
-#endif // defined(ENABLE_PEPPER_CDMS)
void RunLoadPepperPluginTest(const char* mime_type, bool expect_loaded) {
const char* expected_result = expect_loaded ? "Loaded" : "Not Loaded";
@@ -469,7 +460,6 @@ 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) {
@@ -477,18 +467,20 @@ IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesTest, Baseline) {
->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);
+ BlockedPlugin) {
+ // Disable the HTML by Default feature so we can test blocked plugins.
+ base::test::ScopedFeatureList feature_list;
+ feature_list.InitAndDisableFeature(features::kPreferHtmlOverPlugins);
+
+ RunLoadPepperPluginTest(content::kTestPluginMimeType, false);
}
#if defined(WIDEVINE_CDM_AVAILABLE) && !defined(OS_CHROMEOS)
@@ -502,7 +494,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 +505,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 +522,6 @@ IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest,
RunJavaScriptBlockedTest("load_widevine_no_js.html", true);
}
#endif // defined(WIDEVINE_CDM_AVAILABLE)
xhwang 2016/09/26 23:44:50 This should still be guarded by defined(ENABLE_PEP
xhwang 2016/09/27 20:35:26 This is not addressed.
tommycli 2016/09/27 20:45:38 Done. Thanks! I missed that one.
-#endif // defined(ENABLE_PEPPER_CDMS)
#if !defined(DISABLE_NACL)
IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest,

Powered by Google App Engine
This is Rietveld 408576698