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

Side by Side Diff: chrome/browser/extensions/extension_messages_apitest.cc

Issue 1629013002: Allow a main interstitial frame to act as an ExtensionMessagePort opener (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extension-message-port-onDisconnect-580882
Patch Set: It's 2016 Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingEventURL) { 160 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingEventURL) {
161 MessageSender sender; 161 MessageSender sender;
162 ASSERT_TRUE(RunExtensionTest("messaging/event_url")) << message_; 162 ASSERT_TRUE(RunExtensionTest("messaging/event_url")) << message_;
163 } 163 }
164 164
165 // Tests that messages cannot be received from the same frame. 165 // Tests that messages cannot be received from the same frame.
166 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingBackgroundOnly) { 166 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingBackgroundOnly) {
167 ASSERT_TRUE(RunExtensionTest("messaging/background_only")) << message_; 167 ASSERT_TRUE(RunExtensionTest("messaging/background_only")) << message_;
168 } 168 }
169 169
170 // Tests whether an extension in an interstitial page can send messages to the
171 // background.
Charlie Reis 2016/01/26 23:58:27 nit: background page.
172 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingInterstitial) {
173 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
174 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
175 ASSERT_TRUE(https_server.Start());
176
177 ASSERT_TRUE(RunExtensionSubtest("messaging/interstitial_component",
178 https_server.base_url().spec(),
179 kFlagLoadAsComponent)) << message_;
180 }
181
170 // Tests connecting from a panel to its extension. 182 // Tests connecting from a panel to its extension.
171 class PanelMessagingTest : public ExtensionApiTest { 183 class PanelMessagingTest : public ExtensionApiTest {
172 void SetUpCommandLine(base::CommandLine* command_line) override { 184 void SetUpCommandLine(base::CommandLine* command_line) override {
173 ExtensionApiTest::SetUpCommandLine(command_line); 185 ExtensionApiTest::SetUpCommandLine(command_line);
174 command_line->AppendSwitch(switches::kEnablePanels); 186 command_line->AppendSwitch(switches::kEnablePanels);
175 } 187 }
176 }; 188 };
177 189
178 IN_PROC_BROWSER_TEST_F(PanelMessagingTest, MessagingPanel) { 190 IN_PROC_BROWSER_TEST_F(PanelMessagingTest, MessagingPanel) {
179 ASSERT_TRUE(RunExtensionTest("messaging/connect_panel")) << message_; 191 ASSERT_TRUE(RunExtensionTest("messaging/connect_panel")) << message_;
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); 1241 ui_test_utils::NavigateToURL(browser(), chromium_org_url());
1230 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR, 1242 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR,
1231 CanConnectAndSendMessagesToMainFrame(invalid.get())); 1243 CanConnectAndSendMessagesToMainFrame(invalid.get()));
1232 } 1244 }
1233 1245
1234 #endif // !defined(OS_WIN) - http://crbug.com/350517. 1246 #endif // !defined(OS_WIN) - http://crbug.com/350517.
1235 1247
1236 } // namespace 1248 } // namespace
1237 1249
1238 }; // namespace extensions 1250 }; // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698