1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 var getURL = chrome.extension.getURL;
7 var URL_TEST = "http://127.0.0.1:PORT/test";
8 chrome.tabs.create({"url": "about:blank"}, function(tab) {
10 chrome.test.getConfig(function(config) {
11 var fixPort = function(url) {
12 return url.replace(/PORT/g, config.testServer.port);
14 URL_TEST = fixPort(URL_TEST);
16 chrome.test.runTests([
17 // Navigates to a different site, but then modifies the reference
19 function crossProcessFragment() {
21 { label: "a-onBeforeNavigate",
22 event: "onBeforeNavigate",
23 details: { frameId: 0,
28 url: getURL('f.html') }},
29 { label: "a-onCommitted",
31 details: { frameId: 0,
35 transitionQualifiers: [],
36 transitionType: "link",
37 url: getURL('f.html') }},
38 { label: "a-onDOMContentLoaded",
39 event: "onDOMContentLoaded",
40 details: { frameId: 0,
44 url: getURL('f.html') }},
45 { label: "a-onCompleted",
47 details: { frameId: 0,
51 url: getURL('f.html') }},
52 { label: "a-onReferenceFragmentUpdated",
53 event: "onReferenceFragmentUpdated",
54 details: { frameId: 0,
58 transitionQualifiers: [],
59 transitionType: "link",
60 url: getURL('f.html#foo') }},
61 { label: "b-onBeforeNavigate",
62 event: "onBeforeNavigate",
63 details: { frameId: 0,
68 url: URL_TEST + "3" }},
69 { label: "b-onCommitted",
71 details: { frameId: 0,
75 transitionQualifiers: [],
76 transitionType: "link",
77 url: URL_TEST + "3" }},
78 { label: "b-onDOMContentLoaded",
79 event: "onDOMContentLoaded",
80 details: { frameId: 0,
84 url: URL_TEST + "3" }},
85 { label: "b-onCompleted",
87 details: { frameId: 0,
91 url: URL_TEST + "3" }}],
92 [ navigationOrder("a-"),
93 [ "a-onCompleted", "b-onBeforeNavigate",
94 "a-onReferenceFragmentUpdated", "b-onCommitted"] ]);
98 { url: getURL('f.html?' +
99 config.testServer.port) });
102 // A page with an iframe that changes its reference fragment before
103 // the iframe committed.
104 function crossProcessFragmentIFrame() {
106 { label: "a-onBeforeNavigate",
107 event: "onBeforeNavigate",
108 details: { frameId: 0,
113 url: getURL('g.html') }},
114 { label: "a-onCommitted",
115 event: "onCommitted",
116 details: { frameId: 0,
120 transitionQualifiers: [],
121 transitionType: "link",
122 url: getURL('g.html') }},
123 { label: "a-onDOMContentLoaded",
124 event: "onDOMContentLoaded",
125 details: { frameId: 0,
129 url: getURL('g.html') }},
130 { label: "a-onCompleted",
131 event: "onCompleted",
132 details: { frameId: 0,
136 url: getURL('g.html') }},
137 { label: "a-onReferenceFragmentUpdated",
138 event: "onReferenceFragmentUpdated",
139 details: { frameId: 0,
143 transitionQualifiers: [],
144 transitionType: "link",
145 url: getURL('g.html#foo') }},
146 { label: "b-onBeforeNavigate",
147 event: "onBeforeNavigate",
148 details: { frameId: 1,
153 url: URL_TEST + "4" }},
154 { label: "b-onCommitted",
155 event: "onCommitted",
156 details: { frameId: 1,
160 transitionQualifiers: [],
161 transitionType: "auto_subframe",
162 url: URL_TEST + "4" }},
163 { label: "b-onDOMContentLoaded",
164 event: "onDOMContentLoaded",
165 details: { frameId: 1,
169 url: URL_TEST + "4" }},
170 { label: "b-onCompleted",
171 event: "onCompleted",
172 details: { frameId: 1,
176 url: URL_TEST + "4" }}],
177 [ navigationOrder("a-"), navigationOrder("b-"),
178 [ "a-onCompleted", "b-onBeforeNavigate",
179 "a-onReferenceFragmentUpdated"] ]);
183 { url: getURL('g.html?' +
184 config.testServer.port) });