Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2433)

Unified Diff: chrome/browser/extensions/extension_nacl_browsertest.cc

Issue 12612011: Allow NaCl plugin to be loaded from hosted app URLs. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/renderer/chrome_content_renderer_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_nacl_browsertest.cc
===================================================================
--- chrome/browser/extensions/extension_nacl_browsertest.cc (revision 187306)
+++ chrome/browser/extensions/extension_nacl_browsertest.cc (working copy)
@@ -21,6 +21,7 @@
#include "content/public/browser/plugin_service.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
+#include "net/base/mock_host_resolver.h"
#include "webkit/plugins/webplugininfo.h"
using content::PluginService;
@@ -46,8 +47,8 @@
INSTALL_TYPE_NON_WEBSTORE,
};
- const Extension* InstallExtension(InstallType install_type) {
- base::FilePath file_path = test_data_dir_.AppendASCII("native_client");
+ const Extension* InstallExtension(const base::FilePath& file_path,
+ InstallType install_type) {
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
const Extension* extension = NULL;
@@ -84,6 +85,17 @@
return extension;
}
+ const Extension* InstallExtension(InstallType install_type) {
+ base::FilePath file_path = test_data_dir_.AppendASCII("native_client");
+ return InstallExtension(file_path, install_type);
+ }
+
+ const Extension* InstallHostedApp() {
+ base::FilePath file_path = test_data_dir_.AppendASCII(
+ "native_client_hosted_app");
+ return InstallExtension(file_path, INSTALL_TYPE_FROM_WEBSTORE);
+ }
+
bool IsNaClPluginLoaded() {
base::FilePath path;
if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) {
@@ -170,4 +182,21 @@
test_server()->GetURL("files/extensions/native_client/test.html"), false);
}
+// Test that NaCl plugin isn't blocked for hosted app URLs.
+IN_PROC_BROWSER_TEST_F(NaClExtensionTest, HostedApp) {
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(test_server()->Start());
+
+ GURL url = test_server()->GetURL("files/extensions/native_client/test.html");
+ GURL::Replacements replace_host;
+ std::string host_str("localhost");
+ replace_host.SetHostStr(host_str);
+ replace_host.ClearPort();
+ url = url.ReplaceComponents(replace_host);
+
+ const Extension* extension = InstallHostedApp();
+ ASSERT_TRUE(extension);
+ CheckPluginsCreated(url, true);
+}
+
} // namespace
« no previous file with comments | « no previous file | chrome/renderer/chrome_content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698