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

Unified Diff: chrome/test/data/extensions/api_test/messaging/connect_crash/test.js

Issue 1413543005: Use FrameTreeNode ID as frameId in extension APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits in #16, s/FindByFrameTreeNodeID/FindFrameByFrameTreeNodeID/ 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 side-by-side diff with in-line comments
Download patch
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();
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698