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

Unified Diff: chrome/test/data/extensions/api_test/webrequest/test_unload1.js

Issue 2003593002: Add tests for webRequest events and frame unload (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: battre's nits Created 4 years, 7 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/webrequest/test_unload1.js
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_unload1.js b/chrome/test/data/extensions/api_test/webrequest/test_unload1.js
new file mode 100644
index 0000000000000000000000000000000000000000..d46ecdd9872e8632e2f6c73a34dc94b053b5558a
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/webrequest/test_unload1.js
@@ -0,0 +1,65 @@
+// Copyright 2016 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.
+
+runTests([
+ // Opens a cross-origin iframe (a http-URL in this chrome-extension tab) and
+ // removes it.
+ function insertSlowCrossOriginFrameAndRemove() {
+ const url = getSlowURL('frame-in-extension-url');
+
+ expect([
+ { label: 'onBeforeRequest',
+ event: 'onBeforeRequest',
+ details: {
+ type: 'sub_frame',
+ url,
+ frameId: 1,
+ parentFrameId: 0,
+ frameUrl: url,
+ tabId: 1,
+ }
+ },
+ { label: 'onBeforeSendHeaders',
+ event: 'onBeforeSendHeaders',
+ details: {
+ type: 'sub_frame',
+ url,
+ frameId: 1,
+ parentFrameId: 0,
+ tabId: 1,
+ },
+ },
+ { label: 'onSendHeaders',
+ event: 'onSendHeaders',
+ details: {
+ type: 'sub_frame',
+ url,
+ frameId: 1,
+ parentFrameId: 0,
+ tabId: 1,
+ },
+ },
+ { label: 'onErrorOccurred',
+ event: 'onErrorOccurred',
+ details: {
+ type: 'sub_frame',
+ url,
+ frameId: 1,
+ parentFrameId: 0,
+ tabId: 1,
+ fromCache: false,
+ error: 'net::ERR_ABORTED',
+ },
+ }],
+ [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders',
+ 'onErrorOccurred']]);
+
+ var f = document.createElement('iframe');
+ f.src = url;
+ waitUntilSendHeaders('sub_frame', url, function() {
+ f.remove();
+ });
+ document.body.appendChild(f);
+ },
+]);

Powered by Google App Engine
This is Rietveld 408576698