| Index: chrome/test/data/extensions/api_test/messaging/connect_crash/test.js
|
| diff --git a/chrome/test/data/extensions/api_test/messaging/connect_crash/test.js b/chrome/test/data/extensions/api_test/messaging/connect_crash/test.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e53068133c2b221f8bace60ebf40bd33d3e9e83a
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/messaging/connect_crash/test.js
|
| @@ -0,0 +1,27 @@
|
| +// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +chrome.runtime.onConnect.addListener(function(port) {
|
| + var is_ready_to_crash = false;
|
| + var succeed1 = chrome.test.callbackAdded();
|
| + var succeed2 = chrome.test.callbackAdded();
|
| +
|
| + port.onMessage.addListener(function(msg) {
|
| + chrome.test.assertEq('is_ready_to_crash', msg);
|
| + is_ready_to_crash = true;
|
| + chrome.test.sendMessage('ready_to_crash');
|
| + // Now the browser test should kill the tab, and the port should be closed.
|
| + });
|
| + port.onDisconnect.addListener(function() {
|
| + console.log('port.onDisconnect was triggered.');
|
| + chrome.test.assertTrue(is_ready_to_crash);
|
| + succeed1();
|
| + });
|
| +
|
| + chrome.tabs.sendMessage(port.sender.tab.id, 'Rob says hi', function() {
|
| + console.log('tab.sendMessage\'s response callback was invoked');
|
| + chrome.test.assertNoLastError();
|
| + succeed2();
|
| + });
|
| +});
|
|
|