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

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

Issue 1588533002: Never connect a port to the same frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 "page_in_main_frame.html")) << message_; 155 "page_in_main_frame.html")) << message_;
156 } 156 }
157 157
158 // Tests that messages with event_urls are only passed to extensions with 158 // Tests that messages with event_urls are only passed to extensions with
159 // appropriate permissions. 159 // appropriate permissions.
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.
166 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MessagingBackgroundOnly) {
167 ASSERT_TRUE(RunExtensionTest("messaging/background_only")) << message_;
168 }
169
165 // Tests connecting from a panel to its extension. 170 // Tests connecting from a panel to its extension.
166 class PanelMessagingTest : public ExtensionApiTest { 171 class PanelMessagingTest : public ExtensionApiTest {
167 void SetUpCommandLine(base::CommandLine* command_line) override { 172 void SetUpCommandLine(base::CommandLine* command_line) override {
168 ExtensionApiTest::SetUpCommandLine(command_line); 173 ExtensionApiTest::SetUpCommandLine(command_line);
169 command_line->AppendSwitch(switches::kEnablePanels); 174 command_line->AppendSwitch(switches::kEnablePanels);
170 } 175 }
171 }; 176 };
172 177
173 IN_PROC_BROWSER_TEST_F(PanelMessagingTest, MessagingPanel) { 178 IN_PROC_BROWSER_TEST_F(PanelMessagingTest, MessagingPanel) {
174 ASSERT_TRUE(RunExtensionTest("messaging/connect_panel")) << message_; 179 ASSERT_TRUE(RunExtensionTest("messaging/connect_panel")) << message_;
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); 1229 ui_test_utils::NavigateToURL(browser(), chromium_org_url());
1225 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR, 1230 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR,
1226 CanConnectAndSendMessagesToMainFrame(invalid.get())); 1231 CanConnectAndSendMessagesToMainFrame(invalid.get()));
1227 } 1232 }
1228 1233
1229 #endif // !defined(OS_WIN) - http://crbug.com/350517. 1234 #endif // !defined(OS_WIN) - http://crbug.com/350517.
1230 1235
1231 } // namespace 1236 } // namespace
1232 1237
1233 }; // namespace extensions 1238 }; // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698