blob: 9fa96e1951b325e4f1b3b6dccc7910c1134fc8a5 [file] [log] [blame]
[email protected]fad73672012-06-15 23:26:061// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]c80b8ee2011-12-03 04:26:522// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Contains holistic tests of the bindings infrastructure
6
Gabriel Charette078e3662017-08-28 22:59:047#include "base/run_loop.h"
Devlin Cronina3fe3d602017-11-22 04:47:438#include "base/test/scoped_feature_list.h"
[email protected]7eef3942013-08-14 02:53:499#include "chrome/browser/extensions/api/permissions/permissions_api.h"
[email protected]c80b8ee2011-12-03 04:26:5210#include "chrome/browser/extensions/extension_apitest.h"
Devlin Cronind2389082018-08-14 01:53:2611#include "chrome/browser/sessions/session_tab_helper.h"
[email protected]fad73672012-06-15 23:26:0612#include "chrome/browser/ui/browser.h"
Devlin Cronind2389082018-08-14 01:53:2613#include "chrome/browser/ui/browser_tabstrip.h"
rdevlin.cronin83a4b3a2015-10-28 21:43:5814#include "chrome/browser/ui/tabs/tab_strip_model.h"
asargent79b64c32016-08-04 17:17:1415#include "chrome/common/chrome_switches.h"
rdevlin.cronin83a4b3a2015-10-28 21:43:5816#include "chrome/test/base/ui_test_utils.h"
jochen7923c2a2015-07-14 10:04:4517#include "content/public/browser/browser_thread.h"
Devlin Croninb15c4f4e2017-12-15 21:20:1118#include "content/public/browser/render_frame_host.h"
Devlin Cronine80e6fc12019-02-05 00:44:2319#include "content/public/browser/render_view_host.h"
20#include "content/public/common/content_features.h"
[email protected]7d478cb2012-07-24 17:19:4221#include "content/public/test/browser_test_utils.h"
Devlin Cronind900688a2019-02-01 01:36:1122#include "content/public/test/test_navigation_observer.h"
Devlin Cronind2389082018-08-14 01:53:2623#include "extensions/browser/event_router.h"
[email protected]22401dc2014-03-21 01:38:5724#include "extensions/browser/extension_host.h"
[email protected]98b6d942013-11-10 00:34:0725#include "extensions/browser/process_manager.h"
lfg910f2f92014-09-19 05:31:0926#include "extensions/test/extension_test_message_listener.h"
yoze8dc2f12014-09-09 23:16:3227#include "extensions/test/result_catcher.h"
Devlin Cronind2389082018-08-14 01:53:2628#include "extensions/test/test_extension_dir.h"
rdevlin.cronine6e20022017-06-13 18:23:4029#include "net/dns/mock_host_resolver.h"
rdevlin.cronin83a4b3a2015-10-28 21:43:5830#include "net/test/embedded_test_server/embedded_test_server.h"
Devlin Cronine80e6fc12019-02-05 00:44:2331#include "third_party/blink/public/platform/web_mouse_event.h"
[email protected]fad73672012-06-15 23:26:0632
[email protected]adafe5b2013-08-09 10:35:0433namespace extensions {
34namespace {
35
Devlin Cronine80e6fc12019-02-05 00:44:2336void MouseDownInWebContents(content::WebContents* web_contents) {
37 blink::WebMouseEvent mouse_event(
38 blink::WebInputEvent::kMouseDown, blink::WebInputEvent::kNoModifiers,
39 blink::WebInputEvent::GetStaticTimeStampForTests());
40 mouse_event.button = blink::WebMouseEvent::Button::kLeft;
41 mouse_event.SetPositionInWidget(10, 10);
42 mouse_event.click_count = 1;
43 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(
44 mouse_event);
45}
46
47void MouseUpInWebContents(content::WebContents* web_contents) {
48 blink::WebMouseEvent mouse_event(
49 blink::WebInputEvent::kMouseUp, blink::WebInputEvent::kNoModifiers,
50 blink::WebInputEvent::GetStaticTimeStampForTests());
51 mouse_event.button = blink::WebMouseEvent::Button::kLeft;
52 mouse_event.SetPositionInWidget(10, 10);
53 mouse_event.click_count = 1;
54 web_contents->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(
55 mouse_event);
56}
57
Devlin Cronin242d19d22019-03-12 18:08:4858class ExtensionBindingsApiTest : public ExtensionApiTest {
jochen7923c2a2015-07-14 10:04:4559 public:
Devlin Cronina3fe3d602017-11-22 04:47:4360 ExtensionBindingsApiTest() {}
61 ~ExtensionBindingsApiTest() override {}
62
jochen7923c2a2015-07-14 10:04:4563 void SetUpOnMainThread() override {
rdevlin.cronin17160cc62016-11-23 05:33:0864 ExtensionApiTest::SetUpOnMainThread();
rdevlin.cronine6e20022017-06-13 18:23:4065 host_resolver()->AddRule("*", "127.0.0.1");
66 ASSERT_TRUE(StartEmbeddedTestServer());
jochen7923c2a2015-07-14 10:04:4567 }
Devlin Cronina3fe3d602017-11-22 04:47:4368
69 private:
Devlin Cronina3fe3d602017-11-22 04:47:4370 DISALLOW_COPY_AND_ASSIGN(ExtensionBindingsApiTest);
jochen7923c2a2015-07-14 10:04:4571};
[email protected]adafe5b2013-08-09 10:35:0472
Devlin Cronin242d19d22019-03-12 18:08:4873IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
[email protected]7eef3942013-08-14 02:53:4974 UnavailableBindingsNeverRegistered) {
75 // Test will request the 'storage' permission.
76 PermissionsRequestFunction::SetIgnoreUserGestureForTests(true);
77 ASSERT_TRUE(RunExtensionTest(
78 "bindings/unavailable_bindings_never_registered")) << message_;
79}
80
Devlin Cronin242d19d22019-03-12 18:08:4881IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
[email protected]adafe5b2013-08-09 10:35:0482 ExceptionInHandlerShouldNotCrash) {
[email protected]c80b8ee2011-12-03 04:26:5283 ASSERT_TRUE(RunExtensionSubtest(
84 "bindings/exception_in_handler_should_not_crash",
85 "page.html")) << message_;
86}
[email protected]fad73672012-06-15 23:26:0687
88// Tests that an error raised during an async function still fires
[email protected]754ea8b72013-01-08 15:10:3189// the callback, but sets chrome.runtime.lastError.
Devlin Cronin242d19d22019-03-12 18:08:4890IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, LastError) {
[email protected]fad73672012-06-15 23:26:0691 ASSERT_TRUE(LoadExtension(
Devlin Croninc3a1e5072017-08-17 17:02:4992 test_data_dir_.AppendASCII("bindings").AppendASCII("last_error")));
[email protected]fad73672012-06-15 23:26:0693
94 // Get the ExtensionHost that is hosting our background page.
[email protected]98b6d942013-11-10 00:34:0795 extensions::ProcessManager* manager =
reillyg0ea3fa902014-10-28 15:30:2396 extensions::ProcessManager::Get(browser()->profile());
[email protected]3a1dc572012-07-31 22:25:1397 extensions::ExtensionHost* host = FindHostWithPath(manager, "/bg.html", 1);
[email protected]fad73672012-06-15 23:26:0698
99 bool result = false;
David Benjamin5a792652018-06-08 02:15:42100 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(host->host_contents(),
101 "testLastError()", &result));
[email protected]fad73672012-06-15 23:26:06102 EXPECT_TRUE(result);
103}
[email protected]52eafbd2013-04-03 04:43:19104
[email protected]adafe5b2013-08-09 10:35:04105// Regression test that we don't delete our own bindings with about:blank
106// iframes.
Devlin Cronin242d19d22019-03-12 18:08:48107IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, AboutBlankIframe) {
[email protected]adafe5b2013-08-09 10:35:04108 ResultCatcher catcher;
109 ExtensionTestMessageListener listener("load", true);
110
111 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("bindings")
112 .AppendASCII("about_blank_iframe")));
113
114 ASSERT_TRUE(listener.WaitUntilSatisfied());
115
116 const Extension* extension = LoadExtension(
117 test_data_dir_.AppendASCII("bindings")
118 .AppendASCII("internal_apis_not_on_chrome_object"));
119 ASSERT_TRUE(extension);
120 listener.Reply(extension->id());
121
122 ASSERT_TRUE(catcher.GetNextResult()) << message_;
123}
124
Devlin Cronin242d19d22019-03-12 18:08:48125IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
[email protected]adafe5b2013-08-09 10:35:04126 InternalAPIsNotOnChromeObject) {
[email protected]52eafbd2013-04-03 04:43:19127 ASSERT_TRUE(RunExtensionSubtest(
128 "bindings/internal_apis_not_on_chrome_object",
129 "page.html")) << message_;
130}
[email protected]adafe5b2013-08-09 10:35:04131
[email protected]fc034482013-08-09 20:25:14132// Tests that we don't override events when bindings are re-injected.
133// Regression test for http://crbug.com/269149.
rpaquay96bf3b7d2014-11-26 00:19:08134// Regression test for http://crbug.com/436593.
Henrik Grunell6b7d9db2017-06-14 10:27:20135// Flaky on Mac. http://crbug.com/733064.
Giovanni Ortuño Urquidi7ce215452017-06-14 03:34:08136#if defined(OS_MACOSX)
137#define MAYBE_EventOverriding DISABLED_EventOverriding
138#else
139#define MAYBE_EventOverriding EventOverriding
140#endif
Devlin Cronin242d19d22019-03-12 18:08:48141IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, MAYBE_EventOverriding) {
[email protected]fc034482013-08-09 20:25:14142 ASSERT_TRUE(RunExtensionTest("bindings/event_overriding")) << message_;
rdevlin.cronind734f682017-06-13 21:23:11143 // The extension test removes a window and, during window removal, sends the
144 // success message. Make sure we flush all pending tasks.
145 base::RunLoop().RunUntilIdle();
[email protected]fc034482013-08-09 20:25:14146}
147
kalman1bd5b182015-01-13 19:01:18148// Tests the effectiveness of the 'nocompile' feature file property.
149// Regression test for http://crbug.com/356133.
Devlin Cronin242d19d22019-03-12 18:08:48150IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, Nocompile) {
kalman1bd5b182015-01-13 19:01:18151 ASSERT_TRUE(RunExtensionSubtest("bindings/nocompile", "page.html"))
152 << message_;
153}
154
Devlin Cronin242d19d22019-03-12 18:08:48155IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, ApiEnums) {
rdevlin.cronin2ba3c88d2015-03-03 01:18:22156 ASSERT_TRUE(RunExtensionTest("bindings/api_enums")) << message_;
Nico Weber42c88d62019-02-11 03:09:25157}
rdevlin.cronin2ba3c88d2015-03-03 01:18:22158
jochen7923c2a2015-07-14 10:04:45159// Regression test for http://crbug.com/504011 - proper access checks on
160// getModuleSystem().
Devlin Cronin242d19d22019-03-12 18:08:48161IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, ModuleSystem) {
jochen7923c2a2015-07-14 10:04:45162 ASSERT_TRUE(RunExtensionTest("bindings/module_system")) << message_;
163}
164
Devlin Cronin242d19d22019-03-12 18:08:48165IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, NoExportOverriding) {
rdevlin.cronin83a4b3a2015-10-28 21:43:58166 // We need to create runtime bindings in the web page. An extension that's
167 // externally connectable will do that for us.
168 ASSERT_TRUE(LoadExtension(
169 test_data_dir_.AppendASCII("bindings")
170 .AppendASCII("externally_connectable_everywhere")));
171
172 ui_test_utils::NavigateToURL(
173 browser(),
174 embedded_test_server()->GetURL(
175 "/extensions/api_test/bindings/override_exports.html"));
176
177 // See chrome/test/data/extensions/api_test/bindings/override_exports.html.
178 std::string result;
179 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
180 browser()->tab_strip_model()->GetActiveWebContents(),
181 "window.domAutomationController.send("
182 "document.getElementById('status').textContent.trim());",
183 &result));
184 EXPECT_EQ("success", result);
185}
186
Devlin Cronin242d19d22019-03-12 18:08:48187IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, NoGinDefineOverriding) {
rdevlin.cronin415b73b2015-11-13 01:14:47188 // We need to create runtime bindings in the web page. An extension that's
189 // externally connectable will do that for us.
190 ASSERT_TRUE(LoadExtension(
191 test_data_dir_.AppendASCII("bindings")
192 .AppendASCII("externally_connectable_everywhere")));
193
194 ui_test_utils::NavigateToURL(
195 browser(),
196 embedded_test_server()->GetURL(
197 "/extensions/api_test/bindings/override_gin_define.html"));
198 ASSERT_FALSE(
199 browser()->tab_strip_model()->GetActiveWebContents()->IsCrashed());
200
201 // See chrome/test/data/extensions/api_test/bindings/override_gin_define.html.
202 std::string result;
203 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
204 browser()->tab_strip_model()->GetActiveWebContents(),
205 "window.domAutomationController.send("
206 "document.getElementById('status').textContent.trim());",
207 &result));
208 EXPECT_EQ("success", result);
209}
210
Devlin Cronin242d19d22019-03-12 18:08:48211IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, HandlerFunctionTypeChecking) {
rdevlin.cronina5ecbc82015-10-29 23:41:29212 ui_test_utils::NavigateToURL(
213 browser(),
214 embedded_test_server()->GetURL(
215 "/extensions/api_test/bindings/handler_function_type_checking.html"));
216 content::WebContents* web_contents =
217 browser()->tab_strip_model()->GetActiveWebContents();
218 EXPECT_FALSE(web_contents->IsCrashed());
219 // See handler_function_type_checking.html.
220 std::string result;
221 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
222 web_contents,
223 "window.domAutomationController.send("
224 "document.getElementById('status').textContent.trim());",
225 &result));
226 EXPECT_EQ("success", result);
227}
228
Devlin Cronin242d19d22019-03-12 18:08:48229IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
rdevlin.cronin75b803b2016-03-02 00:13:47230 MoreNativeFunctionInterceptionTests) {
rdevlin.cronin75b803b2016-03-02 00:13:47231 // We need to create runtime bindings in the web page. An extension that's
232 // externally connectable will do that for us.
233 ASSERT_TRUE(
234 LoadExtension(test_data_dir_.AppendASCII("bindings")
235 .AppendASCII("externally_connectable_everywhere")));
236
237 ui_test_utils::NavigateToURL(
238 browser(),
239 embedded_test_server()->GetURL(
240 "/extensions/api_test/bindings/function_interceptions.html"));
241 content::WebContents* web_contents =
242 browser()->tab_strip_model()->GetActiveWebContents();
243 EXPECT_FALSE(web_contents->IsCrashed());
244 // See function_interceptions.html.
245 std::string result;
246 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
247 web_contents, "window.domAutomationController.send(window.testStatus);",
248 &result));
249 EXPECT_EQ("success", result);
250}
251
asargent79b64c32016-08-04 17:17:14252class FramesExtensionBindingsApiTest : public ExtensionBindingsApiTest {
253 public:
254 void SetUpCommandLine(base::CommandLine* command_line) override {
255 ExtensionBindingsApiTest::SetUpCommandLine(command_line);
Devlin Croninc3a1e5072017-08-17 17:02:49256 command_line->AppendSwitch(::switches::kDisablePopupBlocking);
asargent79b64c32016-08-04 17:17:14257 }
258};
259
260// This tests that web pages with iframes or child windows pointing at
261// chrome-extenison:// urls, both web_accessible and nonexistent pages, don't
262// get improper extensions bindings injected while they briefly still point at
263// about:blank and are still scriptable by their parent.
264//
265// The general idea is to load up 2 extensions, one which listens for external
266// messages ("receiver") and one which we'll try first faking messages from in
267// the web page's iframe, as well as actually send a message from later
268// ("sender").
Devlin Cronin242d19d22019-03-12 18:08:48269IN_PROC_BROWSER_TEST_F(FramesExtensionBindingsApiTest, FramesBeforeNavigation) {
asargent79b64c32016-08-04 17:17:14270 // Load the sender and receiver extensions, and make sure they are ready.
271 ExtensionTestMessageListener sender_ready("sender_ready", true);
272 const Extension* sender = LoadExtension(
273 test_data_dir_.AppendASCII("bindings").AppendASCII("message_sender"));
274 ASSERT_NE(nullptr, sender);
275 ASSERT_TRUE(sender_ready.WaitUntilSatisfied());
276
277 ExtensionTestMessageListener receiver_ready("receiver_ready", false);
278 const Extension* receiver =
279 LoadExtension(test_data_dir_.AppendASCII("bindings")
280 .AppendASCII("external_message_listener"));
281 ASSERT_NE(nullptr, receiver);
282 ASSERT_TRUE(receiver_ready.WaitUntilSatisfied());
283
284 // Load the web page which tries to impersonate the sender extension via
285 // scripting iframes/child windows before they finish navigating to pages
286 // within the sender extension.
asargent79b64c32016-08-04 17:17:14287 ui_test_utils::NavigateToURL(
288 browser(),
289 embedded_test_server()->GetURL(
290 "/extensions/api_test/bindings/frames_before_navigation.html"));
291
292 bool page_success = false;
293 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
294 browser()->tab_strip_model()->GetWebContentsAt(0), "getResult()",
295 &page_success));
296 EXPECT_TRUE(page_success);
297
298 // Reply to |sender|, causing it to send a message over to |receiver|, and
299 // then ask |receiver| for the total message count. It should be 1 since
300 // |receiver| should not have received any impersonated messages.
301 sender_ready.Reply(receiver->id());
302 int message_count = 0;
303 ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
304 ProcessManager::Get(profile())
305 ->GetBackgroundHostForExtension(receiver->id())
306 ->host_contents(),
307 "getMessageCountAfterReceivingRealSenderMessage()", &message_count));
308 EXPECT_EQ(1, message_count);
309}
310
Devlin Cronin242d19d22019-03-12 18:08:48311IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, TestFreezingChrome) {
rdevlin.cronin741da002017-04-24 20:27:41312 ui_test_utils::NavigateToURL(
313 browser(), embedded_test_server()->GetURL(
314 "/extensions/api_test/bindings/freeze.html"));
315 content::WebContents* web_contents =
316 browser()->tab_strip_model()->GetActiveWebContents();
317 ASSERT_FALSE(web_contents->IsCrashed());
318}
319
rdevlin.cronine6e20022017-06-13 18:23:40320// Tests interaction with event filter parsing.
Devlin Cronin242d19d22019-03-12 18:08:48321IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, TestEventFilterParsing) {
rdevlin.cronine6e20022017-06-13 18:23:40322 ExtensionTestMessageListener listener("ready", false);
323 ASSERT_TRUE(
324 LoadExtension(test_data_dir_.AppendASCII("bindings/event_filter")));
325 ASSERT_TRUE(listener.WaitUntilSatisfied());
326
327 ResultCatcher catcher;
328 ui_test_utils::NavigateToURL(
329 browser(), embedded_test_server()->GetURL("example.com", "/title1.html"));
330 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
331}
332
rdevlin.cronin350824d42017-06-16 14:47:35333// crbug.com/733337
Devlin Cronin242d19d22019-03-12 18:08:48334IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, ValidationInterception) {
rdevlin.cronin350824d42017-06-16 14:47:35335 // We need to create runtime bindings in the web page. An extension that's
336 // externally connectable will do that for us.
337 ASSERT_TRUE(
338 LoadExtension(test_data_dir_.AppendASCII("bindings")
339 .AppendASCII("externally_connectable_everywhere")));
340
341 content::WebContents* web_contents =
342 browser()->tab_strip_model()->GetActiveWebContents();
343 ui_test_utils::NavigateToURL(
344 browser(),
345 embedded_test_server()->GetURL(
346 "/extensions/api_test/bindings/validation_interception.html"));
347 content::WaitForLoadStop(web_contents);
348 ASSERT_FALSE(web_contents->IsCrashed());
349 bool caught = false;
350 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
351 web_contents, "domAutomationController.send(caught)", &caught));
352 EXPECT_TRUE(caught);
353}
354
Devlin Cronin242d19d22019-03-12 18:08:48355IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, UncaughtExceptionLogging) {
Devlin Cronin5cf20f02017-10-10 14:25:04356 ASSERT_TRUE(RunExtensionTest("bindings/uncaught_exception_logging"))
357 << message_;
358}
359
Alex Moshchuke63b9e92017-10-14 00:27:22360// Verify that when a web frame embeds an extension subframe, and that subframe
361// is the only active portion of the extension, the subframe gets proper JS
362// bindings. See https://crbug.com/760341.
Devlin Cronin242d19d22019-03-12 18:08:48363IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
Alex Moshchuke63b9e92017-10-14 00:27:22364 ExtensionSubframeGetsBindings) {
365 // Load an extension that does not have a background page or popup, so it
366 // won't be activated just yet.
367 const extensions::Extension* extension =
368 LoadExtension(test_data_dir_.AppendASCII("bindings")
369 .AppendASCII("extension_subframe_gets_bindings"));
370 ASSERT_TRUE(extension);
371
372 // Navigate current tab to a web URL with a subframe.
373 content::WebContents* web_contents =
374 browser()->tab_strip_model()->GetActiveWebContents();
375 ui_test_utils::NavigateToURL(browser(),
376 embedded_test_server()->GetURL("/iframe.html"));
377
378 // Navigate the subframe to the extension URL, which should activate the
379 // extension.
380 GURL extension_url(extension->GetResourceURL("page.html"));
381 ResultCatcher catcher;
382 content::NavigateIframeToURL(web_contents, "test", extension_url);
383 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
384}
385
Devlin Cronin242d19d22019-03-12 18:08:48386IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
Devlin Croninb15c4f4e2017-12-15 21:20:11387 ExtensionListenersRemoveContext) {
388 const Extension* extension = LoadExtension(
389 test_data_dir_.AppendASCII("bindings/listeners_destroy_context"));
390 ASSERT_TRUE(extension);
391
392 ExtensionTestMessageListener listener("ready", true);
393
394 // Navigate to a web page with an iframe (the iframe is title1.html).
395 GURL main_frame_url = embedded_test_server()->GetURL("a.com", "/iframe.html");
396 ui_test_utils::NavigateToURL(browser(), main_frame_url);
397
398 content::WebContents* tab =
399 browser()->tab_strip_model()->GetActiveWebContents();
400
401 content::RenderFrameHost* main_frame = tab->GetMainFrame();
402 content::RenderFrameHost* subframe = ChildFrameAt(main_frame, 0);
403 content::RenderFrameDeletedObserver subframe_deleted(subframe);
404
405 // Wait for the extension's content script to be ready.
406 ASSERT_TRUE(listener.WaitUntilSatisfied());
407
408 // It's actually critical to the test that these frames are in the same
409 // process, because otherwise a crash in the iframe wouldn't be detectable
410 // (since we rely on JS execution in the main frame to tell if the renderer
411 // crashed - see comment below).
412 content::RenderProcessHost* main_frame_process = main_frame->GetProcess();
413 EXPECT_EQ(main_frame_process, subframe->GetProcess());
414
415 ExtensionTestMessageListener failure_listener("failed", false);
416
417 // Tell the extension to register listeners that will remove the iframe, and
418 // trigger them.
419 listener.Reply("go!");
420
421 // The frame will be deleted.
422 subframe_deleted.WaitUntilDeleted();
423
424 // Unfortunately, we don't have a good way of checking if something crashed
425 // after the frame was removed. WebContents::IsCrashed() seems like it should
426 // work, but is insufficient. Instead, use JS execution as the source of
427 // true.
428 EXPECT_FALSE(tab->IsCrashed());
429 EXPECT_EQ(main_frame_url, main_frame->GetLastCommittedURL());
430 EXPECT_EQ(main_frame_process, main_frame->GetProcess());
431 bool renderer_valid = false;
432 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
433 main_frame, "domAutomationController.send(true);", &renderer_valid));
434 EXPECT_TRUE(renderer_valid);
435 EXPECT_FALSE(failure_listener.was_satisfied());
436}
437
Devlin Cronin242d19d22019-03-12 18:08:48438IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, UseAPIsAfterContextRemoval) {
Devlin Croninb48b6f92018-01-12 23:17:59439 EXPECT_TRUE(RunExtensionTest("bindings/invalidate_context")) << message_;
440}
441
Devlin Cronin6553cc382019-03-28 22:46:46442// Tests that we don't crash if the extension invalidates the context in a
443// callback with a runtime.lastError present. Regression test for
444// https://crbug.com/944014.
445IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
446 InvalidateContextInCallbackWithLastError) {
447 TestExtensionDir dir;
448 dir.WriteManifest(
449 R"({
450 "name": "Invalidate Context in onDisconnect",
451 "version": "0.1",
452 "manifest_version": 2,
453 "background": {"scripts": ["background.js"]}
454 })");
455
456 constexpr char kFrameHtml[] =
457 R"(<html>
458 <body></body>
459 <script src="frame.js"></script>
460 </html>)";
461 constexpr char kFrameJs[] =
462 R"(chrome.tabs.executeScript({code: ''}, () => {
463 // We expect a last error to be present, since we don't have access
464 // to the tab.
465 chrome.test.assertTrue(!!chrome.runtime.lastError);
466 // Remove the frame from the DOM. This causes blink to remove the
467 // associated script contexts.
468 parent.document.body.removeChild(
469 parent.document.body.querySelector('iframe'));
470 });)";
471 constexpr char kBackgroundJs[] =
472 R"(let frame = document.createElement('iframe');
473 frame.src = 'frame.html';
474 let observer = new MutationObserver((mutationList) => {
475 for (let mutation of mutationList) {
476 if (mutation.removedNodes.length == 0)
477 continue;
478 chrome.test.assertEq(1, mutation.removedNodes.length);
479 chrome.test.assertEq('IFRAME', mutation.removedNodes[0].tagName);
480 chrome.test.notifyPass();
481 break;
482 }
483 });
484 observer.observe(document.body, {childList: true});
485 document.body.appendChild(frame);)";
486 dir.WriteFile(FILE_PATH_LITERAL("frame.html"), kFrameHtml);
487 dir.WriteFile(FILE_PATH_LITERAL("frame.js"), kFrameJs);
488 dir.WriteFile(FILE_PATH_LITERAL("background.js"), kBackgroundJs);
489
490 ResultCatcher catcher;
491 const Extension* extension = LoadExtension(dir.UnpackedPath());
492 ASSERT_TRUE(extension);
493 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
494}
495
Devlin Cronin47e79042018-02-02 18:32:26496// TODO(devlin): Can this be combined with
497// ExtensionBindingsApiTest.UseAPIsAfterContextRemoval?
Devlin Cronin242d19d22019-03-12 18:08:48498IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest, UseAppAPIAfterFrameRemoval) {
Devlin Cronin47e79042018-02-02 18:32:26499 ASSERT_TRUE(RunExtensionTest("crazy_extension"));
500}
501
Devlin Cronind2389082018-08-14 01:53:26502// Tests attaching two listeners from the same extension but different pages,
503// then removing one, and ensuring the second is still notified.
504// Regression test for https://crbug.com/868763.
Devlin Cronin242d19d22019-03-12 18:08:48505IN_PROC_BROWSER_TEST_F(
Devlin Cronind2389082018-08-14 01:53:26506 ExtensionBindingsApiTest,
507 MultipleEventListenersFromDifferentContextsAndTheSameExtension) {
508 // A script that listens for tab creation and populates the result in a
509 // global variable.
510 constexpr char kTestPageScript[] = R"(
511 window.tabEventId = -1;
512 function registerListener() {
513 chrome.tabs.onCreated.addListener((tab) => {
514 window.tabEventId = tab.id;
515 });
516 }
517 )";
518 TestExtensionDir test_dir;
519 test_dir.WriteManifest(R"(
520 {
521 "name": "Duplicate event listeners",
522 "manifest_version": 2,
523 "version": "0.1"
524 })");
525 test_dir.WriteFile(FILE_PATH_LITERAL("page.html"),
526 R"(<html><script src="page.js"></script></html>)");
527 test_dir.WriteFile(FILE_PATH_LITERAL("page.js"), kTestPageScript);
528
529 const Extension* extension = LoadExtension(test_dir.UnpackedPath());
530 ASSERT_TRUE(extension);
531
532 // Set up: open two tabs to the same extension page, and wait for each to
533 // load.
534 const GURL page_url = extension->GetResourceURL("page.html");
535 ui_test_utils::NavigateToURLWithDisposition(
536 browser(), page_url, WindowOpenDisposition::NEW_FOREGROUND_TAB,
537 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
538 content::WebContents* first_tab =
539 browser()->tab_strip_model()->GetActiveWebContents();
540 ui_test_utils::NavigateToURLWithDisposition(
541 browser(), page_url, WindowOpenDisposition::NEW_FOREGROUND_TAB,
542 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
543 content::WebContents* second_tab =
544 browser()->tab_strip_model()->GetActiveWebContents();
545
546 // Initially, there are no listeners registered.
547 EventRouter* event_router = EventRouter::Get(profile());
548 EXPECT_FALSE(event_router->ExtensionHasEventListener(extension->id(),
549 "tabs.onCreated"));
550
551 // Register both lsiteners, and verify they were added.
552 ASSERT_TRUE(content::ExecuteScript(first_tab, "registerListener()"));
553 ASSERT_TRUE(content::ExecuteScript(second_tab, "registerListener()"));
554 EXPECT_TRUE(event_router->ExtensionHasEventListener(extension->id(),
555 "tabs.onCreated"));
556
557 // Close one of the extension pages.
558 constexpr bool add_to_history = false;
559 content::WebContentsDestroyedWatcher watcher(second_tab);
560 chrome::CloseWebContents(browser(), second_tab, add_to_history);
561 watcher.Wait();
562 // Hacky round trip to the renderer to flush IPCs.
563 ASSERT_TRUE(content::ExecuteScript(first_tab, ""));
564
565 // Since the second page is still open, the extension should still be
566 // registered as a listener.
567 EXPECT_TRUE(event_router->ExtensionHasEventListener(extension->id(),
568 "tabs.onCreated"));
569
570 // Open a new tab.
571 ui_test_utils::NavigateToURLWithDisposition(
572 browser(), GURL("chrome://newtab"),
573 WindowOpenDisposition::NEW_FOREGROUND_TAB,
574 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
575 content::WebContents* new_tab =
576 browser()->tab_strip_model()->GetActiveWebContents();
577
578 // The extension should have been notified about the new tab, and have
579 // recorded the result.
580 int result_tab_id = -1;
581 EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
582 first_tab, "domAutomationController.send(window.tabEventId)",
583 &result_tab_id));
584 EXPECT_EQ(SessionTabHelper::IdForTab(new_tab).id(), result_tab_id);
585}
586
Devlin Cronin242d19d22019-03-12 18:08:48587enum UserActivationType {
588 kUserActivationV1,
589 kUserActivationV2,
590};
591
592class ExtensionBindingsUserGestureTest
593 : public ExtensionBindingsApiTest,
594 public ::testing::WithParamInterface<UserActivationType> {
595 public:
596 ExtensionBindingsUserGestureTest() {}
597 ~ExtensionBindingsUserGestureTest() override {}
598
599 void SetUp() override {
600 UserActivationType user_activation_type = GetParam();
601 if (user_activation_type == kUserActivationV2) {
602 scoped_feature_list_.InitAndEnableFeature(features::kUserActivationV2);
603 } else {
604 DCHECK_EQ(kUserActivationV1, user_activation_type);
605 scoped_feature_list_.InitAndDisableFeature(features::kUserActivationV2);
606 }
607
608 ExtensionBindingsApiTest::SetUp();
609 }
610
611 private:
612 base::test::ScopedFeatureList scoped_feature_list_;
613
614 DISALLOW_COPY_AND_ASSIGN(ExtensionBindingsUserGestureTest);
615};
Devlin Cronine80e6fc12019-02-05 00:44:23616
Devlin Croninc3d017992018-09-11 01:21:20617// Verifies that user gestures are carried through extension messages.
Devlin Cronine80e6fc12019-02-05 00:44:23618IN_PROC_BROWSER_TEST_P(ExtensionBindingsUserGestureTest,
Devlin Croninc3d017992018-09-11 01:21:20619 UserGestureFromExtensionMessageTest) {
620 TestExtensionDir test_dir;
621 test_dir.WriteManifest(
622 R"({
623 "name": "User Gesture Content Script",
624 "manifest_version": 2,
625 "version": "0.1",
626 "background": { "scripts": ["background.js"] },
627 "content_scripts": [{
628 "matches": ["*://*.example.com:*/*"],
629 "js": ["content_script.js"],
630 "run_at": "document_end"
631 }]
632 })");
633 test_dir.WriteFile(FILE_PATH_LITERAL("content_script.js"),
634 R"(const button = document.getElementById('go-button');
635 button.addEventListener('click', () => {
636 chrome.runtime.sendMessage('clicked');
637 });)");
638 test_dir.WriteFile(FILE_PATH_LITERAL("background.js"),
639 R"(chrome.runtime.onMessage.addListener((message) => {
640 chrome.test.sendMessage(
641 'Clicked: ' +
642 chrome.test.isProcessingUserGesture());
643 });)");
644
645 const Extension* extension = LoadExtension(test_dir.UnpackedPath());
646 ASSERT_TRUE(extension);
647
648 const GURL url = embedded_test_server()->GetURL(
649 "example.com", "/extensions/page_with_button.html");
650 ui_test_utils::NavigateToURL(browser(), url);
651
652 content::WebContents* tab =
653 browser()->tab_strip_model()->GetActiveWebContents();
654
655 {
656 // Passing a message without an active user gesture shouldn't result in a
657 // gesture being active on the receiving end.
658 ExtensionTestMessageListener listener(false);
659 content::EvalJsResult result =
660 content::EvalJs(tab, "document.getElementById('go-button').click()",
661 content::EXECUTE_SCRIPT_NO_USER_GESTURE);
662 EXPECT_TRUE(result.value.is_none());
663
664 EXPECT_TRUE(listener.WaitUntilSatisfied());
665 EXPECT_EQ("Clicked: false", listener.message());
666 }
667
668 {
669 // If there is an active user gesture when the message is sent, we should
670 // synthesize a user gesture on the receiving end.
671 ExtensionTestMessageListener listener(false);
672 content::EvalJsResult result =
673 content::EvalJs(tab, "document.getElementById('go-button').click()");
674 EXPECT_TRUE(result.value.is_none());
675
676 EXPECT_TRUE(listener.WaitUntilSatisfied());
677 EXPECT_EQ("Clicked: true", listener.message());
678 }
679}
680
681// Verifies that user gestures from API calls are active when the callback is
682// triggered.
Devlin Cronine80e6fc12019-02-05 00:44:23683IN_PROC_BROWSER_TEST_P(ExtensionBindingsUserGestureTest,
Devlin Croninc3d017992018-09-11 01:21:20684 UserGestureInExtensionAPICallback) {
685 TestExtensionDir test_dir;
686 test_dir.WriteManifest(
687 R"({
688 "name": "User Gesture Extension API Callback",
689 "manifest_version": 2,
690 "version": "0.1"
691 })");
692 test_dir.WriteFile(FILE_PATH_LITERAL("page.html"), "<html></html>");
693
694 const Extension* extension = LoadExtension(test_dir.UnpackedPath());
695 ASSERT_TRUE(extension);
696
697 const GURL extension_page = extension->GetResourceURL("page.html");
698 ui_test_utils::NavigateToURL(browser(), extension_page);
699
700 content::WebContents* tab =
701 browser()->tab_strip_model()->GetActiveWebContents();
702
703 constexpr char kScript[] =
704 R"(chrome.tabs.query({}, (tabs) => {
705 let message;
706 if (chrome.runtime.lastError)
707 message = 'Unexpected error: ' + chrome.runtime.lastError;
708 else
709 message = 'Has gesture: ' + chrome.test.isProcessingUserGesture();
710 domAutomationController.send(message);
711 });)";
712
713 {
714 // Triggering an API without an active gesture shouldn't result in a
715 // gesture in the callback.
716 std::string message;
717 EXPECT_TRUE(content::ExecuteScriptWithoutUserGestureAndExtractString(
718 tab, kScript, &message));
719 EXPECT_EQ("Has gesture: false", message);
720 }
721 {
722 // If there was an active gesture at the time of the API call, there should
723 // be an active gesture in the callback.
724 std::string message;
725 EXPECT_TRUE(content::ExecuteScriptAndExtractString(tab, kScript, &message));
726 EXPECT_EQ("Has gesture: true", message);
727 }
728}
729
Devlin Cronine80e6fc12019-02-05 00:44:23730// Tests that a web page can consume a user gesture after an extension sends and
731// receives a reply during the same user gesture.
732// Regression test for https://crbug.com/921141.
733IN_PROC_BROWSER_TEST_P(ExtensionBindingsUserGestureTest,
734 WebUserGestureAfterMessagingCallback) {
735 TestExtensionDir test_dir;
736 test_dir.WriteManifest(
737 R"({
738 "name": "User Gesture Messaging Test",
739 "version": "0.1",
740 "manifest_version": 2,
741 "content_scripts": [{
742 "matches": ["*://*/*"],
743 "js": ["content_script.js"],
744 "run_at": "document_start"
745 }],
746 "background": {
747 "scripts": ["background.js"]
748 }
749 })");
750 test_dir.WriteFile(FILE_PATH_LITERAL("content_script.js"),
751 R"(window.addEventListener('mousedown', () => {
752 chrome.runtime.sendMessage('hello', () => {
753 let message = chrome.test.isProcessingUserGesture() ?
754 'got reply' : 'no user gesture';
755 chrome.test.sendMessage(message);
756 });
757 });)");
758 test_dir.WriteFile(
759 FILE_PATH_LITERAL("background.js"),
760 R"(chrome.runtime.onMessage.addListener((message, sender, respond) => {
761 respond('reply');
762 });
763 chrome.test.sendMessage('ready');)");
764
765 const Extension* extension = nullptr;
766 {
767 ExtensionTestMessageListener listener("ready", false);
768 extension = LoadExtension(test_dir.UnpackedPath());
769 ASSERT_TRUE(extension);
770 EXPECT_TRUE(listener.WaitUntilSatisfied());
771 }
772
773 ui_test_utils::NavigateToURL(
774 browser(), embedded_test_server()->GetURL(
775 "/extensions/api_test/bindings/user_gesture_test.html"));
776 content::WebContents* web_contents =
777 browser()->tab_strip_model()->GetActiveWebContents();
778 ASSERT_TRUE(web_contents);
779
780 {
781 ExtensionTestMessageListener listener("got reply", false);
782 listener.set_failure_message("no user gesture");
783 MouseDownInWebContents(web_contents);
784 EXPECT_TRUE(listener.WaitUntilSatisfied());
785 }
786
787 MouseUpInWebContents(web_contents);
788
789 EXPECT_EQ("success",
790 content::EvalJs(web_contents, "window.getEnteredFullscreen",
791 content::EXECUTE_SCRIPT_NO_USER_GESTURE));
792}
793
794// Tests that a web page can consume a user gesture after an extension calls a
795// method and receives the response in the callback.
796// Regression test for https://crbug.com/921141.
797IN_PROC_BROWSER_TEST_P(ExtensionBindingsUserGestureTest,
798 WebUserGestureAfterApiCallback) {
799 TestExtensionDir test_dir;
800 test_dir.WriteManifest(
801 R"({
802 "name": "User Gesture Messaging Test",
803 "version": "0.1",
804 "manifest_version": 2,
805 "content_scripts": [{
806 "matches": ["*://*/*"],
807 "js": ["content_script.js"],
808 "run_at": "document_start"
809 }],
810 "permissions": ["storage"]
811 })");
812 test_dir.WriteFile(FILE_PATH_LITERAL("content_script.js"),
813 R"(window.addEventListener('mousedown', () => {
814 chrome.storage.local.get('foo', () => {
815 let message = chrome.test.isProcessingUserGesture() ?
816 'got reply' : 'no user gesture';
817 chrome.test.sendMessage(message);
818 });
819 });)");
820
821 const Extension* extension = LoadExtension(test_dir.UnpackedPath());
822 ASSERT_TRUE(extension);
823
824 ui_test_utils::NavigateToURL(
825 browser(), embedded_test_server()->GetURL(
826 "/extensions/api_test/bindings/user_gesture_test.html"));
827 content::WebContents* web_contents =
828 browser()->tab_strip_model()->GetActiveWebContents();
829 ASSERT_TRUE(web_contents);
830
831 {
832 ExtensionTestMessageListener listener("got reply", false);
833 listener.set_failure_message("no user gesture");
834 MouseDownInWebContents(web_contents);
835 EXPECT_TRUE(listener.WaitUntilSatisfied());
836 }
837
838 MouseUpInWebContents(web_contents);
839
840 EXPECT_EQ("success",
841 content::EvalJs(web_contents, "window.getEnteredFullscreen",
842 content::EXECUTE_SCRIPT_NO_USER_GESTURE));
843}
844
Devlin Cronind900688a2019-02-01 01:36:11845// Tests that bindings are properly instantiated for a window navigated to an
846// extension URL after being opened with an undefined URL.
847// Regression test for https://crbug.com/925118.
Devlin Cronin242d19d22019-03-12 18:08:48848IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
Devlin Cronind900688a2019-02-01 01:36:11849 TestBindingsAvailableWithNavigatedBlankWindow) {
850 constexpr char kManifest[] =
851 R"({
852 "name": "chrome.runtime bug checker",
853 "description": "test case for crbug.com/925118",
854 "version": "0",
855 "manifest_version": 2
856 })";
857 constexpr char kOpenerHTML[] =
858 R"(<!DOCTYPE html>
859 <html>
860 <head>
861 <script src='opener.js'></script>
862 </head>
863 <body>
864 </body>
865 </html>)";
866 // opener.js opens a blank window and then navigates it to an extension URL
867 // (where extension APIs should be available).
868 constexpr char kOpenerJS[] =
869 R"(const url = chrome.runtime.getURL('/page.html');
870 const win = window.open(undefined, '');
871 win.location = url;
872 chrome.test.notifyPass())";
873 constexpr char kPageHTML[] =
874 R"(<!DOCTYPE html>
875 <html>
876 This space intentionally left blank.
877 </html>)";
878 TestExtensionDir extension_dir;
879 extension_dir.WriteManifest(kManifest);
880 extension_dir.WriteFile(FILE_PATH_LITERAL("opener.html"), kOpenerHTML);
881 extension_dir.WriteFile(FILE_PATH_LITERAL("opener.js"), kOpenerJS);
882 extension_dir.WriteFile(FILE_PATH_LITERAL("page.html"), kPageHTML);
883
884 const Extension* extension = LoadExtension(extension_dir.UnpackedPath());
885 const GURL target_url = extension->GetResourceURL("page.html");
886
887 ResultCatcher catcher;
888 content::TestNavigationObserver observer(target_url);
889 observer.StartWatchingNewWebContents();
890 ui_test_utils::NavigateToURL(browser(),
891 extension->GetResourceURL("opener.html"));
892 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
893 observer.Wait();
894 EXPECT_TRUE(observer.last_navigation_succeeded());
895
896 content::WebContents* web_contents =
897 browser()->tab_strip_model()->GetActiveWebContents();
898 EXPECT_EQ(target_url, web_contents->GetLastCommittedURL());
899
900 // Check whether bindings are available. They should be.
901 constexpr char kScript[] =
902 R"(let message;
903 if (!chrome.runtime)
904 message = 'Runtime not defined';
905 else if (!chrome.tabs)
906 message = 'Tabs not defined';
907 else
908 message = 'success';
909 domAutomationController.send(message);)";
910 std::string result;
911 // Note: Can't use EvalJs() because of CSP in extension pages.
912 EXPECT_TRUE(
913 content::ExecuteScriptAndExtractString(web_contents, kScript, &result));
914 EXPECT_EQ("success", result);
915}
916
Devlin Cronina08e7d262019-04-08 17:29:59917// Tests the aliasing of chrome.extension methods to their chrome.runtime
918// equivalents.
919IN_PROC_BROWSER_TEST_F(ExtensionBindingsApiTest,
920 ChromeExtensionIsAliasedToChromeRuntime) {
921 constexpr char kManifest[] =
922 R"({
923 "name": "Test",
924 "version": "0.1",
925 "manifest_version": 2,
926 "background": { "scripts": ["background.js"] }
927 })";
928 constexpr char kBackground[] =
929 R"(chrome.test.runTests([
930 function chromeExtensionIsAliased() {
931 // Sanity check: chrome.extension is directly aliased to
932 // chrome.runtime.
933 chrome.test.assertTrue(!!chrome.runtime);
934 chrome.test.assertTrue(!!chrome.runtime.sendMessage);
935 chrome.test.assertEq(chrome.runtime.sendMessage,
936 chrome.extension.sendMessage);
937 chrome.test.succeed();
938 },
939 function testOverridingFailsGracefully() {
940 let intercepted = false;
941 // Modify the chrome.runtime object, which is the source for the
942 // chrome.extension API, to throw an error when sendMessage is
943 // accessed. Nothing should blow up.
944 // Regression test for https://crbug.com/949170.
945 Object.defineProperty(
946 chrome.runtime,
947 'sendMessage',
948 {
949 get() {
950 intercepted = true;
951 throw new Error('Mwahaha');
952 }
953 });
954 chrome.extension.sendMessage;
955 chrome.test.assertTrue(intercepted);
956 chrome.test.succeed();
957 }
958 ]);)";
959
960 TestExtensionDir extension_dir;
961 extension_dir.WriteManifest(kManifest);
962 extension_dir.WriteFile(FILE_PATH_LITERAL("background.js"), kBackground);
963 ResultCatcher catcher;
964 ASSERT_TRUE(LoadExtension(extension_dir.UnpackedPath()));
965 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
966}
967
Devlin Cronine80e6fc12019-02-05 00:44:23968INSTANTIATE_TEST_SUITE_P(,
969 ExtensionBindingsUserGestureTest,
Devlin Cronin242d19d22019-03-12 18:08:48970 ::testing::Values(kUserActivationV1,
971 kUserActivationV2));
Devlin Croninc3a1e5072017-08-17 17:02:49972
[email protected]adafe5b2013-08-09 10:35:04973} // namespace
974} // namespace extensions