summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/default_plugin_uitest.cc33
-rw-r--r--chrome/browser/plugin_service.cc3
-rw-r--r--chrome/chrome_common.gypi5
-rw-r--r--chrome/chrome_tests.gypi2
-rw-r--r--chrome/common/DEPS1
-rw-r--r--chrome/common/default_plugin.cc33
-rw-r--r--chrome/common/default_plugin.h15
-rw-r--r--chrome/plugin/plugin_main.cc2
-rw-r--r--chrome/test/automation/tab_proxy.h2
-rw-r--r--chrome/test/data/default_plugin.html14
-rw-r--r--chrome/test/plugin/plugin_test.cpp2
11 files changed, 109 insertions, 3 deletions
diff --git a/chrome/browser/default_plugin_uitest.cc b/chrome/browser/default_plugin_uitest.cc
new file mode 100644
index 0000000..c6c5221
--- /dev/null
+++ b/chrome/browser/default_plugin_uitest.cc
@@ -0,0 +1,33 @@
+// 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 "base/basictypes.h"
+#include "base/file_path.h"
+#include "build/build_config.h"
+#include "chrome/test/automation/tab_proxy.h"
+#include "chrome/test/ui/ui_test.h"
+#include "net/base/net_util.h"
+
+class DefaultPluginUITest : public UITest {
+ public:
+ DefaultPluginUITest() {
+ dom_automation_enabled_ = true;
+ }
+};
+
+TEST_F(DefaultPluginUITest, DefaultPluginLoadTest) {
+ // Open page with default plugin.
+ FilePath test_file(test_data_directory_);
+ test_file = test_file.AppendASCII("default_plugin.html");
+ NavigateToURL(net::FilePathToFileURL(test_file));
+
+ // Check that the default plugin was loaded. It executes a bit of javascript
+ // in the HTML file which replaces the innerHTML of div |result| with "DONE".
+ scoped_refptr<TabProxy> tab(GetActiveTab());
+ std::wstring out;
+ ASSERT_TRUE(tab->ExecuteAndExtractString(L"",
+ L"domAutomationController.send("
+ L"document.getElementById('result').innerHTML)", &out));
+ ASSERT_EQ(L"DONE", out);
+}
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc
index 37e3d2d..165ca52 100644
--- a/chrome/browser/plugin_service.cc
+++ b/chrome/browser/plugin_service.cc
@@ -23,6 +23,7 @@
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/default_plugin.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/gpu_plugin.h"
#include "chrome/common/logging_chrome.h"
@@ -159,6 +160,8 @@ PluginService::PluginService()
if (!path.empty())
NPAPI::PluginList::Singleton()->AddExtraPluginPath(path);
+ chrome::RegisterInternalDefaultPlugin();
+
// Register the internal Flash and PDF, if available.
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableInternalFlash) &&
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 064775a..0a06020 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -134,6 +134,7 @@
'../third_party/sqlite/sqlite.gyp:sqlite',
'../third_party/zlib/zlib.gyp:zlib',
'../third_party/npapi/npapi.gyp:npapi',
+ '../webkit/default_plugin/default_plugin.gyp:default_plugin',
'../webkit/support/webkit_support.gyp:appcache',
'../webkit/support/webkit_support.gyp:glue',
],
@@ -191,9 +192,11 @@
'common/database_util.h',
'common/db_message_filter.cc',
'common/db_message_filter.h',
- 'common/dom_storage_common.h',
+ 'common/default_plugin.cc',
+ 'common/default_plugin.h',
'common/deprecated/event_sys-inl.h',
'common/deprecated/event_sys.h',
+ 'common/dom_storage_common.h',
'common/font_loader_mac.h',
'common/font_loader_mac.mm',
'common/gears_api.h',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index e87f53e..a741c70 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -286,6 +286,7 @@
# run time dependencies
'../third_party/ppapi/ppapi.gyp:ppapi_tests',
'../webkit/webkit.gyp:npapi_layout_test_plugin',
+ '../webkit/default_plugin/default_plugin.gyp:default_plugin',
],
'include_dirs': [
'..',
@@ -300,6 +301,7 @@
'browser/download/download_uitest.cc',
'browser/download/save_page_uitest.cc',
'browser/errorpage_uitest.cc',
+ 'browser/default_plugin_uitest.cc',
'browser/extensions/extension_uitest.cc',
'browser/history/multipart_uitest.cc',
'browser/history/redirect_uitest.cc',
diff --git a/chrome/common/DEPS b/chrome/common/DEPS
index 8a41106..c3db484 100644
--- a/chrome/common/DEPS
+++ b/chrome/common/DEPS
@@ -5,6 +5,7 @@ include_rules = [
"+media/audio",
"+sandbox/src",
"+skia/include",
+ "+webkit/default_plugin",
"+webkit/glue",
# Other libraries.
diff --git a/chrome/common/default_plugin.cc b/chrome/common/default_plugin.cc
new file mode 100644
index 0000000..2dc8488
--- /dev/null
+++ b/chrome/common/default_plugin.cc
@@ -0,0 +1,33 @@
+// 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 "chrome/common/default_plugin.h"
+
+#include "webkit/glue/plugins/plugin_list.h"
+#include "webkit/default_plugin/plugin_main.h"
+
+namespace chrome {
+
+void RegisterInternalDefaultPlugin() {
+ const NPAPI::PluginVersionInfo default_plugin = {
+ FilePath(kDefaultPluginLibraryName),
+ L"Default Plug-in",
+ L"Provides functionality for installing third-party plug-ins",
+ L"1",
+ L"*",
+ L"",
+ L"",
+ {
+#if !defined(OS_POSIX) || defined(OS_MACOSX)
+ default_plugin::NP_GetEntryPoints,
+#endif
+ default_plugin::NP_Initialize,
+ default_plugin::NP_Shutdown
+ }
+ };
+
+ NPAPI::PluginList::Singleton()->RegisterInternalPlugin(default_plugin);
+}
+
+} // namespace chrome
diff --git a/chrome/common/default_plugin.h b/chrome/common/default_plugin.h
new file mode 100644
index 0000000..e3394e8
--- /dev/null
+++ b/chrome/common/default_plugin.h
@@ -0,0 +1,15 @@
+// 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 CHROME_COMMON_DEFAULT_PLUGIN_H_
+#define CHROME_COMMON_DEFAULT_PLUGIN_H_
+
+namespace chrome {
+
+// Register the default plugin as an internal plugin in the PluginList.
+void RegisterInternalDefaultPlugin();
+
+} // namespace chrome
+
+#endif // CHROME_COMMON_DEFAULT_PLUGIN_H_
diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc
index 070cfd5..f2da7e3 100644
--- a/chrome/plugin/plugin_main.cc
+++ b/chrome/plugin/plugin_main.cc
@@ -15,6 +15,7 @@
#include "chrome/common/child_process.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/default_plugin.h"
#include "chrome/common/gpu_plugin.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/main_function_params.h"
@@ -128,6 +129,7 @@ int PluginMain(const MainFunctionParams& parameters) {
}
#endif
+ chrome::RegisterInternalDefaultPlugin();
chrome::RegisterInternalGPUPlugin();
MessageLoop::current()->Run();
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index fbe2573..adcacf9 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -78,6 +78,8 @@ class TabProxy : public AutomationResourceProxy,
// will result in value = "string"
// jscript = "window.domAutomationController.send(24);"
// will result in value = 24
+ // NOTE: If this is called from a ui test, |dom_automation_enabled_| must be
+ // set to true for these functions to work.
bool ExecuteAndExtractString(const std::wstring& frame_xpath,
const std::wstring& jscript,
std::wstring* value) WARN_UNUSED_RESULT;
diff --git a/chrome/test/data/default_plugin.html b/chrome/test/data/default_plugin.html
new file mode 100644
index 0000000..aea5b8e
--- /dev/null
+++ b/chrome/test/data/default_plugin.html
@@ -0,0 +1,14 @@
+<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>
diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp
index 16addb7..d8c81a5 100644
--- a/chrome/test/plugin/plugin_test.cpp
+++ b/chrome/test/plugin/plugin_test.cpp
@@ -42,8 +42,6 @@
#if defined(OS_WIN)
#include "base/registry.h"
-// TODO(port) ?
-#include "webkit/default_plugin/plugin_impl.h"
#endif
class PluginTest : public UITest {