diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-29 21:50:27 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-29 21:50:27 +0000 |
commit | 9a1c426f262f4fbf5a4bfbf89922abe175fe5e58 (patch) | |
tree | ed0cccff27ebe22e69e60a7100f276ce112124fb | |
parent | e974b3f372b31e7c9bf4bfb345df65740fc2076a (diff) | |
download | chromium_src-9a1c426f262f4fbf5a4bfbf89922abe175fe5e58.zip chromium_src-9a1c426f262f4fbf5a4bfbf89922abe175fe5e58.tar.gz chromium_src-9a1c426f262f4fbf5a4bfbf89922abe175fe5e58.tar.bz2 |
Add switch for specifying a directory to load plugins, so that test plugins can be loaded on the Mac without modifying the application bundle.
BUG=47305
TEST=Mac plugin tests still run. No PlugIns directory created in the app bundle.
Review URL: http://codereview.chromium.org/2814030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51174 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/plugin_service.cc | 6 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | chrome/test/ui/npapi_test_helper.cc | 20 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_list_mac.mm | 3 | ||||
-rw-r--r-- | webkit/tools/pepper_test_plugin/README | 6 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.gypi | 2 |
7 files changed, 24 insertions, 17 deletions
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index 466aa8f..02133ed 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -84,11 +84,15 @@ PluginService::PluginService() // Have the NPAPI plugin list search for Chrome plugins as well. ChromePluginLib::RegisterPluginsWithNPAPI(); - // Load the one specified on the command line as well. + + // Load any specified on the command line as well. const CommandLine* command_line = CommandLine::ForCurrentProcess(); FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin); if (!path.empty()) NPAPI::PluginList::Singleton()->AddExtraPluginPath(path); + path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); + if (!path.empty()) + NPAPI::PluginList::Singleton()->AddExtraPluginDir(path); chrome::RegisterInternalDefaultPlugin(); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 6941558..72e3aa8 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -537,6 +537,9 @@ const char kLoadExtension[] = "load-extension"; // Load an NPAPI plugin from the specified path. const char kLoadPlugin[] = "load-plugin"; +// Load NPAPI plugins from the specified directory. +const char kExtraPluginDir[] = "extra-plugin-dir"; + // Will filter log messages to show only the messages that are prefixed // with the specified value. See also kEnableLogging and kLoggingLevel. const char kLogFilterPrefix[] = "log-filter-prefix"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index d8c1e12..239734e 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -163,6 +163,7 @@ extern const char kInternalPepper[]; extern const char kJavaScriptFlags[]; extern const char kLoadExtension[]; extern const char kLoadPlugin[]; +extern const char kExtraPluginDir[]; extern const char kLogFilterPrefix[]; extern const char kLogPluginMessages[]; extern const char kLoggingLevel[]; diff --git a/chrome/test/ui/npapi_test_helper.cc b/chrome/test/ui/npapi_test_helper.cc index d5e24ad..18e71a0 100644 --- a/chrome/test/ui/npapi_test_helper.cc +++ b/chrome/test/ui/npapi_test_helper.cc @@ -14,6 +14,7 @@ #include "base/test/test_file_util.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" +#include "webkit/glue/plugins/plugin_list.h" #if defined(OS_WIN) static const char kNpapiTestPluginName[] = "npapi_test_plugin.dll"; @@ -45,6 +46,12 @@ void NPAPITesterBase::SetUp() { ASSERT_TRUE(file_util::CopyDirectory(plugin_src, test_plugin_path_, true)) << "Copy failed from " << plugin_src.value() << " to " << test_plugin_path_.value(); +#if defined(OS_MACOSX) + // The plugins directory isn't read by default on the Mac, so it needs to be + // explicitly registered. + launch_arguments_.AppendSwitchWithValue(switches::kExtraPluginDir, + plugins_directory.value()); +#endif UITest::SetUp(); } @@ -57,14 +64,7 @@ void NPAPITesterBase::TearDown() { } FilePath NPAPITesterBase::GetPluginsDirectory() { -#if defined(OS_MACOSX) - std::wstring plugin_subpath(chrome::kBrowserProcessExecutableName); - plugin_subpath.append(L".app/Contents/PlugIns"); - FilePath plugins_directory = browser_directory_.Append( - FilePath::FromWStringHack(plugin_subpath)); -#else FilePath plugins_directory = browser_directory_.AppendASCII("plugins"); -#endif return plugins_directory; } @@ -73,9 +73,9 @@ NPAPITester::NPAPITester() : NPAPITesterBase(kNpapiTestPluginName) { void NPAPITester::SetUp() { #if defined(OS_MACOSX) - // On Windows and Linux, the layout plugin is copied into plugins/ as part of - // its build process; we can't do the equivalent on the Mac since Chromium - // doesn't exist during the Test Shell build. + // TODO(stuartmorgan): Remove this whole subclass once the WebKit build is + // changed to copy the plugin into a plugins directory next to the app as + // is done on Linux and Windows. FilePath layout_src = browser_directory_.AppendASCII(kLayoutPluginName); ASSERT_TRUE(file_util::PathExists(layout_src)); FilePath plugins_directory = GetPluginsDirectory(); diff --git a/webkit/glue/plugins/plugin_list_mac.mm b/webkit/glue/plugins/plugin_list_mac.mm index e568c41..16bde9d 100644 --- a/webkit/glue/plugins/plugin_list_mac.mm +++ b/webkit/glue/plugins/plugin_list_mac.mm @@ -69,7 +69,8 @@ void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { // Load from the machine-wide area GetPluginCommonDirectory(plugin_dirs, false); - // Load any bundled plugins + // Load any bundled plugins (deprecated) + // TODO(stuartmorgan): Remove this once it's not used in TestShell. GetPluginPrivateDirectory(plugin_dirs); } diff --git a/webkit/tools/pepper_test_plugin/README b/webkit/tools/pepper_test_plugin/README index 76062bd..6184b5e 100644 --- a/webkit/tools/pepper_test_plugin/README +++ b/webkit/tools/pepper_test_plugin/README @@ -33,10 +33,8 @@ When the Info panel comes up, add these arguments using the '+' button: # Add this to run Chromium as a single process. --single-process -Before you run the executable, copy the plugin into the Chromium.app bundle, -into Chromium.app/Contents/PlugIns. You might have to create the PlugIns -directory first. +Before you run the executable, copy the plugin into ~/Library/Internet Plug-Ins. +You might have to create the directory first. Once all this is set up, you can use "Build and run" (or cmd-r) in Xcode to run the pepper plugin test. - diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi index e27d875..b620db8 100644 --- a/webkit/tools/test_shell/test_shell.gypi +++ b/webkit/tools/test_shell/test_shell.gypi @@ -333,7 +333,7 @@ ], 'copies': [ { - 'destination': '<(PRODUCT_DIR)/TestShell.app/Contents/PlugIns/', + 'destination': '<(PRODUCT_DIR)/plugins/', 'files': [ '<(PRODUCT_DIR)/TestNetscapePlugIn.plugin/', ], |