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

Unified Diff: chrome/test/data/extensions/api_test/messaging/connect_crash/page.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/page.js
diff --git a/chrome/test/data/extensions/api_test/messaging/connect_crash/page.js b/chrome/test/data/extensions/api_test/messaging/connect_crash/page.js
new file mode 100644
index 0000000000000000000000000000000000000000..47878118c62eb33be67ca21a7782f42b0a665e85
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/messaging/connect_crash/page.js
@@ -0,0 +1,24 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
Devlin 2015/11/13 21:16:27 nit: no (c) (everywhere)
robwu 2015/12/07 23:44:22 Done.
+// 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.onDisconnect.addListener(function() {
+ chrome.test.fail('onDisconnect should not be triggered because the ' +
+ 'background page exists and the tab should have been crashed');
+});
+
+var ref;
+chrome.runtime.onMessage.addListener(function(msg, sender, sendResponse) {
+ chrome.test.assertEq('Rob says hi', msg);
+ port.postMessage('is_ready_to_crash');
+ // Keep the callback around to avoid test flakiness due to GC.
+ ref = sendResponse;
+
+ // TODO(robwu): Remove the following line once crbug.com/439780 is fixed.
+ // (the response callback is not automatically invoked when the tab crashes).
+ sendResponse();
+
+ // Keep the port open - do not send a response.
+ return true;
+});

Powered by Google App Engine
This is Rietveld 408576698