Chromium Code Reviews| 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 |