diff options
Diffstat (limited to 'webkit/glue')
18 files changed, 199 insertions, 147 deletions
diff --git a/webkit/glue/plugins/test/npapi_test.rc b/webkit/glue/plugins/test/npapi_test.rc index a337ce6..524dda4 100644 --- a/webkit/glue/plugins/test/npapi_test.rc +++ b/webkit/glue/plugins/test/npapi_test.rc @@ -67,21 +67,21 @@ VS_VERSION_INFO VERSIONINFO BEGIN BLOCK "StringFileInfo" BEGIN - BLOCK "040904E4" + BLOCK "040904e4" BEGIN - VALUE "FileDescription", "npapites Dynamic Link Library" + VALUE "FileDescription", "NPAPI Test Plugin" VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "npapites" + VALUE "InternalName", "npapi_test_plugin" VALUE "LegalCopyright", "Copyright (C) 2007" - VALUE "OriginalFilename", "npapites.dll" - VALUE "ProductName", " npapites Dynamic Link Library" + VALUE "MIMEType", "application/vnd.npapi-test" + VALUE "OriginalFilename", "npapi_test_plugin.dll" + VALUE "ProductName", "NPAPI Test Plugin" VALUE "ProductVersion", "1, 0, 0, 1" - VALUE "MIMEType", "application/vnd.npapi-test\0" END END BLOCK "VarFileInfo" BEGIN - VALUE "Translation", 0x409, 1200 + VALUE "Translation", 0x409, 1252 END END diff --git a/webkit/glue/plugins/test/plugin_client.cc b/webkit/glue/plugins/test/plugin_client.cc index 0d0a76d..1cf57e7 100644 --- a/webkit/glue/plugins/test/plugin_client.cc +++ b/webkit/glue/plugins/test/plugin_client.cc @@ -2,31 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#if defined(OS_WIN) -#include <windows.h> -#endif +#include "webkit/glue/plugins/test/plugin_client.h" #include "base/string_util.h" -#include "webkit/glue/plugins/test/plugin_client.h" -#include "webkit/glue/plugins/test/plugin_arguments_test.h" -#include "webkit/glue/plugins/test/plugin_delete_plugin_in_stream_test.h" -#include "webkit/glue/plugins/test/plugin_get_javascript_url_test.h" -#include "webkit/glue/plugins/test/plugin_get_javascript_url2_test.h" -#include "webkit/glue/plugins/test/plugin_geturl_test.h" -#include "webkit/glue/plugins/test/plugin_javascript_open_popup.h" -#include "webkit/glue/plugins/test/plugin_new_fails_test.h" -#include "webkit/glue/plugins/test/plugin_private_test.h" -#include "webkit/glue/plugins/test/plugin_schedule_timer_test.h" -#include "webkit/glue/plugins/test/plugin_thread_async_call_test.h" -#include "webkit/glue/plugins/test/plugin_npobject_lifetime_test.h" -#include "webkit/glue/plugins/test/plugin_npobject_proxy_test.h" -#include "webkit/glue/plugins/test/plugin_window_size_test.h" -#if defined(OS_WIN) -#include "webkit/glue/plugins/test/plugin_windowed_test.h" -#endif -#include "webkit/glue/plugins/test/plugin_windowless_test.h" -#include "third_party/npapi/bindings/npapi.h" -#include "third_party/npapi/bindings/npruntime.h" +#include "webkit/glue/plugins/test/plugin_test.h" +#include "webkit/glue/plugins/test/plugin_test_factory.h" namespace NPAPIClient { @@ -100,112 +80,31 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, // lookup the name parameter std::string test_name; - for (int name_index = 0; name_index < argc; name_index++) + for (int name_index = 0; name_index < argc; name_index++) { if (base::strcasecmp(argn[name_index], "name") == 0) { test_name = argv[name_index]; break; } - + } if (test_name.empty()) return NPERR_GENERIC_ERROR; // no name found - NPError ret = NPERR_GENERIC_ERROR; - bool windowless_plugin = false; - - NPAPIClient::PluginTest *new_test = NULL; - if (test_name == "arguments") { - new_test = new NPAPIClient::PluginArgumentsTest(instance, - NPAPIClient::PluginClient::HostFunctions()); - } else if (test_name == "geturl" || test_name == "geturl_404_response" || - test_name == "geturl_fail_write" || - test_name == "plugin_referrer_test") { - new_test = new NPAPIClient::PluginGetURLTest(instance, - NPAPIClient::PluginClient::HostFunctions()); - } else if (test_name == "npobject_proxy") { - new_test = new NPAPIClient::NPObjectProxyTest(instance, - NPAPIClient::PluginClient::HostFunctions()); -#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 == "delete_frame_test" || - test_name == "multiple_instances_sync_calls" || - test_name == "no_hang_if_init_crashes" || - test_name == "convert_point") { - new_test = new NPAPIClient::WindowlessPluginTest(instance, - NPAPIClient::PluginClient::HostFunctions(), test_name); - windowless_plugin = true; -#endif - } else if (test_name == "getjavascripturl") { - new_test = new NPAPIClient::ExecuteGetJavascriptUrlTest(instance, - NPAPIClient::PluginClient::HostFunctions()); - } else if (test_name == "getjavascripturl2") { - new_test = new NPAPIClient::ExecuteGetJavascriptUrl2Test(instance, - NPAPIClient::PluginClient::HostFunctions()); -#if defined(OS_WIN) - // TODO(port): plugin_window_size_test.*. - } else if (test_name == "checkwindowrect") { - new_test = new NPAPIClient::PluginWindowSizeTest(instance, - NPAPIClient::PluginClient::HostFunctions()); -#endif - } else if (test_name == "self_delete_plugin_stream") { - new_test = new NPAPIClient::DeletePluginInStreamTest(instance, - NPAPIClient::PluginClient::HostFunctions()); -#if defined(OS_WIN) - // TODO(port): plugin_npobject_lifetime_test.*. - } else if (test_name == "npobject_lifetime_test") { - new_test = new NPAPIClient::NPObjectLifetimeTest(instance, - NPAPIClient::PluginClient::HostFunctions()); - } else if (test_name == "npobject_lifetime_test_second_instance") { - new_test = new NPAPIClient::NPObjectLifetimeTestInstance2(instance, - NPAPIClient::PluginClient::HostFunctions()); - } else if (test_name == "new_fails") { - new_test = new NPAPIClient::NewFailsTest(instance, - NPAPIClient::PluginClient::HostFunctions()); - } else if (test_name == "npobject_delete_plugin_in_evaluate") { - new_test = new NPAPIClient::NPObjectDeletePluginInNPN_Evaluate(instance, - NPAPIClient::PluginClient::HostFunctions()); -#endif - } else if (test_name == "plugin_javascript_open_popup_with_plugin") { - new_test = new NPAPIClient::ExecuteJavascriptOpenPopupWithPluginTest( - instance, NPAPIClient::PluginClient::HostFunctions()); - } else if (test_name == "plugin_popup_with_plugin_target") { - new_test = new NPAPIClient::ExecuteJavascriptPopupWindowTargetPluginTest( - instance, NPAPIClient::PluginClient::HostFunctions()); - } else if (test_name == "plugin_thread_async_call") { - new_test = new NPAPIClient::PluginThreadAsyncCallTest( - instance, NPAPIClient::PluginClient::HostFunctions()); - } else if (test_name == "private") { - new_test = new NPAPIClient::PrivateTest(instance, - NPAPIClient::PluginClient::HostFunctions()); - } else if (test_name == "schedule_timer") { - new_test = new NPAPIClient::ScheduleTimerTest( - instance, NPAPIClient::PluginClient::HostFunctions()); -#if defined(OS_WIN) - // TODO(port): plugin_windowed_test.*. - } else if (test_name == "hidden_plugin" || - test_name == "create_instance_in_paint" || - test_name == "alert_in_window_message" || - test_name == "ensure_scripting_works_in_destroy") { - new_test = new NPAPIClient::WindowedPluginTest(instance, - NPAPIClient::PluginClient::HostFunctions()); -#endif - } else { + NPAPIClient::PluginTest* new_test = NPAPIClient::CreatePluginTest(test_name, + instance, NPAPIClient::PluginClient::HostFunctions()); + if (new_test == NULL) { // If we don't have a test case for this, create a // generic one which basically never fails. LOG(WARNING) << "Unknown test name '" << test_name << "'; using default test."; new_test = new NPAPIClient::PluginTest(instance, - NPAPIClient::PluginClient::HostFunctions()); + NPAPIClient::PluginClient::HostFunctions()); } - if (new_test) { - ret = new_test->New(mode, argc, (const char**)argn, - (const char**)argv, saved); - if ((ret == NPERR_NO_ERROR) && windowless_plugin) { - NPAPIClient::PluginClient::HostFunctions()->setvalue( - instance, NPPVpluginWindowBool, NULL); - } + NPError ret = new_test->New(mode, argc, (const char**)argn, + (const char**)argv, saved); + if ((ret == NPERR_NO_ERROR) && new_test->IsWindowless()) { + NPAPIClient::PluginClient::HostFunctions()->setvalue( + instance, NPPVpluginWindowBool, NULL); } return ret; @@ -227,10 +126,6 @@ NPError NPP_SetWindow(NPP instance, NPWindow* pNPWindow) { if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; - if (pNPWindow->window == NULL) { - return NPERR_NO_ERROR; - } - NPAPIClient::PluginTest *plugin = (NPAPIClient::PluginTest*)instance->pdata; diff --git a/webkit/glue/plugins/test/plugin_create_instance_in_paint.cc b/webkit/glue/plugins/test/plugin_create_instance_in_paint.cc index 00f41da..0bea703 100644 --- a/webkit/glue/plugins/test/plugin_create_instance_in_paint.cc +++ b/webkit/glue/plugins/test/plugin_create_instance_in_paint.cc @@ -15,6 +15,9 @@ CreateInstanceInPaintTest::CreateInstanceInPaintTest( } NPError CreateInstanceInPaintTest::SetWindow(NPWindow* pNPWindow) { + if (pNPWindow->window == NULL) + return NPERR_NO_ERROR; + if (test_id() == "1") { if (!window_) { static ATOM window_class = 0; diff --git a/webkit/glue/plugins/test/plugin_delete_plugin_in_stream_test.cc b/webkit/glue/plugins/test/plugin_delete_plugin_in_stream_test.cc index 761ad3e..15318b4 100644 --- a/webkit/glue/plugins/test/plugin_delete_plugin_in_stream_test.cc +++ b/webkit/glue/plugins/test/plugin_delete_plugin_in_stream_test.cc @@ -17,6 +17,9 @@ DeletePluginInStreamTest::DeletePluginInStreamTest(NPP id, NPNetscapeFuncs *host } NPError DeletePluginInStreamTest::SetWindow(NPWindow* pNPWindow) { + if (pNPWindow->window == NULL) + return NPERR_NO_ERROR; + if (!test_started_) { std::string url = "self_delete_plugin_stream.html"; HostFunctions()->geturlnotify(id(), url.c_str(), NULL, diff --git a/webkit/glue/plugins/test/plugin_get_javascript_url2_test.cc b/webkit/glue/plugins/test/plugin_get_javascript_url2_test.cc index e332328..d17dced 100644 --- a/webkit/glue/plugins/test/plugin_get_javascript_url2_test.cc +++ b/webkit/glue/plugins/test/plugin_get_javascript_url2_test.cc @@ -29,6 +29,9 @@ ExecuteGetJavascriptUrl2Test::ExecuteGetJavascriptUrl2Test( } NPError ExecuteGetJavascriptUrl2Test::SetWindow(NPWindow* pNPWindow) { + if (pNPWindow->window == NULL) + return NPERR_NO_ERROR; + if (!test_started_) { std::string url = SELF_URL; HostFunctions()->geturlnotify(id(), url.c_str(), "_self", diff --git a/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc b/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc index 46d1ef9..cc6bc19 100644 --- a/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc +++ b/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc @@ -33,6 +33,9 @@ ExecuteGetJavascriptUrlTest::ExecuteGetJavascriptUrlTest(NPP id, NPNetscapeFuncs } NPError ExecuteGetJavascriptUrlTest::SetWindow(NPWindow* pNPWindow) { + if (pNPWindow->window == NULL) + return NPERR_NO_ERROR; + if (!test_started_) { std::string url = SELF_URL; HostFunctions()->geturlnotify(id(), url.c_str(), "_top", diff --git a/webkit/glue/plugins/test/plugin_geturl_test.cc b/webkit/glue/plugins/test/plugin_geturl_test.cc index c2b9795..fab83c9 100644 --- a/webkit/glue/plugins/test/plugin_geturl_test.cc +++ b/webkit/glue/plugins/test/plugin_geturl_test.cc @@ -64,6 +64,9 @@ NPError PluginGetURLTest::New(uint16 mode, int16 argc, const char* argn[], } NPError PluginGetURLTest::SetWindow(NPWindow* pNPWindow) { + if (pNPWindow->window == NULL) + return NPERR_NO_ERROR; + if (!tests_started_) { tests_started_ = true; diff --git a/webkit/glue/plugins/test/plugin_javascript_open_popup.cc b/webkit/glue/plugins/test/plugin_javascript_open_popup.cc index 0d3f0c0..0f93bf4 100644 --- a/webkit/glue/plugins/test/plugin_javascript_open_popup.cc +++ b/webkit/glue/plugins/test/plugin_javascript_open_popup.cc @@ -21,12 +21,15 @@ ExecuteJavascriptOpenPopupWithPluginTest:: int16 ExecuteJavascriptOpenPopupWithPluginTest::SetWindow( NPWindow* window) { + if (window->window == NULL) + return NPERR_NO_ERROR; + if (!popup_window_test_started_) { popup_window_test_started_ = true; HostFunctions()->geturl( id(), "popup_window_with_target_plugin.html", "_blank"); } - return PluginTest::SetWindow(window); + return NPERR_NO_ERROR; } // ExecuteJavascriptPopupWindowTargetPluginTest member defines. @@ -39,6 +42,9 @@ ExecuteJavascriptPopupWindowTargetPluginTest:: int16 ExecuteJavascriptPopupWindowTargetPluginTest::SetWindow( NPWindow* window) { + if (window->window == NULL) + return NPERR_NO_ERROR; + if (!test_completed_) { if (CheckWindow(window)) { SignalTestCompleted(); diff --git a/webkit/glue/plugins/test/plugin_npobject_lifetime_test.cc b/webkit/glue/plugins/test/plugin_npobject_lifetime_test.cc index 1ae0fac..b62a764 100644 --- a/webkit/glue/plugins/test/plugin_npobject_lifetime_test.cc +++ b/webkit/glue/plugins/test/plugin_npobject_lifetime_test.cc @@ -21,6 +21,9 @@ NPObjectLifetimeTest::NPObjectLifetimeTest(NPP id, } NPError NPObjectLifetimeTest::SetWindow(NPWindow* pNPWindow) { + if (pNPWindow->window == NULL) + return NPERR_NO_ERROR; + HWND window_handle = reinterpret_cast<HWND>(pNPWindow->window); if (!::GetProp(window_handle, L"Plugin_Instance")) { ::SetProp(window_handle, L"Plugin_Instance", this); @@ -84,6 +87,9 @@ NPObjectLifetimeTestInstance2::~NPObjectLifetimeTestInstance2() { } NPError NPObjectLifetimeTestInstance2::SetWindow(NPWindow* pNPWindow) { + if (pNPWindow->window == NULL) + return NPERR_NO_ERROR; + if (!plugin_instance_object_) { if (!HostFunctions()->getvalue(id(), NPNVWindowNPObject, &plugin_instance_object_)) { @@ -113,6 +119,9 @@ NPObjectDeletePluginInNPN_Evaluate::~NPObjectDeletePluginInNPN_Evaluate() { } NPError NPObjectDeletePluginInNPN_Evaluate::SetWindow(NPWindow* np_window) { + if (np_window->window == NULL) + return NPERR_NO_ERROR; + HWND window_handle = reinterpret_cast<HWND>(np_window->window); // We setup a timerproc to invoke NPN_Evaluate to destroy this plugin // instance. This is to ensure that we don't destroy the plugin instance diff --git a/webkit/glue/plugins/test/plugin_npobject_proxy_test.cc b/webkit/glue/plugins/test/plugin_npobject_proxy_test.cc index 5e80cf5..5b3a2ca 100644 --- a/webkit/glue/plugins/test/plugin_npobject_proxy_test.cc +++ b/webkit/glue/plugins/test/plugin_npobject_proxy_test.cc @@ -18,6 +18,9 @@ NPObjectProxyTest::NPObjectProxyTest(NPP id, NPNetscapeFuncs *host_functions) } NPError NPObjectProxyTest::SetWindow(NPWindow* pNPWindow) { + if (pNPWindow->window == NULL) + return NPERR_NO_ERROR; + NPIdentifier document_id = HostFunctions()->getstringidentifier("document"); NPIdentifier create_text_node_id = HostFunctions()->getstringidentifier("createTextNode"); NPIdentifier append_child_id = HostFunctions()->getstringidentifier("appendChild"); diff --git a/webkit/glue/plugins/test/plugin_test.h b/webkit/glue/plugins/test/plugin_test.h index 07bbdcd..f06307ea 100644 --- a/webkit/glue/plugins/test/plugin_test.h +++ b/webkit/glue/plugins/test/plugin_test.h @@ -23,6 +23,9 @@ class PluginTest { // Destructor virtual ~PluginTest() {} + // Returns true if the test runs in windowless plugin mode. + virtual bool IsWindowless() const { return false; } + // // NPAPI Functions // diff --git a/webkit/glue/plugins/test/plugin_test_factory.cc b/webkit/glue/plugins/test/plugin_test_factory.cc new file mode 100644 index 0000000..e2b42b3 --- /dev/null +++ b/webkit/glue/plugins/test/plugin_test_factory.cc @@ -0,0 +1,97 @@ +// Copyright (c) 2010 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 "webkit/glue/plugins/test/plugin_test_factory.h" + +#include "webkit/glue/plugins/test/plugin_arguments_test.h" +#include "webkit/glue/plugins/test/plugin_delete_plugin_in_stream_test.h" +#include "webkit/glue/plugins/test/plugin_get_javascript_url_test.h" +#include "webkit/glue/plugins/test/plugin_get_javascript_url2_test.h" +#include "webkit/glue/plugins/test/plugin_geturl_test.h" +#include "webkit/glue/plugins/test/plugin_javascript_open_popup.h" +#include "webkit/glue/plugins/test/plugin_new_fails_test.h" +#include "webkit/glue/plugins/test/plugin_npobject_lifetime_test.h" +#include "webkit/glue/plugins/test/plugin_npobject_proxy_test.h" +#include "webkit/glue/plugins/test/plugin_private_test.h" +#include "webkit/glue/plugins/test/plugin_schedule_timer_test.h" +#include "webkit/glue/plugins/test/plugin_thread_async_call_test.h" +#include "webkit/glue/plugins/test/plugin_window_size_test.h" +#if defined(OS_WIN) +#include "webkit/glue/plugins/test/plugin_windowed_test.h" +#endif +#include "webkit/glue/plugins/test/plugin_windowless_test.h" + +namespace NPAPIClient { + +PluginTest* CreatePluginTest(const std::string& test_name, + NPP instance, + NPNetscapeFuncs* host_functions) { + PluginTest* new_test = NULL; + + if (test_name == "arguments") { + new_test = new PluginArgumentsTest(instance, host_functions); + } else if (test_name == "geturl" || test_name == "geturl_404_response" || + test_name == "geturl_fail_write" || + test_name == "plugin_referrer_test") { + new_test = new PluginGetURLTest(instance, host_functions); + } else if (test_name == "npobject_proxy") { + new_test = new NPObjectProxyTest(instance, host_functions); +#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 == "delete_frame_test" || + test_name == "multiple_instances_sync_calls" || + test_name == "no_hang_if_init_crashes" || + test_name == "convert_point") { + new_test = new WindowlessPluginTest(instance, host_functions); +#endif + } else if (test_name == "getjavascripturl") { + new_test = new ExecuteGetJavascriptUrlTest(instance, host_functions); + } else if (test_name == "getjavascripturl2") { + new_test = new ExecuteGetJavascriptUrl2Test(instance, host_functions); +#if defined(OS_WIN) + // TODO(port): plugin_window_size_test.*. + } else if (test_name == "checkwindowrect") { + new_test = new PluginWindowSizeTest(instance, host_functions); +#endif + } else if (test_name == "self_delete_plugin_stream") { + new_test = new DeletePluginInStreamTest(instance, host_functions); +#if defined(OS_WIN) + // TODO(port): plugin_npobject_lifetime_test.*. + } else if (test_name == "npobject_lifetime_test") { + new_test = new NPObjectLifetimeTest(instance, host_functions); + } else if (test_name == "npobject_lifetime_test_second_instance") { + new_test = new NPObjectLifetimeTestInstance2(instance, host_functions); + } else if (test_name == "new_fails") { + new_test = new NewFailsTest(instance, host_functions); + } else if (test_name == "npobject_delete_plugin_in_evaluate") { + new_test = new NPObjectDeletePluginInNPN_Evaluate(instance, host_functions); +#endif + } else if (test_name == "plugin_javascript_open_popup_with_plugin") { + new_test = new ExecuteJavascriptOpenPopupWithPluginTest( + instance, host_functions); + } else if (test_name == "plugin_popup_with_plugin_target") { + new_test = new ExecuteJavascriptPopupWindowTargetPluginTest( + instance, host_functions); + } else if (test_name == "plugin_thread_async_call") { + new_test = new PluginThreadAsyncCallTest(instance, host_functions); + } else if (test_name == "private") { + new_test = new PrivateTest(instance, host_functions); + } else if (test_name == "schedule_timer") { + new_test = new ScheduleTimerTest(instance, host_functions); +#if defined(OS_WIN) + // TODO(port): plugin_windowed_test.*. + } else if (test_name == "hidden_plugin" || + test_name == "create_instance_in_paint" || + test_name == "alert_in_window_message" || + test_name == "ensure_scripting_works_in_destroy") { + new_test = new WindowedPluginTest(instance, host_functions); +#endif + } + + return new_test; +} + +} // namespace NPAPIClient diff --git a/webkit/glue/plugins/test/plugin_test_factory.h b/webkit/glue/plugins/test/plugin_test_factory.h new file mode 100644 index 0000000..3fd38d5 --- /dev/null +++ b/webkit/glue/plugins/test/plugin_test_factory.h @@ -0,0 +1,22 @@ +// Copyright (c) 2010 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 WEBKIT_PORT_PLUGINS_TEST_PLUGIN_TEST_FACTROY_H__ +#define WEBKIT_PORT_PLUGINS_TEST_PLUGIN_TEST_FACTROY_H__ + +#include <string> + +#include "third_party/npapi/bindings/nphostapi.h" + +namespace NPAPIClient { + +class PluginTest; + +extern PluginTest* CreatePluginTest(const std::string& test_name, + NPP instance, + NPNetscapeFuncs* host_functions); + +} // namespace NPAPIClient + +#endif // WEBKIT_PORT_PLUGINS_TEST_PLUGIN_TEST_FACTROY_H__ diff --git a/webkit/glue/plugins/test/plugin_window_size_test.cc b/webkit/glue/plugins/test/plugin_window_size_test.cc index a0cb687..9bfabca 100644 --- a/webkit/glue/plugins/test/plugin_window_size_test.cc +++ b/webkit/glue/plugins/test/plugin_window_size_test.cc @@ -13,6 +13,9 @@ PluginWindowSizeTest::PluginWindowSizeTest(NPP id, } NPError PluginWindowSizeTest::SetWindow(NPWindow* pNPWindow) { + if (pNPWindow->window == NULL) + return NPERR_NO_ERROR; + HWND window = reinterpret_cast<HWND>(pNPWindow->window); if (!pNPWindow || !::IsWindow(window)) { SetError("Invalid arguments passed in"); diff --git a/webkit/glue/plugins/test/plugin_windowed_test.cc b/webkit/glue/plugins/test/plugin_windowed_test.cc index 102e214..5ae8e30 100644 --- a/webkit/glue/plugins/test/plugin_windowed_test.cc +++ b/webkit/glue/plugins/test/plugin_windowed_test.cc @@ -18,6 +18,9 @@ WindowedPluginTest::~WindowedPluginTest() { } NPError WindowedPluginTest::SetWindow(NPWindow* pNPWindow) { + if (pNPWindow->window == NULL) + return NPERR_NO_ERROR; + if (test_name() == "create_instance_in_paint" && test_id() == "2") { SignalTestCompleted(); return NPERR_NO_ERROR; diff --git a/webkit/glue/plugins/test/plugin_windowless_test.cc b/webkit/glue/plugins/test/plugin_windowless_test.cc index 665072e..ae6e26e 100644 --- a/webkit/glue/plugins/test/plugin_windowless_test.cc +++ b/webkit/glue/plugins/test/plugin_windowless_test.cc @@ -16,10 +16,9 @@ namespace NPAPIClient { // Remember the first plugin instance for tests involving multiple instances WindowlessPluginTest* g_other_instance = NULL; -WindowlessPluginTest::WindowlessPluginTest( - NPP id, NPNetscapeFuncs *host_functions, const std::string& test_name) - : PluginTest(id, host_functions), - test_name_(test_name) { +WindowlessPluginTest::WindowlessPluginTest(NPP id, + NPNetscapeFuncs *host_functions) + : PluginTest(id, host_functions) { if (!g_other_instance) g_other_instance = this; } @@ -91,22 +90,22 @@ int16 WindowlessPluginTest::HandleEvent(void* event) { DeleteObject(clipping_region); #endif - if (test_name_ == "execute_script_delete_in_paint") { + if (test_name() == "execute_script_delete_in_paint") { ExecuteScriptDeleteInPaint(browser); - } else if (test_name_ == "multiple_instances_sync_calls") { + } else if (test_name() == "multiple_instances_sync_calls") { MultipleInstanceSyncCalls(browser); } #if OS_MACOSX } else if (IsWindowActivationEvent(np_event) && - test_name_ == "convert_point") { + test_name() == "convert_point") { ConvertPoint(browser); #endif } else if (IsMouseMoveEvent(np_event) && - test_name_ == "execute_script_delete_in_mouse_move") { + test_name() == "execute_script_delete_in_mouse_move") { ExecuteScript(browser, id(), "DeletePluginWithinScript();", NULL); SignalTestCompleted(); } else if (IsMouseUpEvent(np_event) && - test_name_ == "delete_frame_test") { + test_name() == "delete_frame_test") { ExecuteScript( browser, id(), "parent.document.getElementById('frame').outerHTML = ''", NULL); diff --git a/webkit/glue/plugins/test/plugin_windowless_test.h b/webkit/glue/plugins/test/plugin_windowless_test.h index 7ca13af..f336653 100644 --- a/webkit/glue/plugins/test/plugin_windowless_test.h +++ b/webkit/glue/plugins/test/plugin_windowless_test.h @@ -14,8 +14,11 @@ namespace NPAPIClient { class WindowlessPluginTest : public PluginTest { public: // Constructor. - WindowlessPluginTest(NPP id, NPNetscapeFuncs *host_functions, - const std::string& test_name); + WindowlessPluginTest(NPP id, NPNetscapeFuncs *host_functions); + + // These tests run in windowless plugin mode. + virtual bool IsWindowless() const { return true; } + // NPAPI HandleEvent handler virtual int16 HandleEvent(void* event); @@ -25,9 +28,6 @@ class WindowlessPluginTest : public PluginTest { void ExecuteScriptDeleteInPaint(NPNetscapeFuncs* browser); void MultipleInstanceSyncCalls(NPNetscapeFuncs* browser); void ConvertPoint(NPNetscapeFuncs* browser); - - private: - std::string test_name_; }; } // namespace NPAPIClient diff --git a/webkit/glue/plugins/test/resource.h b/webkit/glue/plugins/test/resource.h index 0d23ee9..c52fa82 100644 --- a/webkit/glue/plugins/test/resource.h +++ b/webkit/glue/plugins/test/resource.h @@ -1,13 +1,10 @@ -// Copyright (c) 2009 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. - //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by npapitest.rc +// Used by npapi_test.rc +// // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 101 |