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

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

Issue 114803007: Register bindings for blessed web contexts (aka hosted app contexts) by hand (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, small change Created 6 years, 11 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
Index: chrome/browser/extensions/extension_messages_apitest.cc
diff --git a/chrome/browser/extensions/extension_messages_apitest.cc b/chrome/browser/extensions/extension_messages_apitest.cc
index dc4bd163f1fe4f57a1afb0fb3babf0cb5cf691d9..b1c91e40ffddf795fa151f2f278f00b09451507d 100644
--- a/chrome/browser/extensions/extension_messages_apitest.cc
+++ b/chrome/browser/extensions/extension_messages_apitest.cc
@@ -226,7 +226,6 @@ class ExternallyConnectableMessagingTest : public ExtensionApiTest {
"onMessage",
"onMessageExternal",
"onRestartRequired",
- "id",
Jeffrey Yasskin 2014/01/08 23:42:03 Why is "id" dropping out of this list?
not at google - send to devlin 2014/01/09 00:56:16 runtime.id is available to hosted apps, which fail
Jeffrey Yasskin 2014/01/09 01:30:00 Please update the comment to admit that, so we're
not at google - send to devlin 2014/01/09 18:06:48 Done.
};
// Turn the array into a JS array, which effectively gets eval()ed.
@@ -313,6 +312,25 @@ class ExternallyConnectableMessagingTest : public ExtensionApiTest {
connectable_with_tls_channel_id_manifest());
}
+ const Extension* LoadChromiumHostedApp() {
+ const Extension* hosted_app =
+ LoadExtensionIntoDir(&hosted_app_dir_, base::StringPrintf(
+ "{"
+ " \"name\": \"chromium_hosted_app\","
+ " \"version\": \"1.0\","
+ " \"manifest_version\": 2,"
+ " \"app\": {"
+ " \"urls\": [\"%s\"],"
+ " \"launch\": {"
+ " \"web_url\": \"%s\""
+ " }\n"
+ " }\n"
+ "}", chromium_org_url().spec().c_str(),
+ chromium_org_url().spec().c_str()));
+ CHECK(hosted_app);
+ return hosted_app;
+ }
+
void InitializeTestServer() {
base::FilePath test_data;
EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data));
@@ -392,6 +410,7 @@ class ExternallyConnectableMessagingTest : public ExtensionApiTest {
TestExtensionDir web_connectable_dir_;
TestExtensionDir not_connectable_dir_;
TestExtensionDir tls_channel_id_connectable_dir_;
+ TestExtensionDir hosted_app_dir_;
};
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, NotInstalled) {
@@ -896,5 +915,23 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingUserGesture) {
"});", receiver->id().c_str())));
}
+// Tests that a hosted app on a connectable site doesn't interfere with the
+// connectability of that site.
+IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, HostedAppOnWebsite) {
+ InitializeTestServer();
+
+ LoadChromiumHostedApp();
+
+ // The presence of the hosted app shouldn't give the ability to send messages.
+ ui_test_utils::NavigateToURL(browser(), chromium_org_url());
+ EXPECT_EQ(NAMESPACE_NOT_DEFINED, CanConnectAndSendMessages(""));
+ EXPECT_FALSE(AreAnyNonWebApisDefined());
+
+ // Once a connectable extension is installed, it should.
+ const Extension* extension = LoadChromiumConnectableExtension();
+ EXPECT_EQ(OK, CanConnectAndSendMessages(extension->id()));
+ EXPECT_FALSE(AreAnyNonWebApisDefined());
+}
+
} // namespace
}; // namespace extensions
« no previous file with comments | « no previous file | chrome/renderer/extensions/chrome_v8_context.cc » ('j') | chrome/renderer/extensions/chrome_v8_context.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698