summaryrefslogtreecommitdiffstats
path: root/webkit/tools
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-10 05:29:32 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-10 05:29:32 +0000
commitb1c25a2fdeade0e807af70df8136d5efa62033d2 (patch)
tree9ed31642f0e2eb899f6db76b3b33c60f1f0bacb8 /webkit/tools
parente322627c51db7ad243c49d096af20590828a00f9 (diff)
downloadchromium_src-b1c25a2fdeade0e807af70df8136d5efa62033d2.zip
chromium_src-b1c25a2fdeade0e807af70df8136d5efa62033d2.tar.gz
chromium_src-b1c25a2fdeade0e807af70df8136d5efa62033d2.tar.bz2
Fix plugin window sticking around when parent became invisible. Added test for all different scenarios.
Note I grabbed the plugin hwnd and manually checked it instead of looking for callbacks from the plugin's SetWindow since the latter isn't called if the visibility changes. BUG=1842096 TEST=regression test included, test http://chromedashboard per bug Review URL: http://codereview.chromium.org/115169 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r--webkit/tools/test_shell/plugin_tests.cc48
1 files changed, 39 insertions, 9 deletions
diff --git a/webkit/tools/test_shell/plugin_tests.cc b/webkit/tools/test_shell/plugin_tests.cc
index eae50e0..1fa32d4 100644
--- a/webkit/tools/test_shell/plugin_tests.cc
+++ b/webkit/tools/test_shell/plugin_tests.cc
@@ -51,6 +51,16 @@ class PluginTest : public TestShellTest {
file_util::Delete(plugin_file_path_, true);
}
+ virtual void SetUp() {
+ CopyTestPlugin();
+ TestShellTest::SetUp();
+ }
+
+ virtual void TearDown() {
+ DeleteTestPlugin();
+ TestShellTest::TearDown();
+ }
+
FilePath plugin_src_;
FilePath plugin_file_path_;
};
@@ -103,8 +113,6 @@ TEST_F(PluginTest, Refresh) {
test_shell_->webView()->GetMainFrame()->ExecuteScript(call_check);
test_shell_->webView()->GetMainFrame()->GetContentAsPlainText(10000, &text);
ASSERT_EQ(text, L"DONE");
-
- DeleteTestPlugin();
}
#if defined(OS_WIN)
@@ -158,18 +166,40 @@ TEST_F(PluginTest, DeleteFrameDuringEvent) {
}
#if defined(OS_WIN)
-// Tests that a hidden plugin is not shown. See http://crbug.com/8927
-TEST_F(PluginTest, HiddenPlugin) {
- CopyTestPlugin();
+BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lparam) {
+ HWND* plugin_hwnd = reinterpret_cast<HWND*>(lparam);
+ if (*plugin_hwnd) {
+ // More than one child window found, unexpected.
+ plugin_hwnd = NULL;
+ return FALSE;
+ }
+ *plugin_hwnd = hwnd;
+ return TRUE;
+}
+// Tests that hiding/showing the parent frame hides/shows the plugin.
+TEST_F(PluginTest, PluginVisibilty) {
FilePath test_html = data_dir_;
test_html = test_html.AppendASCII("plugins");
- test_html = test_html.AppendASCII("hidden_plugin.html");
+ test_html = test_html.AppendASCII("plugin_visibility.html");
test_shell_->LoadURL(test_html.ToWStringHack().c_str());
test_shell_->WaitTestFinished();
- std::wstring text;
- test_shell_->webView()->GetMainFrame()->GetContentAsPlainText(10000, &text);
- ASSERT_EQ(true, StartsWith(text, L"DONE", true));
+ WebFrame* main_frame = test_shell_->webView()->GetMainFrame();
+ HWND frame_hwnd = test_shell_->webViewWnd();
+ HWND plugin_hwnd = NULL;
+ EnumChildWindows(frame_hwnd, EnumChildProc,
+ reinterpret_cast<LPARAM>(&plugin_hwnd));
+ ASSERT_TRUE(plugin_hwnd != NULL);
+ ASSERT_FALSE(IsWindowVisible(plugin_hwnd));
+
+ main_frame->ExecuteScript(WebString::fromUTF8("showPlugin(true)"));
+ ASSERT_TRUE(IsWindowVisible(plugin_hwnd));
+
+ main_frame->ExecuteScript(WebString::fromUTF8("showFrame(false)"));
+ ASSERT_FALSE(IsWindowVisible(plugin_hwnd));
+
+ main_frame->ExecuteScript(WebString::fromUTF8("showFrame(true)"));
+ ASSERT_TRUE(IsWindowVisible(plugin_hwnd));
}
#endif