From 4da06efd6d467e07ac311a59e5f79bd0cc6145d4 Mon Sep 17 00:00:00 2001 From: "bauerb@chromium.org" Date: Mon, 25 Oct 2010 12:28:22 +0000 Subject: Add UI test for click-to-play. BUG=57277 TEST=NPAPIVisiblePluginTester.ClickToPlay:ClickToPlayPluginTest.* Review URL: http://codereview.chromium.org/3539002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63722 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/plugin/plugin_test.cpp | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'chrome/test/plugin/plugin_test.cpp') diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp index cc93c45..a0afffa 100644 --- a/chrome/test/plugin/plugin_test.cpp +++ b/chrome/test/plugin/plugin_test.cpp @@ -138,6 +138,51 @@ TEST_F(PluginTest, Flash) { TestPlugin("flash.html?" + kFlashQuery, action_max_timeout_ms(), false); } +class ClickToPlayPluginTest : public PluginTest { + public: + ClickToPlayPluginTest() { + dom_automation_enabled_ = true; + } +}; + +TEST_F(ClickToPlayPluginTest, Flash) { + scoped_refptr browser(automation()->GetBrowserWindow(0)); + ASSERT_TRUE(browser.get()); + ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, + CONTENT_SETTING_BLOCK)); + + GURL url = GetTestUrl("flash-clicktoplay.html", true); + NavigateToURL(url); + + scoped_refptr tab(browser->GetTab(0)); + ASSERT_TRUE(tab.get()); + + ASSERT_TRUE(tab->LoadBlockedPlugins()); + + WaitForFinish(action_max_timeout_ms(), true); +} + +TEST_F(ClickToPlayPluginTest, FlashDocument) { + scoped_refptr browser(automation()->GetBrowserWindow(0)); + ASSERT_TRUE(browser.get()); + ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, + CONTENT_SETTING_BLOCK)); + + scoped_refptr tab(browser->GetTab(0)); + ASSERT_TRUE(tab.get()); + GURL url = GetTestUrl("js-invoker.swf?callback=done", true); + NavigateToURL(url); + + // Inject the callback function into the HTML page generated by the browser. + ASSERT_TRUE(tab->ExecuteJavaScript("window.done = function() {" + " window.location = \"done.html\";" + "}")); + + ASSERT_TRUE(tab->LoadBlockedPlugins()); + + WaitForFinish(action_max_timeout_ms(), true); +} + #if defined(OS_WIN) // Windows only test TEST_F(PluginTest, FlashSecurity) { -- cgit v1.1