| Index: chrome/test/data/extensions/api_test/webnavigation/crossProcessIframe/test_crossProcessIframe.js
|
| diff --git a/chrome/test/data/extensions/api_test/webnavigation/crossProcessIframe/test_crossProcessIframe.js b/chrome/test/data/extensions/api_test/webnavigation/crossProcessIframe/test_crossProcessIframe.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dac9e9cf1855670a7b857c7bc366c3d2f0136bcc
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/webnavigation/crossProcessIframe/test_crossProcessIframe.js
|
| @@ -0,0 +1,211 @@
|
| +// 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.
|
| +
|
| +onload = function() {
|
| + debug = true;
|
| + var getURL = chrome.extension.getURL;
|
| + var URL_MAIN = getURL("main.html");
|
| + var URL_FRAME1 = "http://a.com:PORT/extensions/api_test/webnavigation/" +
|
| + "crossProcessIframe/frame.html";
|
| + var URL_FRAME2 = "http://b.com:PORT/extensions/api_test/webnavigation/" +
|
| + "crossProcessIframe/frame.html";
|
| + var URL_FRAME3 = "http://c.com:PORT/extensions/api_test/webnavigation/" +
|
| + "crossProcessIframe/frame.html";
|
| + chrome.tabs.create({"url": "about:blank"}, function(tab) {
|
| + var tabId = tab.id;
|
| + chrome.test.getConfig(function(config) {
|
| + var fixPort = function(url) {
|
| + return url.replace(/PORT/g, config.testServer.port);
|
| + };
|
| + URL_FRAME1 = fixPort(URL_FRAME1);
|
| + URL_FRAME2 = fixPort(URL_FRAME2);
|
| + URL_FRAME3 = fixPort(URL_FRAME3);
|
| +
|
| + chrome.test.runTests([
|
| + // Navigates from an extension page to a HTTP page which causes a
|
| + // process switch. The extension page embeds a same-process iframe which
|
| + // embeds another frame navigates three times (cross-process):
|
| + // c. Loaded by the parent frame.
|
| + // d. Navigated by the parent frame.
|
| + // e. Navigated by the child frame.
|
| + // Tests whether the frameId stays constant across navigations.
|
| + function crossProcessIframe() {
|
| + expect([
|
| + { label: "a-onBeforeNavigate",
|
| + event: "onBeforeNavigate",
|
| + details: { frameId: 0,
|
| + parentFrameId: -1,
|
| + processId: 0,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_MAIN }},
|
| + { label: "a-onCommitted",
|
| + event: "onCommitted",
|
| + details: { frameId: 0,
|
| + processId: 0,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + transitionQualifiers: [],
|
| + transitionType: "link",
|
| + url: URL_MAIN }},
|
| + { label: "a-onDOMContentLoaded",
|
| + event: "onDOMContentLoaded",
|
| + details: { frameId: 0,
|
| + processId: 0,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_MAIN }},
|
| + { label: "a-onCompleted",
|
| + event: "onCompleted",
|
| + details: { frameId: 0,
|
| + processId: 0,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_MAIN }},
|
| + // Process swap.
|
| + { label: "pre-b-onBeforeNavigate",
|
| + event: "onBeforeNavigate",
|
| + details: { frameId: 1,
|
| + parentFrameId: 0,
|
| + processId: 0,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME1 }},
|
| + { label: "pre-b-onErrorOccurred",
|
| + event: "onErrorOccurred",
|
| + details: { error: "net::ERR_ABORTED",
|
| + frameId: 1,
|
| + processId: 0,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME1 }},
|
| + { label: "b-onBeforeNavigate",
|
| + event: "onBeforeNavigate",
|
| + details: { frameId: 1,
|
| + parentFrameId: 0,
|
| + processId: 1,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME1 }},
|
| + { label: "b-onCommitted",
|
| + event: "onCommitted",
|
| + details: { frameId: 1,
|
| + processId: 1,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + transitionQualifiers: [],
|
| + transitionType: "auto_subframe",
|
| + url: URL_FRAME1 }},
|
| + { label: "b-onDOMContentLoaded",
|
| + event: "onDOMContentLoaded",
|
| + details: { frameId: 1,
|
| + processId: 1,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME1 }},
|
| + { label: "b-onCompleted",
|
| + event: "onCompleted",
|
| + details: { frameId: 1,
|
| + processId: 1,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME1 }},
|
| + // TODO(robwu): Why is there no onBeforeNavigate and onErrorOccurred
|
| + // like above before the process swap?
|
| + { label: "c-onBeforeNavigate",
|
| + event: "onBeforeNavigate",
|
| + details: { frameId: 1,
|
| + parentFrameId: 0,
|
| + processId: 2,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME2 }},
|
| + { label: "c-onCommitted",
|
| + event: "onCommitted",
|
| + details: { frameId: 1,
|
| + processId: 2,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + transitionQualifiers: [],
|
| + transitionType: "manual_subframe",
|
| + url: URL_FRAME2 }},
|
| + { label: "c-onDOMContentLoaded",
|
| + event: "onDOMContentLoaded",
|
| + details: { frameId: 1,
|
| + processId: 2,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME2 }},
|
| + { label: "c-onCompleted",
|
| + event: "onCompleted",
|
| + details: { frameId: 1,
|
| + processId: 2,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME2 }},
|
| + // Process swap.
|
| + { label: "pre-d-onBeforeNavigate",
|
| + event: "onBeforeNavigate",
|
| + details: { frameId: 1,
|
| + parentFrameId: 0,
|
| + processId: 2,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME3 }},
|
| + { label: "pre-d-onErrorOccurred",
|
| + event: "onErrorOccurred",
|
| + details: { error: "net::ERR_ABORTED",
|
| + frameId: 1,
|
| + processId: 2,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME3 }},
|
| + { label: "d-onBeforeNavigate",
|
| + event: "onBeforeNavigate",
|
| + details: { frameId: 1,
|
| + parentFrameId: 0,
|
| + processId: 3,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME3 }},
|
| + { label: "d-onCommitted",
|
| + event: "onCommitted",
|
| + details: { frameId: 1,
|
| + processId: 3,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + transitionQualifiers: [],
|
| + transitionType: "manual_subframe",
|
| + url: URL_FRAME3 }},
|
| + { label: "d-onDOMContentLoaded",
|
| + event: "onDOMContentLoaded",
|
| + details: { frameId: 1,
|
| + processId: 3,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME3 }},
|
| + { label: "d-onCompleted",
|
| + event: "onCompleted",
|
| + details: { frameId: 1,
|
| + processId: 3,
|
| + tabId: 0,
|
| + timeStamp: 0,
|
| + url: URL_FRAME3 }}],
|
| + [
|
| + navigationOrder("a-"),
|
| + navigationOrder("b-"),
|
| + navigationOrder("c-"),
|
| + navigationOrder("d-"),
|
| + ["pre-b-onBeforeNavigate", "pre-b-onErrorOccurred"],
|
| + ["pre-d-onBeforeNavigate", "pre-d-onErrorOccurred"]]);
|
| +
|
| + chrome.tabs.update(tabId, {
|
| + url: URL_MAIN + "?" + config.testServer.port
|
| + });
|
| + },
|
| +
|
| + ]);
|
| + });
|
| + });
|
| +};
|
|
|