summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-20 16:04:00 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-20 16:04:00 +0000
commit37b339ffbcad2c8a5561084d669ad57c289e4f79 (patch)
treeb007b4548786c0d5d19c985ee20c4bc3062c0d56
parenta0ebaca028cd268336f1dfcb67f780ccd7cd1794 (diff)
downloadchromium_src-37b339ffbcad2c8a5561084d669ad57c289e4f79.zip
chromium_src-37b339ffbcad2c8a5561084d669ad57c289e4f79.tar.gz
chromium_src-37b339ffbcad2c8a5561084d669ad57c289e4f79.tar.bz2
Convert the npapi interactive_ui_test, layout_plugin ui_test, and npapi ui_test to browser_tests. I renabled the tests, hopefully they're not flaky anymore with the rewrite.
NPObjectReleasedOnDestruction and SelfDeletePluginInvokeAlert weren't testing anything because they broke after the WebKit test plugin changed, so I fixed them. BUG=121574, 30702, 60071, 46257 Review URL: https://chromiumcodereview.appspot.com/10145001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133204 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/npapi_interactive_test.cc76
-rw-r--r--chrome/browser/plugin_test.cc24
-rw-r--r--chrome/chrome_tests.gypi22
-rw-r--r--chrome/test/base/ui_test_utils.cc12
-rw-r--r--chrome/test/base/ui_test_utils.h9
-rw-r--r--chrome/test/base/ui_test_utils_mac.mm11
-rw-r--r--chrome/test/data/npapi/execute_script_delete_in_mouse_up.html (renamed from chrome/test/data/npapi/execute_script_delete_in_mouse_move.html)4
-rw-r--r--chrome/test/data/npapi/get_javascript_url2_frame.html6
-rw-r--r--chrome/test/data/npapi/load_all_blocked_plugins.html14
-rw-r--r--chrome/test/data/npapi/many_plugins.html9
-rw-r--r--chrome/test/data/npapi/npapi.js6
-rw-r--r--chrome/test/data/npapi/npobject_released_on_destruction.html3
-rw-r--r--chrome/test/data/npapi/plugin_ref_target_page.html10
-rw-r--r--chrome/test/data/npapi/popup_window_with_target_plugin.html6
-rw-r--r--chrome/test/data/npapi/self_delete_plugin_invoke_alert.html2
-rw-r--r--chrome/test/ui/layout_plugin_uitest.cc98
-rw-r--r--chrome/test/ui/npapi_test_helper.cc50
-rw-r--r--chrome/test/ui/npapi_test_helper.h39
-rw-r--r--chrome/test/ui/npapi_uitest.cc461
-rw-r--r--content/browser/plugin_browsertest.cc341
-rw-r--r--webkit/plugins/npapi/test/plugin_geturl_test.cc2
-rw-r--r--webkit/plugins/npapi/test/plugin_test_factory.cc2
-rw-r--r--webkit/plugins/npapi/test/plugin_windowless_test.cc4
23 files changed, 444 insertions, 767 deletions
diff --git a/chrome/browser/npapi_interactive_test.cc b/chrome/browser/npapi_interactive_test.cc
deleted file mode 100644
index 7c6af9c..0000000
--- a/chrome/browser/npapi_interactive_test.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// NPAPI interactive UI tests.
-
-#include "base/file_path.h"
-#include "base/test/test_timeouts.h"
-#include "chrome/test/automation/automation_proxy.h"
-#include "chrome/test/automation/window_proxy.h"
-#include "chrome/test/base/ui_test_utils.h"
-#include "chrome/test/ui/npapi_test_helper.h"
-#include "content/test/net/url_request_mock_http_job.h"
-#include "ui/base/keycodes/keyboard_codes.h"
-
-const char kTestCompleteCookie[] = "status";
-const char kTestCompleteSuccess[] = "OK";
-static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi");
-
-// Tests if a plugin executing a self deleting script in the context of
-// a synchronous mousemove works correctly
-TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousMouseMove) {
- show_window_ = true;
- const FilePath kTestDir(FILE_PATH_LITERAL("npapi"));
- const FilePath test_case(
- FILE_PATH_LITERAL("execute_script_delete_in_mouse_move.html"));
- GURL url = ui_test_utils::GetTestUrl(kTestDir, test_case);
- NavigateToURL(url);
-
- scoped_refptr<WindowProxy> window(automation()->GetActiveWindow());
-
- gfx::Point cursor_position(150, 250);
- window->SimulateOSMouseMove(cursor_position);
-
- WaitForFinish("execute_script_delete_in_mouse_move", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
-
-// Flaky, http://crbug.com/60071.
-TEST_F(NPAPIVisiblePluginTester, DISABLED_GetURLRequest404Response) {
- GURL url(URLRequestMockHTTPJob::GetMockUrl(
- FilePath(FILE_PATH_LITERAL(
- "npapi/plugin_url_request_404.html"))));
-
- NavigateToURL(url);
-
- // Wait for the alert dialog and then close it.
- automation()->WaitForAppModalDialog();
- scoped_refptr<WindowProxy> window(automation()->GetActiveWindow());
- ASSERT_TRUE(window.get());
- ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_ESCAPE, 0));
-
- WaitForFinish("geturl_404_response", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-// Tests if a plugin executing a self deleting script using Invoke with
-// a modal dialog showing works without crashing or hanging
-// Disabled, flakily exceeds timeout, http://crbug.com/46257.
-TEST_F(NPAPIVisiblePluginTester, DISABLED_SelfDeletePluginInvokeAlert) {
- const FilePath test_case(
- FILE_PATH_LITERAL("self_delete_plugin_invoke_alert.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
-
- // Wait for the alert dialog and then close it.
- ASSERT_TRUE(automation()->WaitForAppModalDialog());
- scoped_refptr<WindowProxy> window(automation()->GetActiveWindow());
- ASSERT_TRUE(window.get());
- ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_ESCAPE, 0));
-
- WaitForFinish("self_delete_plugin_invoke_alert", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
diff --git a/chrome/browser/plugin_test.cc b/chrome/browser/plugin_test.cc
index 917b7ac..1f342b1 100644
--- a/chrome/browser/plugin_test.cc
+++ b/chrome/browser/plugin_test.cc
@@ -168,6 +168,30 @@ TEST_F(ClickToPlayPluginTest, Flash) {
WaitForFinish(TestTimeouts::action_max_timeout_ms(), true);
}
+TEST_F(ClickToPlayPluginTest, LoadAllBlockedPlugins) {
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser.get());
+ ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
+ CONTENT_SETTING_BLOCK));
+
+ GURL url(URLRequestMockHTTPJob::GetMockUrl(
+ FilePath(FILE_PATH_LITERAL("npapi/load_all_blocked_plugins.html"))));
+ ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
+
+ scoped_refptr<TabProxy> tab(browser->GetTab(0));
+ ASSERT_TRUE(tab.get());
+
+ ASSERT_TRUE(tab->LoadBlockedPlugins());
+
+ UITest::WaitForFinish("setup", "1", url, "status", "OK",
+ TestTimeouts::action_max_timeout_ms());
+
+ ASSERT_TRUE(tab->ExecuteJavaScript("window.inject()"));
+
+ UITest::WaitForFinish("setup", "2", url, "status", "OK",
+ TestTimeouts::action_max_timeout_ms());
+}
+
#if defined(OS_WIN)
// Flaky on Windows, see http://crbug.com/113057
#define MAYBE_FlashDocument DISABLED_FlashDocument
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 6b7d8d1..6bbc5b0 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -331,8 +331,6 @@
'test/reliability/automated_ui_test_base.cc',
'test/reliability/automated_ui_test_base.h',
'test/ui/javascript_test_util.cc',
- 'test/ui/npapi_test_helper.cc',
- 'test/ui/npapi_test_helper.h',
'test/ui/run_all_unittests.cc',
'test/ui/ui_perf_test.cc',
'test/ui/ui_perf_test.h',
@@ -522,7 +520,6 @@
'browser/mouseleave_interactive_uitest.cc',
'browser/printing/print_dialog_cloud_interative_uitest.cc',
'browser/notifications/notifications_interactive_uitest.cc',
- 'browser/npapi_interactive_test.cc',
'browser/task_manager/task_manager_browsertest_util.cc',
'browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc',
'browser/ui/omnibox/omnibox_view_browsertest.cc',
@@ -565,7 +562,6 @@
['toolkit_uses_gtk == 1 and toolkit_views == 0', {
'sources!': [
# TODO(port)
- 'browser/npapi_interactive_test.cc',
'browser/ui/views/crypto_module_password_dialog_view_unittest.cc',
'browser/ui/views/bookmarks/bookmark_bar_view_test.cc',
'browser/ui/views/button_dropdown_test.cc',
@@ -580,21 +576,12 @@
['OS=="linux" and toolkit_views==1', {
'sources!': [
# TODO(port)
- 'browser/npapi_interactive_test.cc',
-
'browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc',
],
}],
- ['target_arch!="arm"', {
- 'dependencies': [
- # run time dependency
- '../webkit/webkit.gyp:npapi_test_plugin',
- ],
- }], # target_arch
['OS=="mac"', {
'sources!': [
# TODO(port)
- 'browser/npapi_interactive_test.cc',
'browser/ui/views/bookmarks/bookmark_bar_view_test.cc',
'browser/ui/views/button_dropdown_test.cc',
'browser/ui/views/find_bar_host_interactive_uitest.cc',
@@ -762,19 +749,12 @@
'test/automation/automation_proxy_uitest.h',
'test/base/chrome_process_util_uitest.cc',
'test/reliability/automated_ui_test_test.cc',
- 'test/ui/layout_plugin_uitest.cc',
'test/ui/named_interface_uitest.cc',
- 'test/ui/npapi_uitest.cc',
'test/ui/sandbox_uitests.cc',
'../content/browser/renderer_host/resource_dispatcher_host_uitest.cc',
# DON'T ADD NEW FILES! SEE NOTE AT TOP OF SECTION.
],
'conditions': [
- ['target_arch!="arm"', {
- 'dependencies': [
- '../webkit/webkit.gyp:copy_npapi_test_plugin',
- ],
- }],
['toolkit_uses_gtk == 1', {
'dependencies': [
'../build/linux/system.gyp:gtk',
@@ -793,7 +773,6 @@
['use_aura==1', {
'sources!': [
'test/automation/automation_proxy_uitest.cc',
- 'test/ui/npapi_uitest.cc',
],
'dependencies': [
'../ui/aura/aura.gyp:aura',
@@ -3089,6 +3068,7 @@
'../content/browser/in_process_webkit/indexed_db_layout_browsertest.cc',
'../content/browser/indexed_db/idbbindingutilities_browsertest.cc',
'../content/browser/media_browsertest.cc',
+ '../content/browser/plugin_browsertest.cc',
'../content/browser/plugin_data_remover_impl_browsertest.cc',
'../content/browser/plugin_service_impl_browsertest.cc',
'../content/browser/renderer_host/render_process_host_browsertest.cc',
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index bf70194..b00e443 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_test_util.h"
#include "chrome/browser/tab_contents/thumbnail_generator.h"
+#include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
@@ -54,6 +55,7 @@
#include "content/public/browser/render_view_host_delegate.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/web_contents_view.h"
#include "content/test/test_navigation_observer.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_util.h"
@@ -589,6 +591,11 @@ AppModalDialog* WaitForAppModalDialog() {
return content::Source<AppModalDialog>(observer.source()).ptr();
}
+void WaitForAppModalDialogAndCloseIt() {
+ AppModalDialog* dialog = WaitForAppModalDialog();
+ dialog->CloseModalDialog();
+}
+
void CrashTab(WebContents* tab) {
content::RenderProcessHost* rph = tab->GetRenderProcessHost();
base::KillProcess(rph->GetHandle(), 0, false);
@@ -613,6 +620,11 @@ void SimulateMouseClick(content::WebContents* tab, int x, int y) {
mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
mouse_event.x = x;
mouse_event.y = y;
+ // Mac needs globalX/globalY for events to plugins.
+ gfx::Rect offset;
+ tab->GetView()->GetContainerBounds(&offset);
+ mouse_event.globalX = x + offset.x();
+ mouse_event.globalY = y + offset.y();
mouse_event.clickCount = 1;
tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
mouse_event.type = WebKit::WebInputEvent::MouseUp;
diff --git a/chrome/test/base/ui_test_utils.h b/chrome/test/base/ui_test_utils.h
index c3bf8d4..5ee24af 100644
--- a/chrome/test/base/ui_test_utils.h
+++ b/chrome/test/base/ui_test_utils.h
@@ -64,6 +64,7 @@ class WebContents;
namespace gfx {
class Point;
+class Rect;
class Size;
}
@@ -203,6 +204,7 @@ GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string);
// Blocks until an application modal dialog is showns and returns it.
AppModalDialog* WaitForAppModalDialog();
+void WaitForAppModalDialogAndCloseIt();
// Causes the specified tab to crash. Blocks until it is crashed.
void CrashTab(content::WebContents* tab);
@@ -220,6 +222,10 @@ int FindInPage(TabContentsWrapper* tab,
// ClickOnView, this works even if the browser isn't in the foreground.
void SimulateMouseClick(content::WebContents* tab, int x, int y);
+#if defined OS_MACOSX
+void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds);
+#endif
+
// Returns true if the View is focused.
bool IsViewFocused(const Browser* browser, ViewID vid);
@@ -243,8 +249,7 @@ void WaitForHistoryToLoad(Browser* browser);
// Puts the native window for |browser| in |native_window|. Returns true on
// success.
-bool GetNativeWindow(const Browser* browser, gfx::NativeWindow* native_window)
- WARN_UNUSED_RESULT;
+bool GetNativeWindow(const Browser* browser, gfx::NativeWindow* native_window);
// Brings the native window for |browser| to the foreground. Returns true on
// success.
diff --git a/chrome/test/base/ui_test_utils_mac.mm b/chrome/test/base/ui_test_utils_mac.mm
index dc6fe23..925f0fb 100644
--- a/chrome/test/base/ui_test_utils_mac.mm
+++ b/chrome/test/base/ui_test_utils_mac.mm
@@ -17,6 +17,17 @@
namespace ui_test_utils {
+void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds) {
+ NSRect new_bounds = NSRectFromCGRect(bounds.ToCGRect());
+ if ([[NSScreen screens] count] > 0) {
+ new_bounds.origin.y =
+ [[[NSScreen screens] objectAtIndex:0] frame].size.height -
+ new_bounds.origin.y - new_bounds.size.height;
+ }
+
+ [window setFrame:new_bounds display:NO];
+}
+
bool IsViewFocused(const Browser* browser, ViewID vid) {
NSWindow* window = browser->window()->GetNativeHandle();
DCHECK(window);
diff --git a/chrome/test/data/npapi/execute_script_delete_in_mouse_move.html b/chrome/test/data/npapi/execute_script_delete_in_mouse_up.html
index a82cde7..c4faa99 100644
--- a/chrome/test/data/npapi/execute_script_delete_in_mouse_move.html
+++ b/chrome/test/data/npapi/execute_script_delete_in_mouse_up.html
@@ -7,7 +7,7 @@
function DeletePluginWithinScript() {
var plugin_div = document.getElementById("PluginDiv");
plugin_div.innerHTML = "Object Deleted";
- onSuccess("execute_script_delete_in_mouse_move", 1);
+ onSuccess("execute_script_delete_in_mouse_up", 1);
}
</script>
</head>
@@ -26,7 +26,7 @@ of a synchronous mouse event.
<DIV ID=PluginDiv>
<embed type="application/vnd.npapi-test"
src="foo"
- name="execute_script_delete_in_mouse_move"
+ name="execute_script_delete_in_mouse_up"
id="1"
mode="np_embed"
>
diff --git a/chrome/test/data/npapi/get_javascript_url2_frame.html b/chrome/test/data/npapi/get_javascript_url2_frame.html
index 48837de..dacf9c3 100644
--- a/chrome/test/data/npapi/get_javascript_url2_frame.html
+++ b/chrome/test/data/npapi/get_javascript_url2_frame.html
@@ -1,6 +1,10 @@
<html>
<head>
-<script src="npapi.js"></script>
+<script>
+function onSuccess(name, id) {
+ parent.document.title = "OK";
+}
+</script>
</head>
<body>
<div id="statusPanel" style="border: 1px solid red; width: 100%">
diff --git a/chrome/test/data/npapi/load_all_blocked_plugins.html b/chrome/test/data/npapi/load_all_blocked_plugins.html
index 2d80be2..e50202d 100644
--- a/chrome/test/data/npapi/load_all_blocked_plugins.html
+++ b/chrome/test/data/npapi/load_all_blocked_plugins.html
@@ -1,7 +1,19 @@
<html>
<head>
-<script src="npapi.js"></script>
<script>
+function onSuccess(name, id) {
+ setTimeout(onFinished, 0, name, id, "OK");
+}
+
+function onFailure(name, id, status) {
+ setTimeout(onFinished, 0, name, id, status);
+}
+
+function onFinished(name, id, result) {
+ var cookie = name + "." + id + ".status=" + result + "; path=/";
+ document.cookie = cookie;
+}
+
var id = 1;
function inject() {
var child = document.createElement("div");
diff --git a/chrome/test/data/npapi/many_plugins.html b/chrome/test/data/npapi/many_plugins.html
index 5edcc55..4a3b74a 100644
--- a/chrome/test/data/npapi/many_plugins.html
+++ b/chrome/test/data/npapi/many_plugins.html
@@ -1,7 +1,14 @@
<html>
<head>
-<script src="npapi.js"></script>
+<script>
+count = 0;
+function onSuccess(name, id) {
+ count++;
+ if (count == 15)
+ document.title = "OK";
+}
+</script>
</head>
diff --git a/chrome/test/data/npapi/npapi.js b/chrome/test/data/npapi/npapi.js
index 207d188..6c3ef8d 100644
--- a/chrome/test/data/npapi/npapi.js
+++ b/chrome/test/data/npapi/npapi.js
@@ -23,6 +23,8 @@
statusPanel.innerHTML = result;
}
- var cookie = name + "." + id + ".status=" + result + "; path=/";
- document.cookie = cookie;
+ if (result == "OK")
+ document.title = "OK";
+ else
+ document.title = "FAIL";
}
diff --git a/chrome/test/data/npapi/npobject_released_on_destruction.html b/chrome/test/data/npapi/npobject_released_on_destruction.html
index f4da25d..b98779f 100644
--- a/chrome/test/data/npapi/npobject_released_on_destruction.html
+++ b/chrome/test/data/npapi/npobject_released_on_destruction.html
@@ -16,11 +16,10 @@ function Init() {
var plg = window.document["plg"];
// Create the NPObjectStub in the plugin process first. This object's
// deallocate function will release the NPObject below.
- test_object = plg.testCreateTestObject();
// Then create an NPObjectProxy in the plugin process that holds on to the
// dummyMethod function above.
- test_object.pageTestObject();
+ plg.remember(dummyMethod);
}
</script>
</head>
diff --git a/chrome/test/data/npapi/plugin_ref_target_page.html b/chrome/test/data/npapi/plugin_ref_target_page.html
index 89ee354..b4a6e9f 100644
--- a/chrome/test/data/npapi/plugin_ref_target_page.html
+++ b/chrome/test/data/npapi/plugin_ref_target_page.html
@@ -3,14 +3,14 @@
plugins
</title>
-<script src="npapi.js"></script>
-
<script>
function onLoad() {
- if (document.referrer == "http://mock.http/dummy_plugin_referrer")
- onSuccess("plugin_referrer_test", 1);
- else
+ if (document.referrer == "http://mock.http/dummy_plugin_referrer") {
+ window.opener.document.title = "OK";
+ } else {
onFailure("plugin_referrer_test", 1, "Unexpected referrer value");
+ window.opener.document.title = "FAIL";
+ }
}
</script>
</head>
diff --git a/chrome/test/data/npapi/popup_window_with_target_plugin.html b/chrome/test/data/npapi/popup_window_with_target_plugin.html
index 5f203bd..a7942a8 100644
--- a/chrome/test/data/npapi/popup_window_with_target_plugin.html
+++ b/chrome/test/data/npapi/popup_window_with_target_plugin.html
@@ -1,7 +1,11 @@
<html>
<head>
-<script src="npapi.js"></script>
+<script>
+function onSuccess(name, id) {
+ window.opener.document.title = "OK";
+}
+</script>
</head>
diff --git a/chrome/test/data/npapi/self_delete_plugin_invoke_alert.html b/chrome/test/data/npapi/self_delete_plugin_invoke_alert.html
index e056cf5..4176d2c 100644
--- a/chrome/test/data/npapi/self_delete_plugin_invoke_alert.html
+++ b/chrome/test/data/npapi/self_delete_plugin_invoke_alert.html
@@ -14,7 +14,7 @@ function SuccessCallback() {
function TimeoutCallback() {
var plg = window.document["plg"];
var plg2 = window.document["plg2"];
- plg.testCallbackAndGetValue("DeletePluginWithinScript");
+ plg.testCallback("DeletePluginWithinScript");
plg2.testCallback("SuccessCallback"); // will fail if the plugin crashed
}
</script>
diff --git a/chrome/test/ui/layout_plugin_uitest.cc b/chrome/test/ui/layout_plugin_uitest.cc
deleted file mode 100644
index d54ac24..0000000
--- a/chrome/test/ui/layout_plugin_uitest.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/test/ui/ui_test.h"
-
-#include "base/file_path.h"
-#include "base/path_service.h"
-#include "base/test/test_timeouts.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/url_constants.h"
-#include "chrome/test/automation/automation_proxy.h"
-#include "chrome/test/automation/tab_proxy.h"
-#include "chrome/test/base/ui_test_utils.h"
-#include "chrome/test/ui/npapi_test_helper.h"
-#include "googleurl/src/gurl.h"
-#include "net/base/net_util.h"
-
-using npapi_test::kTestCompleteCookie;
-using npapi_test::kTestCompleteSuccess;
-
-static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi");
-
-class LayoutPluginTester : public NPAPITesterBase {
- protected:
- LayoutPluginTester() : NPAPITesterBase() {}
-};
-
-// Make sure that navigating away from a plugin referenced by JS doesn't
-// crash.
-TEST_F(LayoutPluginTester, UnloadNoCrash) {
- FilePath path;
- PathService::Get(chrome::DIR_TEST_DATA, &path);
- path = path.AppendASCII("npapi").AppendASCII("layout_test_plugin.html");
- NavigateToURL(net::FilePathToFileURL(path));
-
- std::wstring title;
- scoped_refptr<TabProxy> tab = GetActiveTab();
- ASSERT_TRUE(tab);
- EXPECT_TRUE(tab->GetTabTitle(&title));
- EXPECT_EQ(L"Layout Test Plugin Test", title);
-
- ASSERT_TRUE(tab->GoBack());
- EXPECT_TRUE(tab->GetTabTitle(&title));
- EXPECT_NE(L"Layout Test Plugin Test", title);
-}
-
-// Tests if a plugin executing a self deleting script using NPN_GetURL
-// works without crashing or hanging
-// Flaky: http://crbug.com/59327
-TEST_F(LayoutPluginTester, DISABLED_SelfDeletePluginGetUrl) {
- const FilePath test_case(FILE_PATH_LITERAL("self_delete_plugin_geturl.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("self_delete_plugin_geturl", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
-
-// Tests if a plugin executing a self deleting script using Invoke
-// works without crashing or hanging
-// Flaky. See http://crbug.com/30702
-TEST_F(LayoutPluginTester, DISABLED_SelfDeletePluginInvoke) {
- const FilePath test_case(FILE_PATH_LITERAL("self_delete_plugin_invoke.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("self_delete_plugin_invoke", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
-
-TEST_F(LayoutPluginTester, NPObjectReleasedOnDestruction) {
- const FilePath test_case(
- FILE_PATH_LITERAL("npobject_released_on_destruction.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
-
- scoped_refptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0));
- ASSERT_TRUE(window_proxy);
- ASSERT_TRUE(window_proxy->AppendTab(GURL(chrome::kAboutBlankURL)));
-
- scoped_refptr<TabProxy> tab_proxy(window_proxy->GetTab(0));
- ASSERT_TRUE(tab_proxy.get());
- ASSERT_TRUE(tab_proxy->Close(true));
-}
-
-// Test that a dialog is properly created when a plugin throws an
-// exception. Should be run for in and out of process plugins, but
-// the more interesting case is out of process, where we must route
-// the exception to the correct renderer.
-TEST_F(LayoutPluginTester, NPObjectSetException) {
- const FilePath test_case(FILE_PATH_LITERAL("npobject_set_exception.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("npobject_set_exception", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
diff --git a/chrome/test/ui/npapi_test_helper.cc b/chrome/test/ui/npapi_test_helper.cc
deleted file mode 100644
index a376656..0000000
--- a/chrome/test/ui/npapi_test_helper.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/test/ui/npapi_test_helper.h"
-
-#include "base/file_util.h"
-#include "base/test/test_file_util.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_switches.h"
-#include "webkit/plugins/npapi/plugin_list.h"
-
-namespace npapi_test {
-const char kTestCompleteCookie[] = "status";
-const char kTestCompleteSuccess[] = "OK";
-} // namespace npapi_test.
-
-NPAPITesterBase::NPAPITesterBase() {
- // Some NPAPI tests schedule garbage collection to force object tear-down.
- launch_arguments_.AppendSwitchASCII(switches::kJavaScriptFlags,
- "--expose_gc");
-}
-
-void NPAPITesterBase::SetUp() {
-#if defined(OS_MACOSX)
- // The plugins directory isn't read by default on the Mac, so it needs to be
- // explicitly registered.
- launch_arguments_.AppendSwitchPath(switches::kExtraPluginDir,
- GetPluginsDirectory());
-#endif
-
- UITest::SetUp();
-}
-
-FilePath NPAPITesterBase::GetPluginsDirectory() {
- FilePath plugins_directory = browser_directory_.AppendASCII("plugins");
- return plugins_directory;
-}
-
-// NPAPIVisiblePluginTester members.
-void NPAPIVisiblePluginTester::SetUp() {
- show_window_ = true;
- NPAPITesterBase::SetUp();
-}
-
-// NPAPIIncognitoTester members.
-void NPAPIIncognitoTester::SetUp() {
- launch_arguments_.AppendSwitch(switches::kIncognito);
- NPAPITesterBase::SetUp();
-}
diff --git a/chrome/test/ui/npapi_test_helper.h b/chrome/test/ui/npapi_test_helper.h
deleted file mode 100644
index 22b717a..0000000
--- a/chrome/test/ui/npapi_test_helper.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_TEST_UI_NPAPI_TEST_HELPER_H_
-#define CHROME_TEST_UI_NPAPI_TEST_HELPER_H_
-#pragma once
-
-#include "chrome/test/ui/ui_test.h"
-
-namespace npapi_test {
-extern const char kTestCompleteCookie[];
-extern const char kTestCompleteSuccess[];
-} // namespace npapi_test.
-
-// Base class for NPAPI tests. It provides common functionality between
-// regular NPAPI plugins and pepper NPAPI plugins.
-class NPAPITesterBase : public UITest {
- protected:
- explicit NPAPITesterBase();
- virtual void SetUp() OVERRIDE;
-
- FilePath GetPluginsDirectory();
-};
-
-// Helper class for NPAPI plugin UI tests, which need the browser window
-// to be visible.
-class NPAPIVisiblePluginTester : public NPAPITesterBase {
- protected:
- virtual void SetUp() OVERRIDE;
-};
-
-// Helper class for NPAPI plugin UI tests which use incognito mode.
-class NPAPIIncognitoTester : public NPAPITesterBase {
- protected:
- virtual void SetUp() OVERRIDE;
-};
-
-#endif // CHROME_TEST_UI_NPAPI_TEST_HELPER_H_
diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc
deleted file mode 100644
index 8076cd6..0000000
--- a/chrome/test/ui/npapi_uitest.cc
+++ /dev/null
@@ -1,461 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "build/build_config.h"
-
-#if defined(OS_WIN)
-#include <comutil.h>
-#include <shellapi.h>
-#include <shlobj.h>
-#include <windows.h>
-#endif
-
-#include <memory.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <ostream>
-
-#include "base/file_path.h"
-#include "base/string_number_conversions.h"
-#include "base/test/test_timeouts.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/url_constants.h"
-#include "chrome/test/automation/automation_proxy.h"
-#include "chrome/test/automation/browser_proxy.h"
-#include "chrome/test/automation/tab_proxy.h"
-#include "chrome/test/automation/window_proxy.h"
-#include "chrome/test/base/ui_test_utils.h"
-#include "chrome/test/ui/npapi_test_helper.h"
-#include "content/public/common/content_switches.h"
-#include "content/test/net/url_request_mock_http_job.h"
-
-using npapi_test::kTestCompleteCookie;
-using npapi_test::kTestCompleteSuccess;
-
-namespace {
-
-const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi");
-
-class NPAPIAutomationEnabledTest : public NPAPIVisiblePluginTester {
- public:
- NPAPIAutomationEnabledTest() {
- dom_automation_enabled_ = true;
- }
-};
-
-}
-
-// Test passing arguments to a plugin.
-TEST_F(NPAPITesterBase, Arguments) {
- const FilePath test_case(FILE_PATH_LITERAL("arguments.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("arguments", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-// Test invoking many plugins within a single page.
-TEST_F(NPAPITesterBase, ManyPlugins) {
- const FilePath test_case(FILE_PATH_LITERAL("many_plugins.html"));
- GURL url(ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case));
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
-
- for (int i = 1; i <= 15; i++) {
- SCOPED_TRACE(StringPrintf("Waiting for plugin #%d", i));
- ASSERT_NO_FATAL_FAILURE(WaitForFinish(
- "arguments",
- base::IntToString(i),
- url,
- kTestCompleteCookie,
- kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms()));
- }
-}
-
-// Test various calls to GetURL from a plugin.
-TEST_F(NPAPITesterBase, GetURL) {
- const FilePath test_case(FILE_PATH_LITERAL("geturl.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("geturl", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-// Test various calls to GetURL for javascript URLs with
-// non NULL targets from a plugin.
-TEST_F(NPAPITesterBase, GetJavaScriptURL) {
- const FilePath test_case(FILE_PATH_LITERAL("get_javascript_url.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("getjavascripturl", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-// Test that calling GetURL with a javascript URL and target=_self
-// works properly when the plugin is embedded in a subframe.
-TEST_F(NPAPITesterBase, GetJavaScriptURL2) {
- const FilePath test_case(FILE_PATH_LITERAL("get_javascript_url2.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("getjavascripturl2", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-// Test is flaky on linux/cros/win builders. http://crbug.com/71904
-TEST_F(NPAPITesterBase, DISABLED_GetURLRedirectNotification) {
- const FilePath test_case(FILE_PATH_LITERAL("geturl_redirect_notify.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("geturlredirectnotify", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-// Tests that identity is preserved for NPObjects passed from a plugin
-// into JavaScript.
-TEST_F(NPAPITesterBase, NPObjectIdentity) {
- const FilePath test_case(FILE_PATH_LITERAL("npobject_identity.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("npobject_identity", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-// Tests that if an NPObject is proxies back to its original process, the
-// original pointer is returned and not a proxy. If this fails the plugin
-// will crash.
-TEST_F(NPAPITesterBase, NPObjectProxy) {
- const FilePath test_case(FILE_PATH_LITERAL("npobject_proxy.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("npobject_proxy", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-#if defined(OS_WIN) || defined(OS_MACOSX)
-// Tests if a plugin executing a self deleting script in the context of
-// a synchronous paint event works correctly
-// http://crbug.com/44960
-TEST_F(NPAPIVisiblePluginTester,
- DISABLED_SelfDeletePluginInvokeInSynchronousPaint) {
- show_window_ = true;
- const FilePath test_case(
- FILE_PATH_LITERAL("execute_script_delete_in_paint.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("execute_script_delete_in_paint", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
-#endif
-
-TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNewStream) {
- show_window_ = true;
- const FilePath test_case(FILE_PATH_LITERAL("self_delete_plugin_stream.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("self_delete_plugin_stream", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
-
-// http://crbug.com/95558
-// This test fails frequently on Mac and windows, so it is disabled for now.
-#if defined(OS_MACOSX)
-#define MAYBE_DeletePluginInDeallocate DISABLED_DeletePluginInDeallocate
-#elif defined(OS_WIN)
-#define MAYBE_DeletePluginInDeallocate DISABLED_DeletePluginInDeallocate
-#else
-#define MAYBE_DeletePluginInDeallocate DeletePluginInDeallocate
-#endif
-TEST_F(NPAPIVisiblePluginTester, MAYBE_DeletePluginInDeallocate) {
- show_window_ = true;
- const FilePath test_case(
- FILE_PATH_LITERAL("plugin_delete_in_deallocate.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("delete_plugin_in_deallocate_test", "signaller", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
-
-#if defined(OS_WIN)
-// Tests if a plugin has a non zero window rect.
-TEST_F(NPAPIVisiblePluginTester, VerifyPluginWindowRect) {
- show_window_ = true;
- const FilePath test_case(FILE_PATH_LITERAL("verify_plugin_window_rect.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("checkwindowrect", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-// Tests that creating a new instance of a plugin while another one is handling
-// a paint message doesn't cause deadlock.
-TEST_F(NPAPIVisiblePluginTester, CreateInstanceInPaint) {
- show_window_ = true;
- const FilePath test_case(FILE_PATH_LITERAL("create_instance_in_paint.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("create_instance_in_paint", "2", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-// Tests that putting up an alert in response to a paint doesn't deadlock.
-TEST_F(NPAPIVisiblePluginTester, AlertInWindowMessage) {
- show_window_ = true;
- const FilePath test_case(FILE_PATH_LITERAL("alert_in_window_message.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
-
- bool modal_dialog_showing = false;
- ui::DialogButton available_buttons;
- ASSERT_TRUE(automation()->WaitForAppModalDialog());
- ASSERT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing,
- &available_buttons));
- ASSERT_TRUE(modal_dialog_showing);
- ASSERT_NE((ui::DIALOG_BUTTON_OK & available_buttons), 0);
- ASSERT_TRUE(automation()->ClickAppModalDialogButton(ui::DIALOG_BUTTON_OK));
-
- modal_dialog_showing = false;
- ASSERT_TRUE(automation()->WaitForAppModalDialog());
- ASSERT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing,
- &available_buttons));
- ASSERT_TRUE(modal_dialog_showing);
- ASSERT_NE((ui::DIALOG_BUTTON_OK & available_buttons), 0);
- ASSERT_TRUE(automation()->ClickAppModalDialogButton(ui::DIALOG_BUTTON_OK));
-}
-
-TEST_F(NPAPIVisiblePluginTester, VerifyNPObjectLifetimeTest) {
- show_window_ = true;
- const FilePath test_case(FILE_PATH_LITERAL("npobject_lifetime_test.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("npobject_lifetime_test", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
-
-// Tests that we don't crash or assert if NPP_New fails
-TEST_F(NPAPIVisiblePluginTester, NewFails) {
- const FilePath test_case(FILE_PATH_LITERAL("new_fails.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("new_fails", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNPNEvaluate) {
- const FilePath test_case(
- FILE_PATH_LITERAL("execute_script_delete_in_npn_evaluate.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("npobject_delete_plugin_in_evaluate", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
-
-TEST_F(NPAPIVisiblePluginTester, SelfDeleteCreatePluginInNPNEvaluate) {
- const FilePath test_case(
- FILE_PATH_LITERAL("npn_plugin_delete_create_in_evaluate.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("npobject_delete_create_plugin_in_evaluate", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
-
-#endif
-
-// http://crbug.com/17645
-// As of 6 July 2011, this test always fails on OS X and is flaky on
-// Windows (perhaps due to timing out).
-#if defined(OS_MACOSX)
-#define MAYBE_OpenPopupWindowWithPlugin DISABLED_OpenPopupWindowWithPlugin
-#else
-#define MAYBE_OpenPopupWindowWithPlugin DISABLED_OpenPopupWindowWithPlugin
-#endif
-
-TEST_F(NPAPIVisiblePluginTester, MAYBE_OpenPopupWindowWithPlugin) {
- const FilePath test_case(
- FILE_PATH_LITERAL("get_javascript_open_popup_with_plugin.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("plugin_popup_with_plugin_target", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_timeout_ms());
-}
-
-// Test checking the privacy mode is off.
-TEST_F(NPAPITesterBase, PrivateDisabled) {
- const FilePath test_case(FILE_PATH_LITERAL("private.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("private", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-TEST_F(NPAPITesterBase, ScheduleTimer) {
- const FilePath test_case(FILE_PATH_LITERAL("schedule_timer.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("schedule_timer", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-TEST_F(NPAPITesterBase, PluginThreadAsyncCall) {
- const FilePath test_case(FILE_PATH_LITERAL("plugin_thread_async_call.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("plugin_thread_async_call", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-// Test checking the privacy mode is on.
-#if defined(OS_LINUX)
-// http://crbug.com/104380
-#define PrivateEnabled DISABLED_PrivateEnabled
-#endif
-TEST_F(NPAPIIncognitoTester, PrivateEnabled) {
- const FilePath test_case(FILE_PATH_LITERAL("private.html"));
- GURL url = ui_test_utils::GetFileUrlWithQuery(
- ui_test_utils::GetTestFilePath(FilePath(kTestDir), test_case), "private");
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("private", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-#if defined(OS_WIN) || defined(OS_MACOSX)
-// Test a browser hang due to special case of multiple
-// plugin instances indulged in sync calls across renderer.
-TEST_F(NPAPIVisiblePluginTester, MultipleInstancesSyncCalls) {
- const FilePath test_case(
- FILE_PATH_LITERAL("multiple_instances_sync_calls.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("multiple_instances_sync_calls", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-#endif
-
-TEST_F(NPAPIVisiblePluginTester, GetURLRequestFailWrite) {
- GURL url(URLRequestMockHTTPJob::GetMockUrl(
- FilePath(FILE_PATH_LITERAL(
- "npapi/plugin_url_request_fail_write.html"))));
-
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
-
- WaitForFinish("geturl_fail_write", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-#if defined(OS_WIN)
-TEST_F(NPAPITesterBase, EnsureScriptingWorksInDestroy) {
- const FilePath test_case(
- FILE_PATH_LITERAL("ensure_scripting_works_in_destroy.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
- WaitForFinish("ensure_scripting_works_in_destroy", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
-}
-
-// This test uses a Windows Event to signal to the plugin that it should crash
-// on NP_Initialize.
-TEST_F(NPAPITesterBase, NoHangIfInitCrashes) {
- // Only Windows implements the crash service for now.
-#if defined(OS_WIN)
- expected_crashes_ = 1;
-#endif
-
- HANDLE crash_event = CreateEvent(NULL, TRUE, FALSE, L"TestPluginCrashOnInit");
- SetEvent(crash_event);
- const FilePath test_case(FILE_PATH_LITERAL("no_hang_if_init_crashes.html"));
- GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
- NavigateToURL(url);
- WaitForFinish("no_hang_if_init_crashes", "1", url,
- kTestCompleteCookie, kTestCompleteSuccess,
- TestTimeouts::action_max_timeout_ms());
- CloseHandle(crash_event);
-}
-
-#endif
-
-#if defined(OS_MACOSX)
-// http://crbug.com/111508
-#define PluginReferrerTest DISABLED_PluginReferrerTest
-#endif
-TEST_F(NPAPIVisiblePluginTester, PluginReferrerTest) {
- GURL url(URLRequestMockHTTPJob::GetMockUrl(
- FilePath(FILE_PATH_LITERAL(
- "npapi/plugin_url_request_referrer_test.html"))));
-
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
-
- WaitForFinish("plugin_referrer_test", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-#if defined(OS_MACOSX)
-TEST_F(NPAPIVisiblePluginTester, PluginConvertPointTest) {
- scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
- ASSERT_TRUE(browser.get());
- scoped_refptr<WindowProxy> window(browser->GetWindow());
- ASSERT_TRUE(window.get());
- window->SetBounds(gfx::Rect(50, 50, 400, 400));
-
- GURL url(URLRequestMockHTTPJob::GetMockUrl(
- FilePath(FILE_PATH_LITERAL("npapi/convert_point.html"))));
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
-
- // TODO(stuartmorgan): When the automation system supports sending clicks,
- // change the test to trigger on mouse-down rather than window focus.
- ASSERT_TRUE(browser->BringToFront());
- WaitForFinish("convert_point", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-#endif
-
-TEST_F(NPAPIVisiblePluginTester, ClickToPlay) {
- scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
- ASSERT_TRUE(browser.get());
- ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
- CONTENT_SETTING_BLOCK));
-
- GURL url(URLRequestMockHTTPJob::GetMockUrl(
- FilePath(FILE_PATH_LITERAL("npapi/click_to_play.html"))));
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
-
- scoped_refptr<TabProxy> tab(browser->GetTab(0));
- ASSERT_TRUE(tab.get());
-
- ASSERT_TRUE(tab->LoadBlockedPlugins());
-
- WaitForFinish("setup", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
-
-TEST_F(NPAPIAutomationEnabledTest, LoadAllBlockedPlugins) {
- scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
- ASSERT_TRUE(browser.get());
- ASSERT_TRUE(browser->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
- CONTENT_SETTING_BLOCK));
-
- GURL url(URLRequestMockHTTPJob::GetMockUrl(
- FilePath(FILE_PATH_LITERAL("npapi/load_all_blocked_plugins.html"))));
- ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
-
- scoped_refptr<TabProxy> tab(browser->GetTab(0));
- ASSERT_TRUE(tab.get());
-
- ASSERT_TRUE(tab->LoadBlockedPlugins());
-
- WaitForFinish("setup", "1", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-
- ASSERT_TRUE(tab->ExecuteJavaScript("window.inject()"));
-
- WaitForFinish("setup", "2", url, kTestCompleteCookie,
- kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms());
-}
diff --git a/content/browser/plugin_browsertest.cc b/content/browser/plugin_browsertest.cc
new file mode 100644
index 0000000..b3c0663
--- /dev/null
+++ b/content/browser/plugin_browsertest.cc
@@ -0,0 +1,341 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/command_line.h"
+#include "base/path_service.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/common/content_switches.h"
+#include "content/test/net/url_request_mock_http_job.h"
+
+using content::BrowserThread;
+
+namespace {
+
+void SetUrlRequestMock(const FilePath& path) {
+ URLRequestMockHTTPJob::AddUrlHandler(path);
+}
+
+}
+
+class PluginTest : public InProcessBrowserTest {
+ protected:
+ PluginTest() {}
+
+ virtual void SetUpCommandLine(CommandLine* command_line) {
+ // Some NPAPI tests schedule garbage collection to force object tear-down.
+ command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc");
+ // For OpenPopupWindowWithPlugin.
+ command_line->AppendSwitch(switches::kDisablePopupBlocking);
+#if defined(OS_MACOSX)
+ FilePath plugin_dir;
+ PathService::Get(base::DIR_MODULE, &plugin_dir);
+ plugin_dir = plugin_dir.AppendASCII("plugins");
+ // The plugins directory isn't read by default on the Mac, so it needs to be
+ // explicitly registered.
+ command_line->AppendSwitchPath(switches::kExtraPluginDir, plugin_dir);
+#endif
+ }
+
+ virtual void SetUpOnMainThread() OVERRIDE {
+ FilePath path = ui_test_utils::GetTestFilePath(FilePath(), FilePath());
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path));
+ }
+
+ void LoadAndWait(const GURL& url, const char* title) {
+ string16 expected_title(ASCIIToUTF16(title));
+ ui_test_utils::TitleWatcher title_watcher(
+ browser()->GetSelectedWebContents(), expected_title);
+ title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
+ ui_test_utils::NavigateToURL(browser(), url);
+ EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
+ }
+
+ GURL GetURL(const char* filename) {
+ return ui_test_utils::GetTestUrl(
+ FilePath().AppendASCII("npapi"), FilePath().AppendASCII(filename));
+ }
+
+ void NavigateAway() {
+ GURL url = ui_test_utils::GetTestUrl(
+ FilePath(), FilePath().AppendASCII("simple.html"));
+ LoadAndWait(url, "simple.html");
+ }
+};
+
+// Make sure that navigating away from a plugin referenced by JS doesn't
+// crash.
+IN_PROC_BROWSER_TEST_F(PluginTest, UnloadNoCrash) {
+ LoadAndWait(GetURL("layout_test_plugin.html"), "Layout Test Plugin Test");
+ NavigateAway();
+}
+
+// Tests if a plugin executing a self deleting script using NPN_GetURL
+// works without crashing or hanging
+// Flaky: http://crbug.com/59327
+IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginGetUrl) {
+ LoadAndWait(GetURL("self_delete_plugin_geturl.html"), "OK");
+}
+
+// Tests if a plugin executing a self deleting script using Invoke
+// works without crashing or hanging
+// Flaky. See http://crbug.com/30702
+IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvoke) {
+ LoadAndWait(GetURL("self_delete_plugin_invoke.html"), "OK");
+}
+
+IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectReleasedOnDestruction) {
+ ui_test_utils::NavigateToURL(
+ browser(), GetURL("npobject_released_on_destruction.html"));
+ NavigateAway();
+}
+
+// Test that a dialog is properly created when a plugin throws an
+// exception. Should be run for in and out of process plugins, but
+// the more interesting case is out of process, where we must route
+// the exception to the correct renderer.
+IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectSetException) {
+ LoadAndWait(GetURL("npobject_set_exception.html"), "OK");
+}
+
+#if defined(OS_WIN)
+// Tests if a plugin executing a self deleting script in the context of
+// a synchronous mouseup works correctly.
+// This was never ported to Mac. The only thing remaining is to make
+// ui_test_utils::SimulateMouseClick get to Mac plugins, currently it doesn't
+// work.
+IN_PROC_BROWSER_TEST_F(PluginTest,
+ SelfDeletePluginInvokeInSynchronousMouseUp) {
+ ui_test_utils::NavigateToURL(
+ browser(), GetURL("execute_script_delete_in_mouse_up.html"));
+
+ string16 expected_title(ASCIIToUTF16("OK"));
+ ui_test_utils::TitleWatcher title_watcher(
+ browser()->GetSelectedWebContents(), expected_title);
+ title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
+ ui_test_utils::SimulateMouseClick(
+ browser()->GetSelectedWebContents(), 150, 250);
+ EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
+}
+#endif
+
+// Flaky, http://crbug.com/60071.
+IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequest404Response) {
+ GURL url(URLRequestMockHTTPJob::GetMockUrl(
+ FilePath().AppendASCII("npapi").
+ AppendASCII("plugin_url_request_404.html")));
+ LoadAndWait(url, "OK");
+}
+
+// Tests if a plugin executing a self deleting script using Invoke with
+// a modal dialog showing works without crashing or hanging
+// Disabled, flakily exceeds timeout, http://crbug.com/46257.
+IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeAlert) {
+ ui_test_utils::NavigateToURL(
+ browser(), GetURL("self_delete_plugin_invoke_alert.html"));
+
+ string16 expected_title(ASCIIToUTF16("OK"));
+ ui_test_utils::TitleWatcher title_watcher(
+ browser()->GetSelectedWebContents(), expected_title);
+ title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
+
+ ui_test_utils::WaitForAppModalDialogAndCloseIt();
+
+ EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
+}
+
+// Test passing arguments to a plugin.
+IN_PROC_BROWSER_TEST_F(PluginTest, Arguments) {
+ LoadAndWait(GetURL("arguments.html"), "OK");
+}
+
+// Test invoking many plugins within a single page.
+IN_PROC_BROWSER_TEST_F(PluginTest, ManyPlugins) {
+ LoadAndWait(GetURL("many_plugins.html"), "OK");
+}
+
+// Test various calls to GetURL from a plugin.
+IN_PROC_BROWSER_TEST_F(PluginTest, GetURL) {
+ LoadAndWait(GetURL("geturl.html"), "OK");
+}
+
+// Test various calls to GetURL for javascript URLs with
+// non NULL targets from a plugin.
+IN_PROC_BROWSER_TEST_F(PluginTest, GetJavaScriptURL) {
+ LoadAndWait(GetURL("get_javascript_url.html"), "OK");
+}
+
+// Test that calling GetURL with a javascript URL and target=_self
+// works properly when the plugin is embedded in a subframe.
+IN_PROC_BROWSER_TEST_F(PluginTest, GetJavaScriptURL2) {
+ LoadAndWait(GetURL("get_javascript_url2.html"), "OK");
+}
+
+// Test is flaky on linux/cros/win builders. http://crbug.com/71904
+IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRedirectNotification) {
+ LoadAndWait(GetURL("geturl_redirect_notify.html"), "OK");
+}
+
+// Tests that identity is preserved for NPObjects passed from a plugin
+// into JavaScript.
+IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectIdentity) {
+ LoadAndWait(GetURL("npobject_identity.html"), "OK");
+}
+
+// Tests that if an NPObject is proxies back to its original process, the
+// original pointer is returned and not a proxy. If this fails the plugin
+// will crash.
+IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectProxy) {
+ LoadAndWait(GetURL("npobject_proxy.html"), "OK");
+}
+
+#if defined(OS_WIN) || defined(OS_MACOSX)
+// Tests if a plugin executing a self deleting script in the context of
+// a synchronous paint event works correctly
+// http://crbug.com/44960
+IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeInSynchronousPaint) {
+ LoadAndWait(GetURL("execute_script_delete_in_paint.html"), "OK");
+}
+#endif
+
+IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInNewStream) {
+ LoadAndWait(GetURL("self_delete_plugin_stream.html"), "OK");
+}
+
+// If this test flakes use http://crbug.com/95558.
+IN_PROC_BROWSER_TEST_F(PluginTest, DeletePluginInDeallocate) {
+ LoadAndWait(GetURL("plugin_delete_in_deallocate.html"), "OK");
+}
+
+#if defined(OS_WIN)
+
+IN_PROC_BROWSER_TEST_F(PluginTest, VerifyPluginWindowRect) {
+ LoadAndWait(GetURL("verify_plugin_window_rect.html"), "OK");
+}
+
+// Tests that creating a new instance of a plugin while another one is handling
+// a paint message doesn't cause deadlock.
+IN_PROC_BROWSER_TEST_F(PluginTest, CreateInstanceInPaint) {
+ LoadAndWait(GetURL("create_instance_in_paint.html"), "OK");
+}
+
+// Tests that putting up an alert in response to a paint doesn't deadlock.
+IN_PROC_BROWSER_TEST_F(PluginTest, AlertInWindowMessage) {
+ ui_test_utils::NavigateToURL(
+ browser(), GetURL("alert_in_window_message.html"));
+
+ ui_test_utils::WaitForAppModalDialogAndCloseIt();
+ ui_test_utils::WaitForAppModalDialogAndCloseIt();
+}
+
+IN_PROC_BROWSER_TEST_F(PluginTest, VerifyNPObjectLifetimeTest) {
+ LoadAndWait(GetURL("npobject_lifetime_test.html"), "OK");
+}
+
+// Tests that we don't crash or assert if NPP_New fails
+IN_PROC_BROWSER_TEST_F(PluginTest, NewFails) {
+ LoadAndWait(GetURL("new_fails.html"), "OK");
+}
+
+IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInNPNEvaluate) {
+ LoadAndWait(GetURL("execute_script_delete_in_npn_evaluate.html"), "OK");
+}
+
+IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeleteCreatePluginInNPNEvaluate) {
+ LoadAndWait(GetURL("npn_plugin_delete_create_in_evaluate.html"), "OK");
+}
+
+#endif // OS_WIN
+
+// If this flakes, reopen http://crbug.com/17645
+// As of 6 July 2011, this test is flaky on Windows (perhaps due to timing out).
+#if !defined(OS_MACOSX)
+// Disabled on Mac because the plugin side isn't implemented yet, see
+// "TODO(port)" in plugin_javascript_open_popup.cc.
+IN_PROC_BROWSER_TEST_F(PluginTest, OpenPopupWindowWithPlugin) {
+ LoadAndWait(GetURL("get_javascript_open_popup_with_plugin.html"), "OK");
+}
+#endif
+
+// Test checking the privacy mode is off.
+IN_PROC_BROWSER_TEST_F(PluginTest, PrivateDisabled) {
+ LoadAndWait(GetURL("private.html"), "OK");
+}
+
+IN_PROC_BROWSER_TEST_F(PluginTest, ScheduleTimer) {
+ LoadAndWait(GetURL("schedule_timer.html"), "OK");
+}
+
+IN_PROC_BROWSER_TEST_F(PluginTest, PluginThreadAsyncCall) {
+ LoadAndWait(GetURL("plugin_thread_async_call.html"), "OK");
+}
+
+// Test checking the privacy mode is on.
+// If this flakes on Linux, use http://crbug.com/104380
+IN_PROC_BROWSER_TEST_F(PluginTest, PrivateEnabled) {
+ LoadAndWait(GetURL("private.html"), "OK");
+}
+
+#if defined(OS_WIN) || defined(OS_MACOSX)
+// Test a browser hang due to special case of multiple
+// plugin instances indulged in sync calls across renderer.
+IN_PROC_BROWSER_TEST_F(PluginTest, MultipleInstancesSyncCalls) {
+ LoadAndWait(GetURL("multiple_instances_sync_calls.html"), "OK");
+}
+#endif
+
+IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequestFailWrite) {
+ GURL url(URLRequestMockHTTPJob::GetMockUrl(
+ FilePath().AppendASCII("npapi").
+ AppendASCII("plugin_url_request_fail_write.html")));
+ LoadAndWait(url, "OK");
+}
+
+#if defined(OS_WIN)
+IN_PROC_BROWSER_TEST_F(PluginTest, EnsureScriptingWorksInDestroy) {
+ LoadAndWait(GetURL("ensure_scripting_works_in_destroy.html"), "OK");
+}
+
+// This test uses a Windows Event to signal to the plugin that it should crash
+// on NP_Initialize.
+IN_PROC_BROWSER_TEST_F(PluginTest, NoHangIfInitCrashes) {
+ HANDLE crash_event = CreateEvent(NULL, TRUE, FALSE, L"TestPluginCrashOnInit");
+ SetEvent(crash_event);
+ LoadAndWait(GetURL("no_hang_if_init_crashes.html"), "OK");
+ CloseHandle(crash_event);
+}
+#endif
+
+// If this flakes on Mac, use http://crbug.com/111508
+IN_PROC_BROWSER_TEST_F(PluginTest, PluginReferrerTest) {
+ GURL url(URLRequestMockHTTPJob::GetMockUrl(
+ FilePath().AppendASCII("npapi").
+ AppendASCII("plugin_url_request_referrer_test.html")));
+ LoadAndWait(url, "OK");
+}
+
+#if defined(OS_MACOSX)
+IN_PROC_BROWSER_TEST_F(PluginTest, PluginConvertPointTest) {
+ gfx::NativeWindow window = NULL;
+ gfx::Rect bounds(50, 50, 400, 400);
+ ui_test_utils::GetNativeWindow(browser(), &window);
+ ui_test_utils::SetWindowBounds(window, bounds);
+
+ ui_test_utils::NavigateToURL(browser(), GetURL("convert_point.html"));
+
+ string16 expected_title(ASCIIToUTF16("OK"));
+ ui_test_utils::TitleWatcher title_watcher(
+ browser()->GetSelectedWebContents(), expected_title);
+ title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
+ // TODO(stuartmorgan): When the automation system supports sending clicks,
+ // change the test to trigger on mouse-down rather than window focus.
+ static_cast<content::WebContentsDelegate*>(browser())->
+ ActivateContents(browser()->GetSelectedWebContents());
+ EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
+}
+#endif
diff --git a/webkit/plugins/npapi/test/plugin_geturl_test.cc b/webkit/plugins/npapi/test/plugin_geturl_test.cc
index 16506bb..4d60aca 100644
--- a/webkit/plugins/npapi/test/plugin_geturl_test.cc
+++ b/webkit/plugins/npapi/test/plugin_geturl_test.cc
@@ -147,7 +147,7 @@ NPError PluginGetURLTest::NewStream(NPMIMEType type, NPStream* stream,
return NPERR_NO_ERROR;
}
- std::string script = "javascript:alert('Hi there from plugin');";
+ std::string script = "javascript:document.title=\"OK\"";
NPString script_string;
script_string.UTF8Characters = script.c_str();
script_string.UTF8Length = static_cast<unsigned int>(script.length());
diff --git a/webkit/plugins/npapi/test/plugin_test_factory.cc b/webkit/plugins/npapi/test/plugin_test_factory.cc
index a1931f2..3630791 100644
--- a/webkit/plugins/npapi/test/plugin_test_factory.cc
+++ b/webkit/plugins/npapi/test/plugin_test_factory.cc
@@ -46,7 +46,7 @@ PluginTest* CreatePluginTest(const std::string& test_name,
#if defined(OS_WIN) || defined(OS_MACOSX)
// TODO(port): plugin_windowless_test.*.
} else if (test_name == "execute_script_delete_in_paint" ||
- test_name == "execute_script_delete_in_mouse_move" ||
+ test_name == "execute_script_delete_in_mouse_up" ||
test_name == "delete_frame_test" ||
test_name == "multiple_instances_sync_calls" ||
test_name == "no_hang_if_init_crashes" ||
diff --git a/webkit/plugins/npapi/test/plugin_windowless_test.cc b/webkit/plugins/npapi/test/plugin_windowless_test.cc
index 33a91db..1520200 100644
--- a/webkit/plugins/npapi/test/plugin_windowless_test.cc
+++ b/webkit/plugins/npapi/test/plugin_windowless_test.cc
@@ -103,8 +103,8 @@ int16 WindowlessPluginTest::HandleEvent(void* event) {
test_name() == "convert_point") {
ConvertPoint(browser);
#endif
- } else if (IsMouseMoveEvent(np_event) &&
- test_name() == "execute_script_delete_in_mouse_move") {
+ } else if (IsMouseUpEvent(np_event) &&
+ test_name() == "execute_script_delete_in_mouse_up") {
ExecuteScript(browser, id(), "DeletePluginWithinScript();", NULL);
SignalTestCompleted();
} else if (IsMouseUpEvent(np_event) &&