OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/base64.h" | 5 #include "base/base64.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingExternal) { | 116 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingExternal) { |
117 ASSERT_TRUE(LoadExtension( | 117 ASSERT_TRUE(LoadExtension( |
118 test_data_dir_.AppendASCII("..").AppendASCII("good") | 118 test_data_dir_.AppendASCII("..").AppendASCII("good") |
119 .AppendASCII("Extensions") | 119 .AppendASCII("Extensions") |
120 .AppendASCII("bjafgdebaacbbbecmhlhpofkepfkgcpa") | 120 .AppendASCII("bjafgdebaacbbbecmhlhpofkepfkgcpa") |
121 .AppendASCII("1.0"))); | 121 .AppendASCII("1.0"))); |
122 | 122 |
123 ASSERT_TRUE(RunExtensionTest("messaging/connect_external")) << message_; | 123 ASSERT_TRUE(RunExtensionTest("messaging/connect_external")) << message_; |
124 } | 124 } |
125 | 125 |
| 126 // Tests that a content script can exchange messages with a tab even if there is |
| 127 // no background page. |
| 128 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingNoBackground) { |
| 129 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 130 ASSERT_TRUE(RunExtensionSubtest("messaging/connect_nobackground", |
| 131 "page_in_main_frame.html")) << message_; |
| 132 } |
| 133 |
126 // Tests that messages with event_urls are only passed to extensions with | 134 // Tests that messages with event_urls are only passed to extensions with |
127 // appropriate permissions. | 135 // appropriate permissions. |
128 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingEventURL) { | 136 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingEventURL) { |
129 MessageSender sender; | 137 MessageSender sender; |
130 ASSERT_TRUE(RunExtensionTest("messaging/event_url")) << message_; | 138 ASSERT_TRUE(RunExtensionTest("messaging/event_url")) << message_; |
131 } | 139 } |
132 | 140 |
133 // Tests connecting from a panel to its extension. | 141 // Tests connecting from a panel to its extension. |
134 class PanelMessagingTest : public ExtensionApiTest { | 142 class PanelMessagingTest : public ExtensionApiTest { |
135 void SetUpCommandLine(base::CommandLine* command_line) override { | 143 void SetUpCommandLine(base::CommandLine* command_line) override { |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); | 1200 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); |
1193 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR, | 1201 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR, |
1194 CanConnectAndSendMessagesToMainFrame(invalid.get())); | 1202 CanConnectAndSendMessagesToMainFrame(invalid.get())); |
1195 } | 1203 } |
1196 | 1204 |
1197 #endif // !defined(OS_WIN) - http://crbug.com/350517. | 1205 #endif // !defined(OS_WIN) - http://crbug.com/350517. |
1198 | 1206 |
1199 } // namespace | 1207 } // namespace |
1200 | 1208 |
1201 }; // namespace extensions | 1209 }; // namespace extensions |
OLD | NEW |