Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Unified Diff: webkit/glue/plugins/test/plugin_windowless_test.cc

Issue 501074: Enable windowless-based npapi_test_plugin tests on the Mac. (Closed)
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/plugins/test/plugin_client.cc ('k') | webkit/tools/test_shell/test_shell.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/test/plugin_windowless_test.cc
diff --git a/webkit/glue/plugins/test/plugin_windowless_test.cc b/webkit/glue/plugins/test/plugin_windowless_test.cc
index a42a69dd444efa0127b8b6b2170fdd51554e78c5..2ab9ca151ebdc75d11b7fefbef5f361bdc8f6c23 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();
}
« no previous file with comments | « webkit/glue/plugins/test/plugin_client.cc ('k') | webkit/tools/test_shell/test_shell.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698