diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-18 17:46:36 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-18 17:46:36 +0000 |
commit | dabbeb8b81e3712b1b2c2d5a8b76831f64995b35 (patch) | |
tree | 74334d5dd10e8ab4013aaca37b8d65d3d87764a6 | |
parent | 2975326eca211f79a410ea4865d7ed333a1be716 (diff) | |
download | chromium_src-dabbeb8b81e3712b1b2c2d5a8b76831f64995b35.zip chromium_src-dabbeb8b81e3712b1b2c2d5a8b76831f64995b35.tar.gz chromium_src-dabbeb8b81e3712b1b2c2d5a8b76831f64995b35.tar.bz2 |
Enable windowless-based npapi_test_plugin tests on the Mac.
BUG=30488
TEST=N/A
Review URL: http://codereview.chromium.org/501074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34959 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/test/data/valgrind/ui_tests.gtest_mac.txt | 1 | ||||
-rw-r--r-- | chrome/test/ui/npapi_uitest.cc | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/test/plugin_client.cc | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/test/plugin_windowless_test.cc | 40 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.gyp | 10 |
5 files changed, 46 insertions, 11 deletions
diff --git a/chrome/test/data/valgrind/ui_tests.gtest_mac.txt b/chrome/test/data/valgrind/ui_tests.gtest_mac.txt index 0f8247c..12bb136 100644 --- a/chrome/test/data/valgrind/ui_tests.gtest_mac.txt +++ b/chrome/test/data/valgrind/ui_tests.gtest_mac.txt @@ -62,3 +62,4 @@ NPAPITester.FLAKY_ManyPlugins NPAPITester.NPObjectProxy NPAPITester.ScheduleTimer NPAPIVisiblePluginTester.SelfDeletePluginInNewStream +NPAPIVisiblePluginTester.MultipleInstancesSyncCalls diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc index 4a8168b..13ec73f 100644 --- a/chrome/test/ui/npapi_uitest.cc +++ b/chrome/test/ui/npapi_uitest.cc @@ -163,7 +163,7 @@ TEST_F(NPAPITester, DISABLED_SelfDeletePluginInvokeAlert) { kShortWaitTimeout); } -#if defined(OS_WIN) +#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 TEST_F(NPAPIVisiblePluginTester, @@ -323,7 +323,7 @@ TEST_F(NPAPIIncognitoTester, PrivateEnabled) { kTestCompleteSuccess, kShortWaitTimeout); } -#if defined(OS_WIN) +#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) { diff --git a/webkit/glue/plugins/test/plugin_client.cc b/webkit/glue/plugins/test/plugin_client.cc index 174c00b..3f2e6c7 100644 --- a/webkit/glue/plugins/test/plugin_client.cc +++ b/webkit/glue/plugins/test/plugin_client.cc @@ -124,7 +124,7 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, } else if (test_name == "npobject_proxy") { new_test = new NPAPIClient::NPObjectProxyTest(instance, NPAPIClient::PluginClient::HostFunctions()); -#if defined(OS_WIN) +#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" || diff --git a/webkit/glue/plugins/test/plugin_windowless_test.cc b/webkit/glue/plugins/test/plugin_windowless_test.cc index a42a69d..2ab9ca1 100644 --- a/webkit/glue/plugins/test/plugin_windowless_test.cc +++ b/webkit/glue/plugins/test/plugin_windowless_test.cc @@ -6,6 +6,10 @@ #include "webkit/glue/plugins/test/plugin_windowless_test.h" #include "webkit/glue/plugins/test/plugin_client.h" +#if defined(OS_MACOSX) +#include <Carbon/Carbon.h> +#endif + namespace NPAPIClient { // Remember the first plugin instance for tests involving multiple instances @@ -19,6 +23,30 @@ WindowlessPluginTest::WindowlessPluginTest( g_other_instance = this; } +static bool IsPaintEvent(NPEvent* np_event) { +#if defined(OS_WIN) + return WM_PAINT == np_event->event; +#elif defined(OS_MACOSX) + return np_event->what == updateEvt; +#endif +} + +static bool IsMouseMoveEvent(NPEvent* np_event) { +#if defined(OS_WIN) + return WM_MOUSEMOVE == np_event->event; +#elif defined(OS_MACOSX) + return np_event->what == nullEvent; +#endif +} + +static bool IsMouseUpEvent(NPEvent* np_event) { +#if defined(OS_WIN) + return WM_LBUTTONUP == np_event->event; +#elif defined(OS_MACOSX) + return np_event->what == mouseUp; +#endif +} + int16 WindowlessPluginTest::HandleEvent(void* event) { NPNetscapeFuncs* browser = NPAPIClient::PluginClient::HostFunctions(); @@ -33,7 +61,8 @@ int16 WindowlessPluginTest::HandleEvent(void* event) { } NPEvent* np_event = reinterpret_cast<NPEvent*>(event); - if (WM_PAINT == np_event->event) { + if (IsPaintEvent(np_event)) { +#if defined(OS_WIN) HDC paint_dc = reinterpret_cast<HDC>(np_event->wParam); if (paint_dc == NULL) { SetError("Invalid Window DC passed to HandleEvent for WM_PAINT"); @@ -50,6 +79,7 @@ int16 WindowlessPluginTest::HandleEvent(void* event) { } DeleteObject(clipping_region); +#endif if (test_name_ == "execute_script_delete_in_paint") { ExecuteScriptDeleteInPaint(browser); @@ -57,11 +87,11 @@ int16 WindowlessPluginTest::HandleEvent(void* event) { MultipleInstanceSyncCalls(browser); } - } else if (WM_MOUSEMOVE == np_event->event && + } else if (IsMouseMoveEvent(np_event) && test_name_ == "execute_script_delete_in_mouse_move") { ExecuteScript(browser, id(), "DeletePluginWithinScript();", NULL); SignalTestCompleted(); - } else if (WM_LBUTTONUP == np_event->event && + } else if (IsMouseUpEvent(np_event) && test_name_ == "delete_frame_test") { ExecuteScript( browser, id(), @@ -89,8 +119,8 @@ NPError WindowlessPluginTest::ExecuteScript(NPNetscapeFuncs* browser, NPP id, void WindowlessPluginTest::ExecuteScriptDeleteInPaint( NPNetscapeFuncs* browser) { - NPUTF8* urlString = "javascript:DeletePluginWithinScript()"; - NPUTF8* targetString = NULL; + const NPUTF8* urlString = "javascript:DeletePluginWithinScript()"; + const NPUTF8* targetString = NULL; browser->geturl(id(), urlString, targetString); SignalTestCompleted(); } diff --git a/webkit/tools/test_shell/test_shell.gyp b/webkit/tools/test_shell/test_shell.gyp index 786d4a2..1b5ff01 100644 --- a/webkit/tools/test_shell/test_shell.gyp +++ b/webkit/tools/test_shell/test_shell.gyp @@ -632,11 +632,9 @@ # plugin_npobject_lifetime_test.cc has win32-isms # (HWND, CALLBACK). '../../glue/plugins/test/plugin_npobject_lifetime_test.cc', - # The windowed/windowless APIs are necessarily - # platform-specific. + # The window APIs are necessarily platform-specific. '../../glue/plugins/test/plugin_window_size_test.cc', '../../glue/plugins/test/plugin_windowed_test.cc', - '../../glue/plugins/test/plugin_windowless_test.cc', # Seems windows specific. '../../glue/plugins/test/plugin_create_instance_in_paint.cc', '../../glue/plugins/test/plugin_create_instance_in_paint.h', @@ -653,6 +651,12 @@ ], }, }], + ['OS=="linux"', { + 'sources!': [ + # Needs simple event record type porting + '../../glue/plugins/test/plugin_windowless_test.cc', + ], + }], ['OS=="linux" and (target_arch=="x64" or target_arch=="arm")', { # Shared libraries need -fPIC on x86-64 'cflags': ['-fPIC'] |