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

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: s/:/ / Created 4 years, 11 months 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..b3fc833ace622b5a95755fe6b82d964d6739d57c
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/messaging/connect_crash/page.js
@@ -0,0 +1,24 @@
+// Copyright 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.
+
+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