summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/default_plugin/plugin_main.cc32
-rw-r--r--webkit/glue/plugins/plugin_list_win.cc14
-rw-r--r--webkit/tools/test_shell/plugin_tests.cc28
-rwxr-xr-xwebkit/tools/test_shell/test_shell.cc10
4 files changed, 69 insertions, 15 deletions
diff --git a/webkit/default_plugin/plugin_main.cc b/webkit/default_plugin/plugin_main.cc
index f23a6f8..b0a24f8 100644
--- a/webkit/default_plugin/plugin_main.cc
+++ b/webkit/default_plugin/plugin_main.cc
@@ -5,6 +5,7 @@
#include "webkit/default_plugin/plugin_main.h"
#include "base/logging.h"
+#include "base/string_util.h"
#include "webkit/activex_shim/npp_impl.h"
#include "webkit/default_plugin/plugin_impl.h"
#include "webkit/glue/webkit_glue.h"
@@ -54,6 +55,31 @@ NPError API_CALL NP_Shutdown(void) {
return 0;
}
+namespace {
+// This function is only invoked when the default plugin is invoked
+// with a special mime type application/chromium-test-default-plugin
+void SignalTestResult(NPP instance) {
+ NPObject *window_obj = NULL;
+ g_browser->getvalue(instance, NPNVWindowNPObject, &window_obj);
+ if (!window_obj) {
+ NOTREACHED();
+ return;
+ }
+
+ std::string script = "javascript:onSuccess()";
+ NPString script_string;
+ script_string.UTF8Characters = script.c_str();
+ script_string.UTF8Length =
+ static_cast<unsigned int>(script.length());
+
+ NPVariant result_var;
+ NPError result = g_browser->evaluate(instance, window_obj,
+ &script_string, &result_var);
+ g_browser->releaseobject(window_obj);
+}
+
+} // namespace CHROMIUM_DefaultPluginTest
+
NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc,
char* argn[], char* argv[], NPSavedData* saved) {
if (instance == NULL)
@@ -63,9 +89,15 @@ NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc,
// 1. Test-shell
// 2. The plugin is running in the renderer process.
if (webkit_glue::IsPluginRunningInRendererProcess()) {
+ if (!base::strcasecmp(plugin_type,
+ "application/chromium-test-default-plugin")) {
+ SignalTestResult(instance);
+ return NPERR_NO_ERROR;
+ }
return NPERR_GENERIC_ERROR;
}
+
PluginInstallerImpl* plugin_impl = new PluginInstallerImpl(mode);
plugin_impl->Initialize(GetCurrentModuleHandle(), instance, plugin_type, argc,
argn, argv);
diff --git a/webkit/glue/plugins/plugin_list_win.cc b/webkit/glue/plugins/plugin_list_win.cc
index 02b1b94..b91c54d 100644
--- a/webkit/glue/plugins/plugin_list_win.cc
+++ b/webkit/glue/plugins/plugin_list_win.cc
@@ -211,20 +211,6 @@ void PluginList::PlatformInit() {
const PluginVersionInfo builtin_plugins[] = {
{
- FilePath(kActiveXShimFileName),
- L"ActiveX Plug-in",
- L"ActiveX Plug-in provides a shim to support ActiveX controls",
- L"1, 0, 0, 1",
- L"application/x-oleobject|application/oleobject",
- L"*|*",
- L"",
- {
- activex_shim::ActiveX_Shim_NP_GetEntryPoints,
- activex_shim::ActiveX_Shim_NP_Initialize,
- activex_shim::ActiveX_Shim_NP_Shutdown
- }
- },
- {
FilePath(kActiveXShimFileNameForMediaPlayer),
kActiveXShimFileNameForMediaPlayer,
L"Windows Media Player",
diff --git a/webkit/tools/test_shell/plugin_tests.cc b/webkit/tools/test_shell/plugin_tests.cc
index d5ac5ca..f2ad349 100644
--- a/webkit/tools/test_shell/plugin_tests.cc
+++ b/webkit/tools/test_shell/plugin_tests.cc
@@ -95,3 +95,31 @@ TEST_F(PluginTest, Refresh) {
DeleteTestPlugin();
}
+
+TEST_F(PluginTest, DefaultPluginLoadTest) {
+ std::string html = "\
+ <div id='result'>Test running....</div>\
+ <script>\
+ function onSuccess() {\
+ var result = document.getElementById('result');\
+ result.innerHTML = 'DONE';\
+ }\
+ </script>\
+ <DIV ID=PluginDiv>\
+ <object classid=\"clsid:9E8BC6CE-AF35-400c-ABF6-A3F746A1871D\">\
+ <embed type=\"application/chromium-test-default-plugin\"\
+ mode=\"np_embed\"\
+ ></embed>\
+ </object>\
+ </DIV>\
+ ";
+
+ test_shell_->webView()->GetMainFrame()->LoadHTMLString(
+ html, GURL("about:blank"));
+ test_shell_->WaitTestFinished();
+
+ std::wstring text;
+ test_shell_->webView()->GetMainFrame()->GetContentAsPlainText(10000, &text);
+
+ ASSERT_EQ(true, StartsWith(text, L"DONE", true));
+}
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 6ce2509..3e8af04 100755
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -7,7 +7,7 @@
#include "webkit/tools/test_shell/test_shell.h"
-
+#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/debug_on_start.h"
#include "base/file_path.h"
@@ -614,6 +614,14 @@ bool GetPluginFinderURL(std::string* plugin_finder_url) {
#if !defined(LINUX2)
bool IsDefaultPluginEnabled() {
+ FilePath exe_path;
+
+ if (PathService::Get(base::FILE_EXE, &exe_path)) {
+ std::wstring exe_name = file_util::GetFilenameFromPath(
+ exe_path.ToWStringHack());
+ if (StartsWith(exe_name, L"test_shell_tests", false))
+ return true;
+ }
return false;
}