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

Side by Side Diff: chrome/test/data/extensions/api_test/messaging/connect_nobackground/test.js

Issue 1413853005: Track all extension frames in ProcessManager, inspect extensionoptions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 1 month 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
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
Devlin 2015/10/30 01:21:44 ditto
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 chrome.runtime.onConnect.addListener(function(port) {
6 var succeed1 = chrome.test.callbackAdded();
7 var succeed2 = chrome.test.callbackAdded();
8 var succeed3 = chrome.test.callbackAdded();
9
10 port.onMessage.addListener(function(msg) {
11 console.log('port.onMessage was triggered.');
Devlin 2015/10/30 01:21:43 nit: try to avoid noisy logs in tests. My general
robwu 2015/10/30 10:15:49 We have chrome.test.log, which causes messages to
Devlin 2015/10/30 16:03:51 Huh - thought that always logged. Apparently not.
12 chrome.test.assertEq('Hello from content script', msg);
13 succeed1();
14 });
Devlin 2015/10/30 01:21:43 nit: newline
15 port.onDisconnect.addListener(function() {
16 console.log('port.onDisconnect was triggered.');
17 succeed2();
18 });
19
20 chrome.tabs.sendMessage(port.sender.tab.id, '', function(reply) {
21 console.log('tab.sendMessage\'s response callback was invoked');
22 chrome.test.assertEq('Reply here', reply);
23 succeed3();
24 });
25 });
26
27 chrome.test.getConfig(function(config) {
28 var url = 'http://localhost:' + config.testServer.port +
29 '/extensions/test_file.html?will_test_connect_and_sendMessage';
Devlin 2015/10/30 01:21:44 nit: 4-space indent
30 // Content script will try to connect and trigger onConnect.
31 chrome.tabs.create({
32 url: url
33 });
34 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698