Chromium Code Reviews| Index: chrome/test/data/extensions/api_test/messaging/connect_nobackground/contentscript.js |
| diff --git a/chrome/test/data/extensions/api_test/messaging/connect_nobackground/contentscript.js b/chrome/test/data/extensions/api_test/messaging/connect_nobackground/contentscript.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f590996543c8815f7d23a75004a23179630566ca |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/api_test/messaging/connect_nobackground/contentscript.js |
| @@ -0,0 +1,11 @@ |
| +// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
|
Devlin
2015/10/30 01:21:43
nit: no (c)
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +var port = chrome.runtime.connect(); |
| +port.postMessage('Hello from content script'); |
| +port.disconnect(); |
| + |
| +chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { |
|
Devlin
2015/10/30 01:21:43
this seems like a subtle race condition - can we r
robwu
2015/10/30 10:15:49
This can't race because the message has to go to a
Devlin
2015/10/30 16:03:51
Generally in testing, though, we don't want to rel
|
| + sendResponse('Reply here'); |
|
Devlin
2015/10/30 01:21:43
Is it worth verifying the message? Probably not n
|
| +}); |