diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-28 02:41:56 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-28 02:41:56 +0000 |
commit | 54422f4bf16c6d15b9cbf760ff006fbc57c0df7e (patch) | |
tree | 50b97c552ad2994ad4902cffe2dbeaeee1938022 /chrome/test/plugin | |
parent | 616f9cd2cd3e43d95c8d90fe01dc4241b2a5b08c (diff) | |
download | chromium_src-54422f4bf16c6d15b9cbf760ff006fbc57c0df7e.zip chromium_src-54422f4bf16c6d15b9cbf760ff006fbc57c0df7e.tar.gz chromium_src-54422f4bf16c6d15b9cbf760ff006fbc57c0df7e.tar.bz2 |
It looks like the Chrome NPAPI plugin installer has been broken since we first updated chrome webkit after 1.0 shipped.
Basically in the 1.0 branch when the plugin was instantiated in its instantiation it would get the mime type along with the list of other arguments. If an object tag was specified with the classid, it would get mapped to the mime type. With the webkit merge the classs id is passed in along with the mime type.
The plugin installer thinks that this is an activex installation on receiving a valid class id and
and ends up checking if it is a white listed classid, etc.
All this code will be taken out along with the activex shim in the near future. For now we take this code path only if we don't have a valid mime type.
This fixes http://code.google.com/p/chromium/issues/detail?id=8584
Added a plugin test for the argument parsing functionality in the default plugin. I changed the ParseInstantiationArguments function in the
plugin installer to a static function to be able to unit test this.
Bug=8584
Review URL: http://codereview.chromium.org/42684
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12733 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/plugin')
-rw-r--r-- | chrome/test/plugin/plugin_test.cpp | 85 |
1 files changed, 84 insertions, 1 deletions
diff --git a/chrome/test/plugin/plugin_test.cpp b/chrome/test/plugin/plugin_test.cpp index 54d9b17..4907a9a 100644 --- a/chrome/test/plugin/plugin_test.cpp +++ b/chrome/test/plugin/plugin_test.cpp @@ -1,4 +1,4 @@ -// Copyright 2008, Google Inc. +// Copyright 2008-2009, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -54,6 +54,8 @@ #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/ui/ui_test.h" #include "net/base/net_util.h" +#include "third_party/npapi/bindings/npapi.h" +#include "webkit/default_plugin/plugin_impl.h" #include "webkit/glue/plugins/plugin_constants_win.h" #include "webkit/glue/plugins/plugin_list.h" @@ -222,3 +224,84 @@ TEST_F(ActiveXTest, CustomScripting) { TestActiveX(L"activex_custom_scripting.html", kShortWaitTimeout, true); } +// The default plugin tests defined below rely on the following webkit +// functions and the IsPluginProcess function which is defined in the global +// namespace. Stubbed these out for now. +namespace webkit_glue { + +bool DownloadUrl(const std::string& url, HWND caller_window) { + return false; +} + +bool GetPluginFinderURL(std::string* plugin_finder_url) { + return true; +} + +} // namespace webkit_glue + +bool IsPluginProcess() { + return false; +} + +TEST_F(PluginTest, DefaultPluginParsingTest) { + PluginInstallerImpl plugin_installer(NP_EMBED); + NPP_t plugin_instance = {0}; + + char *arg_names[] = { + "classid", + "codebase" + }; + + char *arg_values[] = { + "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab", + }; + + bool is_activex = false; + std::string raw_activex_clsid; + std::string activex_clsid; + std::string activex_codebase; + std::string plugin_download_url; + std::string plugin_finder_url; + + ASSERT_TRUE(PluginInstallerImpl::ParseInstantiationArguments( + "application/x-shockwave-flash", + &plugin_instance, + arraysize(arg_names), + arg_names, + arg_values, + &raw_activex_clsid, + &is_activex, + &activex_clsid, + &activex_codebase, + &plugin_download_url, + &plugin_finder_url)); + + EXPECT_EQ(is_activex, false); + + + ASSERT_TRUE(PluginInstallerImpl::ParseInstantiationArguments( + "", + &plugin_instance, + arraysize(arg_names), + arg_names, + arg_values, + &raw_activex_clsid, + &is_activex, + &activex_clsid, + &activex_codebase, + &plugin_download_url, + &plugin_finder_url)); + + EXPECT_EQ(is_activex, true); + EXPECT_EQ( + activex_codebase, + "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"); + + EXPECT_EQ(activex_clsid, "{D27CDB6E-AE6D-11cf-96B8-444553540000}"); + EXPECT_EQ(raw_activex_clsid, "D27CDB6E-AE6D-11cf-96B8-444553540000"); + + EXPECT_EQ( + activex_codebase, + "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"); +} |