diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 19:26:10 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-08 19:26:10 +0000 |
commit | a3bcaa90d1b22148c6e883044090f5182c6333f3 (patch) | |
tree | cec24af18d7002cb1893d9d0a7575fd699ec90c4 /chrome/browser/extensions | |
parent | bbd53efc860e7a2fa2414c1dfeda37d1945391ea (diff) | |
download | chromium_src-a3bcaa90d1b22148c6e883044090f5182c6333f3.zip chromium_src-a3bcaa90d1b22148c6e883044090f5182c6333f3.tar.gz chromium_src-a3bcaa90d1b22148c6e883044090f5182c6333f3.tar.bz2 |
Fix a regression that allows private extension NPAPI plugins to be loaded
by public web pages.
BUG=72214
TEST=no
Review URL: http://codereview.chromium.org/6246161
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/extension_browsertests_misc.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_browsertests_misc.cc b/chrome/browser/extensions/extension_browsertests_misc.cc index 63d0402..4287111 100644 --- a/chrome/browser/extensions/extension_browsertests_misc.cc +++ b/chrome/browser/extensions/extension_browsertests_misc.cc @@ -755,6 +755,41 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) { EXPECT_TRUE(result); } +#if defined(OS_WIN) || defined(OS_LINUX) +#define MAYBE_PluginPrivate PluginPrivate +#else +// TODO(mpcomplete): http://crbug.com/29900 need cross platform plugin support. +#define MAYBE_PluginPrivate DISABLED_PluginPrivate +#endif + +// Tests that private extension plugins are only visible to the extension. +IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginPrivate) { + FilePath extension_dir = + test_data_dir_.AppendASCII("uitest").AppendASCII("plugins_private"); + + ExtensionService* service = browser()->profile()->GetExtensionService(); + const size_t size_before = service->extensions()->size(); + ASSERT_TRUE(LoadExtension(extension_dir)); + EXPECT_EQ(size_before + 1, service->extensions()->size()); + + // Load the test page through the extension URL, and the plugin should work. + const Extension* extension = service->extensions()->back(); + ui_test_utils::NavigateToURL(browser(), + extension->GetResourceURL("test.html")); + TabContents* tab = browser()->GetSelectedTabContents(); + bool result = false; + ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( + tab->render_view_host(), L"", L"testPluginWorks()", &result)); + EXPECT_TRUE(result); + + // Now load it through a file URL. The plugin should not load. + ui_test_utils::NavigateToURL(browser(), + net::FilePathToFileURL(extension_dir.AppendASCII("test.html"))); + ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( + tab->render_view_host(), L"", L"testPluginWorks()", &result)); + EXPECT_FALSE(result); +} + // Used to simulate a click on the first button named 'Options'. static const wchar_t* jscript_click_option_button = L"(function() { " |