summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r--webkit/glue/plugins/test/plugin_client.cc19
-rw-r--r--webkit/glue/plugins/test/plugin_javascript_open_popup.cc62
-rw-r--r--webkit/glue/plugins/test/plugin_javascript_open_popup.h5
-rw-r--r--webkit/glue/plugins/test/plugin_npobject_lifetime_test.h11
4 files changed, 86 insertions, 11 deletions
diff --git a/webkit/glue/plugins/test/plugin_client.cc b/webkit/glue/plugins/test/plugin_client.cc
index b515779..3a3d3a5 100644
--- a/webkit/glue/plugins/test/plugin_client.cc
+++ b/webkit/glue/plugins/test/plugin_client.cc
@@ -43,7 +43,7 @@ NPError PluginClient::GetEntryPoints(NPPluginFuncs* pFuncs) {
pFuncs->urlnotify = NPP_URLNotify;
pFuncs->getvalue = NPP_GetValue;
pFuncs->setvalue = NPP_SetValue;
- pFuncs->javaClass = static_cast<JRIGlobalRef>(NPP_GetJavaClass);
+ pFuncs->javaClass = reinterpret_cast<JRIGlobalRef>(NPP_GetJavaClass);
return NPERR_NO_ERROR;
}
@@ -100,6 +100,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode,
} else if (base::strcasecmp(argv[name_index], "npobject_proxy") == 0) {
new_test = new NPAPIClient::NPObjectProxyTest(instance,
NPAPIClient::PluginClient::HostFunctions());
+#if defined(OS_WIN)
+ // TODO(port): plugin_windowless_test.*.
} else if ((base::strcasecmp(argv[name_index],
"execute_script_delete_in_paint") == 0) ||
(base::strcasecmp(argv[name_index],
@@ -107,16 +109,22 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode,
new_test = new NPAPIClient::WindowlessPluginTest(instance,
NPAPIClient::PluginClient::HostFunctions(), argv[name_index]);
windowless_plugin = true;
+#endif
} else if (base::strcasecmp(argv[name_index], "getjavascripturl") == 0) {
new_test = new NPAPIClient::ExecuteGetJavascriptUrlTest(instance,
NPAPIClient::PluginClient::HostFunctions());
+#if defined(OS_WIN)
+ // TODO(port): plugin_window_size_test.*.
} else if (base::strcasecmp(argv[name_index], "checkwindowrect") == 0) {
new_test = new NPAPIClient::PluginWindowSizeTest(instance,
NPAPIClient::PluginClient::HostFunctions());
+#endif
} else if (base::strcasecmp(argv[name_index],
"self_delete_plugin_stream") == 0) {
new_test = new NPAPIClient::DeletePluginInStreamTest(instance,
NPAPIClient::PluginClient::HostFunctions());
+#if defined(OS_WIN)
+ // TODO(port): plugin_npobject_lifetime_test.*.
} else if (base::strcasecmp(argv[name_index],
"npobject_lifetime_test") == 0) {
new_test = new NPAPIClient::NPObjectLifetimeTest(instance,
@@ -125,13 +133,14 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode,
"npobject_lifetime_test_second_instance") == 0) {
new_test = new NPAPIClient::NPObjectLifetimeTestInstance2(instance,
NPAPIClient::PluginClient::HostFunctions());
- } else if (base::strcasecmp(argv[name_index], "new_fails") == 0) {
- new_test = new NPAPIClient::NewFailsTest(instance,
- NPAPIClient::PluginClient::HostFunctions());
} else if (base::strcasecmp(argv[name_index],
"npobject_delete_plugin_in_evaluate") == 0) {
new_test = new NPAPIClient::NPObjectDeletePluginInNPN_Evaluate(instance,
NPAPIClient::PluginClient::HostFunctions());
+#endif
+ } else if (base::strcasecmp(argv[name_index], "new_fails") == 0) {
+ new_test = new NPAPIClient::NewFailsTest(instance,
+ NPAPIClient::PluginClient::HostFunctions());
} else if (base::strcasecmp(argv[name_index],
"plugin_javascript_open_popup_with_plugin") == 0) {
new_test = new NPAPIClient::ExecuteJavascriptOpenPopupWithPluginTest(
@@ -146,6 +155,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode,
} else {
// If we don't have a test case for this, create a
// generic one which basically never fails.
+ LOG(WARNING) << "Unknown test name '" << argv[name_index]
+ << "'; using default test.";
new_test = new NPAPIClient::PluginTest(instance,
NPAPIClient::PluginClient::HostFunctions());
}
diff --git a/webkit/glue/plugins/test/plugin_javascript_open_popup.cc b/webkit/glue/plugins/test/plugin_javascript_open_popup.cc
index 2ddf698..d543a8c 100644
--- a/webkit/glue/plugins/test/plugin_javascript_open_popup.cc
+++ b/webkit/glue/plugins/test/plugin_javascript_open_popup.cc
@@ -1,6 +1,20 @@
// Copyright (c) 2006-2008 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_LINUX)
+// HACK: we need this #define in place before npapi.h is included for
+// plugins to work. However, all sorts of headers include npapi.h, so
+// the only way to be certain the define is in place is to put it
+// here. You might ask, "Why not set it in npapi.h directly, or in
+// this directory's SConscript, then?" but it turns out this define
+// makes npapi.h include Xlib.h, which in turn defines a ton of symbols
+// like None and Status, causing conflicts with the aforementioned
+// many headers that include npapi.h. Ugh.
+#define MOZ_X11 1
+#endif
+
#include "webkit/glue/plugins/test/plugin_javascript_open_popup.h"
#include "webkit/glue/plugins/test/plugin_client.h"
@@ -35,13 +49,7 @@ ExecuteJavascriptPopupWindowTargetPluginTest::
int16 ExecuteJavascriptPopupWindowTargetPluginTest::SetWindow(
NPWindow* window) {
if (!test_completed_) {
- HWND window_handle = reinterpret_cast<HWND>(window->window);
-
- if (IsWindow(window_handle)) {
- HWND parent_window = GetParent(window_handle);
- if (!IsWindow(parent_window) || parent_window == GetDesktopWindow()) {
- SetError("Windowed plugin instantiated with NULL parent");
- }
+ if (CheckWindow(window)) {
SignalTestCompleted();
test_completed_ = true;
}
@@ -49,4 +57,44 @@ int16 ExecuteJavascriptPopupWindowTargetPluginTest::SetWindow(
return PluginTest::SetWindow(window);
}
+#if defined(OS_WIN)
+bool ExecuteJavascriptPopupWindowTargetPluginTest::CheckWindow(
+ NPWindow* window) {
+ HWND window_handle = reinterpret_cast<HWND>(window->window);
+
+ if (IsWindow(window_handle)) {
+ HWND parent_window = GetParent(window_handle);
+ if (!IsWindow(parent_window) || parent_window == GetDesktopWindow())
+ SetError("Windowed plugin instantiated with NULL parent");
+ return true;
+ }
+
+ return false;
+}
+
+#elif defined(OS_LINUX)
+// This code blindly follows the same sorts of verifications done on
+// the Windows side. Does it make sense on X? Maybe not really, but
+// it can't hurt to do extra validations.
+bool ExecuteJavascriptPopupWindowTargetPluginTest::CheckWindow(
+ NPWindow* window) {
+ Window xwindow = reinterpret_cast<Window>(window->window);
+ // Grab a pointer to the extra SetWindow data so we can grab the display out.
+ NPSetWindowCallbackStruct* extra =
+ static_cast<NPSetWindowCallbackStruct*>(window->ws_info);
+
+ if (xwindow) {
+ Window root, parent;
+ Status status = XQueryTree(extra->display, xwindow, &root, &parent,
+ NULL, NULL); // NULL children info.
+ DCHECK(status != 0);
+ if (!parent || parent == root)
+ SetError("Windowed plugin instantiated with NULL parent");
+ return true;
+ }
+
+ return false;
+}
+#endif
+
} // namespace NPAPIClient
diff --git a/webkit/glue/plugins/test/plugin_javascript_open_popup.h b/webkit/glue/plugins/test/plugin_javascript_open_popup.h
index d5fd8de..552397a 100644
--- a/webkit/glue/plugins/test/plugin_javascript_open_popup.h
+++ b/webkit/glue/plugins/test/plugin_javascript_open_popup.h
@@ -34,6 +34,11 @@ class ExecuteJavascriptPopupWindowTargetPluginTest : public PluginTest {
virtual NPError SetWindow(NPWindow* window);
private:
+ // Do a platform-specific validation of the passed-in |window|.
+ // E.g. on Windows, verifies window->window is a reasonable HWND.
+ // Returns true if the test should be marked complete.
+ bool CheckWindow(NPWindow* window);
+
bool test_completed_;
};
diff --git a/webkit/glue/plugins/test/plugin_npobject_lifetime_test.h b/webkit/glue/plugins/test/plugin_npobject_lifetime_test.h
index d4c1ac5..4303d99 100644
--- a/webkit/glue/plugins/test/plugin_npobject_lifetime_test.h
+++ b/webkit/glue/plugins/test/plugin_npobject_lifetime_test.h
@@ -5,6 +5,7 @@
#ifndef WEBKIT_GLUE_PLUGINS_TEST_PLUGIN_NPOBJECT_LIFETIME_TEST_H__
#define WEBKIT_GLUE_PLUGINS_TEST_PLUGIN_NPOBJECT_LIFETIME_TEST_H__
+#include "build/build_config.h"
#include "webkit/glue/plugins/test/plugin_test.h"
namespace NPAPIClient {
@@ -25,8 +26,12 @@ class NPObjectLifetimeTest : public PluginTest {
protected:
NPObject* other_plugin_instance_object_;
+
+#if defined(OS_WIN)
static void CALLBACK TimerProc(HWND window, UINT message, UINT timer_id,
unsigned long elapsed_milli_seconds);
+#endif
+ DISALLOW_IMPLICIT_CONSTRUCTORS(NPObjectLifetimeTest);
};
// The NPObjectLifetimeTestInstance2 class represents the plugin instance
@@ -43,6 +48,7 @@ class NPObjectLifetimeTestInstance2 : public PluginTest {
static NPObject* plugin_instance_object_;
friend class NPObjectLifetimeTest;
+ DISALLOW_IMPLICIT_CONSTRUCTORS(NPObjectLifetimeTestInstance2);
};
// The NPObjectLifeTime class tests the case where a plugin instance is
@@ -58,11 +64,16 @@ class NPObjectDeletePluginInNPN_Evaluate : public PluginTest {
protected:
NPObject* plugin_instance_object_;
+#if defined(OS_WIN)
static void CALLBACK TimerProc(HWND window, UINT message, UINT timer_id,
unsigned long elapsed_milli_seconds);
+#endif
+
private:
bool npn_evaluate_timer_proc_set_;
static NPObjectDeletePluginInNPN_Evaluate* g_npn_evaluate_test_instance_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(NPObjectDeletePluginInNPN_Evaluate);
};
} // namespace NPAPIClient