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

Side by Side Diff: chrome/test/data/extensions/api_test/webnavigation/crossProcess/test_crossProcess.js

Issue 1670673003: Refactor the implementation of the webNavigation extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Bug-532666-NavigationHandleAPI
Patch Set: Remove UI thread DCHECKs. Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 onload = function() { 5 onload = function() {
6 var getURL = chrome.extension.getURL; 6 var getURL = chrome.extension.getURL;
7 var URL_REGULAR = 7 var URL_REGULAR =
8 "http://127.0.0.1:PORT/extensions/api_test/webnavigation/" + 8 "http://127.0.0.1:PORT/extensions/api_test/webnavigation/" +
9 "crossProcess/empty.html"; 9 "crossProcess/empty.html";
10 var URL_REDIRECT = "http://www.a.com:PORT/server-redirect"; 10 var URL_REDIRECT = "http://www.a.com:PORT/server-redirect";
(...skipping 10 matching lines...) Expand all
21 21
22 chrome.test.runTests([ 22 chrome.test.runTests([
23 // Navigates from an extension page to a HTTP page which causes a 23 // Navigates from an extension page to a HTTP page which causes a
24 // process switch. 24 // process switch.
25 function crossProcess() { 25 function crossProcess() {
26 expect([ 26 expect([
27 { label: "a-onBeforeNavigate", 27 { label: "a-onBeforeNavigate",
28 event: "onBeforeNavigate", 28 event: "onBeforeNavigate",
29 details: { frameId: 0, 29 details: { frameId: 0,
30 parentFrameId: -1, 30 parentFrameId: -1,
31 processId: 0, 31 processId: -1,
32 tabId: 0, 32 tabId: 0,
33 timeStamp: 0, 33 timeStamp: 0,
34 url: getURL('a.html') }}, 34 url: getURL('a.html') }},
35 { label: "a-onCommitted", 35 { label: "a-onCommitted",
36 event: "onCommitted", 36 event: "onCommitted",
37 details: { frameId: 0, 37 details: { frameId: 0,
38 processId: 0, 38 processId: 0,
39 tabId: 0, 39 tabId: 0,
40 timeStamp: 0, 40 timeStamp: 0,
41 transitionQualifiers: [], 41 transitionQualifiers: [],
(...skipping 10 matching lines...) Expand all
52 event: "onCompleted", 52 event: "onCompleted",
53 details: { frameId: 0, 53 details: { frameId: 0,
54 processId: 0, 54 processId: 0,
55 tabId: 0, 55 tabId: 0,
56 timeStamp: 0, 56 timeStamp: 0,
57 url: getURL('a.html') }}, 57 url: getURL('a.html') }},
58 { label: "b-onBeforeNavigate", 58 { label: "b-onBeforeNavigate",
59 event: "onBeforeNavigate", 59 event: "onBeforeNavigate",
60 details: { frameId: 0, 60 details: { frameId: 0,
61 parentFrameId: -1, 61 parentFrameId: -1,
62 processId: 1, 62 processId: -1,
63 tabId: 0, 63 tabId: 0,
64 timeStamp: 0, 64 timeStamp: 0,
65 url: URL_REGULAR }}, 65 url: URL_REGULAR }},
66 { label: "b-onCommitted", 66 { label: "b-onCommitted",
67 event: "onCommitted", 67 event: "onCommitted",
68 details: { frameId: 0, 68 details: { frameId: 0,
69 processId: 1, 69 processId: 1,
70 tabId: 0, 70 tabId: 0,
71 timeStamp: 0, 71 timeStamp: 0,
72 transitionQualifiers: [], 72 transitionQualifiers: [],
(...skipping 20 matching lines...) Expand all
93 { url: getURL('a.html?' + config.testServer.port) }); 93 { url: getURL('a.html?' + config.testServer.port) });
94 }, 94 },
95 95
96 // Redirects through an app extent, should cause two process switches. 96 // Redirects through an app extent, should cause two process switches.
97 function crossProcessRedirect() { 97 function crossProcessRedirect() {
98 expect([ 98 expect([
99 { label: "a-onBeforeNavigate", 99 { label: "a-onBeforeNavigate",
100 event: "onBeforeNavigate", 100 event: "onBeforeNavigate",
101 details: { frameId: 0, 101 details: { frameId: 0,
102 parentFrameId: -1, 102 parentFrameId: -1,
103 processId: 0, 103 processId: -1,
104 tabId: 0, 104 tabId: 0,
105 timeStamp: 0, 105 timeStamp: 0,
106 url: getURL('c.html') }}, 106 url: getURL('c.html') }},
107 { label: "a-onCommitted", 107 { label: "a-onCommitted",
108 event: "onCommitted", 108 event: "onCommitted",
109 details: { frameId: 0, 109 details: { frameId: 0,
110 processId: 0, 110 processId: 0,
111 tabId: 0, 111 tabId: 0,
112 timeStamp: 0, 112 timeStamp: 0,
113 transitionQualifiers: [], 113 transitionQualifiers: [],
114 transitionType: "link", 114 transitionType: "link",
115 url: getURL('c.html') }}, 115 url: getURL('c.html') }},
116 { label: "a-onDOMContentLoaded", 116 { label: "a-onDOMContentLoaded",
117 event: "onDOMContentLoaded", 117 event: "onDOMContentLoaded",
118 details: { frameId: 0, 118 details: { frameId: 0,
119 processId: 0, 119 processId: 0,
120 tabId: 0, 120 tabId: 0,
121 timeStamp: 0, 121 timeStamp: 0,
122 url: getURL('c.html') }}, 122 url: getURL('c.html') }},
123 { label: "a-onCompleted", 123 { label: "a-onCompleted",
124 event: "onCompleted", 124 event: "onCompleted",
125 details: { frameId: 0, 125 details: { frameId: 0,
126 processId: 0, 126 processId: 0,
127 tabId: 0, 127 tabId: 0,
128 timeStamp: 0, 128 timeStamp: 0,
129 url: getURL('c.html') }}, 129 url: getURL('c.html') }},
130 { label: "b-onBeforeNavigate",
131 event: "onBeforeNavigate",
132 details: { frameId: 0,
133 parentFrameId: -1,
134 processId: 1,
135 tabId: 0,
136 timeStamp: 0,
137 url: URL_REDIRECT }},
138 { label: "b-onErrorOccurred",
139 event: "onErrorOccurred",
140 details: { error: "net::ERR_ABORTED",
141 frameId: 0,
142 processId: 1,
143 tabId: 0,
144 timeStamp: 0,
145 url: URL_REDIRECT }},
146 { label: "c-onBeforeNavigate", 130 { label: "c-onBeforeNavigate",
147 event: "onBeforeNavigate", 131 event: "onBeforeNavigate",
148 details: { frameId: 0, 132 details: { frameId: 0,
149 parentFrameId: -1, 133 parentFrameId: -1,
150 processId: 2, 134 processId: -1,
151 tabId: 0, 135 tabId: 0,
152 timeStamp: 0, 136 timeStamp: 0,
153 url: URL_REGULAR }}, 137 url: URL_REDIRECT }},
154 { label: "c-onCommitted", 138 { label: "c-onCommitted",
155 event: "onCommitted", 139 event: "onCommitted",
156 details: { frameId: 0, 140 details: { frameId: 0,
157 processId: 2, 141 processId: 1,
158 tabId: 0, 142 tabId: 0,
159 timeStamp: 0, 143 timeStamp: 0,
160 transitionQualifiers: [], 144 transitionQualifiers: ["server_redirect"],
161 transitionType: "link", 145 transitionType: "link",
162 url: URL_REGULAR }}, 146 url: URL_REGULAR }},
163 { label: "c-onDOMContentLoaded", 147 { label: "c-onDOMContentLoaded",
164 event: "onDOMContentLoaded", 148 event: "onDOMContentLoaded",
165 details: { frameId: 0, 149 details: { frameId: 0,
166 processId: 2, 150 processId: 1,
167 tabId: 0, 151 tabId: 0,
168 timeStamp: 0, 152 timeStamp: 0,
169 url: URL_REGULAR }}, 153 url: URL_REGULAR }},
170 { label: "c-onCompleted", 154 { label: "c-onCompleted",
171 event: "onCompleted", 155 event: "onCompleted",
172 details: { frameId: 0, 156 details: { frameId: 0,
173 processId: 2, 157 processId: 1,
174 tabId: 0, 158 tabId: 0,
175 timeStamp: 0, 159 timeStamp: 0,
176 url: URL_REGULAR }}], 160 url: URL_REGULAR }}],
177 [ navigationOrder("a-"), 161 [ navigationOrder("a-"), navigationOrder("c-"), ]);
178 navigationOrder("c-"),
179 [ "a-onCompleted", "b-onBeforeNavigate", "b-onErrorOccurred",
180 "c-onBeforeNavigate"] ]);
181 162
182 chrome.tabs.update( 163 chrome.tabs.update(
183 tabId, 164 tabId,
184 { url: getURL('c.html?' + config.testServer.port) }); 165 { url: getURL('c.html?' + config.testServer.port) });
185 }, 166 },
186 167
187 // Navigates to a different site, but then commits 168 // Navigates to a different site, but then commits
188 // same-site, non-user, renderer-initiated navigation 169 // same-site, non-user, renderer-initiated navigation
189 // before the slow cross-site navigation commits. 170 // before the slow cross-site navigation commits.
190 /* 171 /*
191 * This test case is disabled, because it is flaky and fails fairly 172 * This test case is disabled, because it is flaky and fails fairly
192 * consistently on MSan bots. See https://crbug.com/467800 173 * consistently on MSan bots. See https://crbug.com/467800
193 * 174 *
194 function crossProcessWithSameSiteCommit() { 175 function crossProcessWithSameSiteCommit() {
195 expect([ 176 expect([
196 { label: "a-onBeforeNavigate", 177 { label: "a-onBeforeNavigate",
197 event: "onBeforeNavigate", 178 event: "onBeforeNavigate",
198 details: { frameId: 0, 179 details: { frameId: 0,
199 parentFrameId: -1, 180 parentFrameId: -1,
200 processId: 0, 181 processId: -1,
201 tabId: 0, 182 tabId: 0,
202 timeStamp: 0, 183 timeStamp: 0,
203 url: getURL('d.html') }}, 184 url: getURL('d.html') }},
204 { label: "a-onCommitted", 185 { label: "a-onCommitted",
205 event: "onCommitted", 186 event: "onCommitted",
206 details: { frameId: 0, 187 details: { frameId: 0,
207 processId: 0, 188 processId: 0,
208 tabId: 0, 189 tabId: 0,
209 timeStamp: 0, 190 timeStamp: 0,
210 transitionQualifiers: [], 191 transitionQualifiers: [],
(...skipping 10 matching lines...) Expand all
221 event: "onCompleted", 202 event: "onCompleted",
222 details: { frameId: 0, 203 details: { frameId: 0,
223 processId: 0, 204 processId: 0,
224 tabId: 0, 205 tabId: 0,
225 timeStamp: 0, 206 timeStamp: 0,
226 url: getURL('d.html') }}, 207 url: getURL('d.html') }},
227 { label: "b-onBeforeNavigate", 208 { label: "b-onBeforeNavigate",
228 event: "onBeforeNavigate", 209 event: "onBeforeNavigate",
229 details: { frameId: 0, 210 details: { frameId: 0,
230 parentFrameId: -1, 211 parentFrameId: -1,
231 processId: 1, 212 processId: -1,
232 tabId: 0, 213 tabId: 0,
233 timeStamp: 0, 214 timeStamp: 0,
234 url: URL_TEST + "1" }}, 215 url: URL_TEST + "1" }},
235 { label: "b-onCommitted", 216 { label: "b-onCommitted",
236 event: "onCommitted", 217 event: "onCommitted",
237 details: { frameId: 0, 218 details: { frameId: 0,
238 processId: 1, 219 processId: 1,
239 tabId: 0, 220 tabId: 0,
240 timeStamp: 0, 221 timeStamp: 0,
241 transitionQualifiers: [], 222 transitionQualifiers: [],
(...skipping 10 matching lines...) Expand all
252 event: "onCompleted", 233 event: "onCompleted",
253 details: { frameId: 0, 234 details: { frameId: 0,
254 processId: 1, 235 processId: 1,
255 tabId: 0, 236 tabId: 0,
256 timeStamp: 0, 237 timeStamp: 0,
257 url: URL_TEST + "1" }}, 238 url: URL_TEST + "1" }},
258 { label: "c-onBeforeNavigate", 239 { label: "c-onBeforeNavigate",
259 event: "onBeforeNavigate", 240 event: "onBeforeNavigate",
260 details: { frameId: 0, 241 details: { frameId: 0,
261 parentFrameId: -1, 242 parentFrameId: -1,
262 processId: 0, 243 processId: -1,
263 tabId: 0, 244 tabId: 0,
264 timeStamp: 0, 245 timeStamp: 0,
265 url: getURL('empty.html') }}, 246 url: getURL('empty.html') }},
266 { label: "c-onCommitted", 247 { label: "c-onCommitted",
267 event: "onCommitted", 248 event: "onCommitted",
268 details: { frameId: 0, 249 details: { frameId: 0,
269 processId: 0, 250 processId: 0,
270 tabId: 0, 251 tabId: 0,
271 timeStamp: 0, 252 timeStamp: 0,
272 transitionQualifiers: ["client_redirect"], 253 transitionQualifiers: ["client_redirect"],
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // renderer-initiated navigation with user gesture. 285 // renderer-initiated navigation with user gesture.
305 // The expectation is that the cross-process navigation 286 // The expectation is that the cross-process navigation
306 // will be cancelled and the API should dispatch an onErrorOccurred 287 // will be cancelled and the API should dispatch an onErrorOccurred
307 // event. 288 // event.
308 function crossProcessAbortUserGesture() { 289 function crossProcessAbortUserGesture() {
309 expect([ 290 expect([
310 { label: "a-onBeforeNavigate", 291 { label: "a-onBeforeNavigate",
311 event: "onBeforeNavigate", 292 event: "onBeforeNavigate",
312 details: { frameId: 0, 293 details: { frameId: 0,
313 parentFrameId: -1, 294 parentFrameId: -1,
314 processId: 0, 295 processId: -1,
315 tabId: 0, 296 tabId: 0,
316 timeStamp: 0, 297 timeStamp: 0,
317 url: getURL('d.html') }}, 298 url: getURL('d.html') }},
318 { label: "a-onCommitted", 299 { label: "a-onCommitted",
319 event: "onCommitted", 300 event: "onCommitted",
320 details: { frameId: 0, 301 details: { frameId: 0,
321 processId: 0, 302 processId: 0,
322 tabId: 0, 303 tabId: 0,
323 timeStamp: 0, 304 timeStamp: 0,
324 transitionQualifiers: [], 305 transitionQualifiers: [],
(...skipping 10 matching lines...) Expand all
335 event: "onCompleted", 316 event: "onCompleted",
336 details: { frameId: 0, 317 details: { frameId: 0,
337 processId: 0, 318 processId: 0,
338 tabId: 0, 319 tabId: 0,
339 timeStamp: 0, 320 timeStamp: 0,
340 url: getURL('d.html') }}, 321 url: getURL('d.html') }},
341 { label: "b-onBeforeNavigate", 322 { label: "b-onBeforeNavigate",
342 event: "onBeforeNavigate", 323 event: "onBeforeNavigate",
343 details: { frameId: 0, 324 details: { frameId: 0,
344 parentFrameId: -1, 325 parentFrameId: -1,
345 processId: 1, 326 processId: -1,
346 tabId: 0, 327 tabId: 0,
347 timeStamp: 0, 328 timeStamp: 0,
348 url: URL_TEST + "2" }}, 329 url: URL_TEST + "2" }},
349 { label: "b-onErrorOccurred", 330 { label: "b-onErrorOccurred",
350 event: "onErrorOccurred", 331 event: "onErrorOccurred",
351 details: { error: "net::ERR_ABORTED", 332 details: { error: "net::ERR_ABORTED",
352 frameId: 0, 333 frameId: 0,
353 processId: 1, 334 processId: -1,
354 tabId: 0, 335 tabId: 0,
355 timeStamp: 0, 336 timeStamp: 0,
356 url: URL_TEST + "2" }}, 337 url: URL_TEST + "2" }},
357 { label: "c-onBeforeNavigate", 338 { label: "c-onBeforeNavigate",
358 event: "onBeforeNavigate", 339 event: "onBeforeNavigate",
359 details: { frameId: 0, 340 details: { frameId: 0,
360 parentFrameId: -1, 341 parentFrameId: -1,
361 processId: 0, 342 processId: -1,
362 tabId: 0, 343 tabId: 0,
363 timeStamp: 0, 344 timeStamp: 0,
364 url: getURL('empty.html') }}, 345 url: getURL('empty.html') }},
365 { label: "c-onCommitted", 346 { label: "c-onCommitted",
366 event: "onCommitted", 347 event: "onCommitted",
367 details: { frameId: 0, 348 details: { frameId: 0,
368 processId: 0, 349 processId: 0,
369 tabId: 0, 350 tabId: 0,
370 timeStamp: 0, 351 timeStamp: 0,
371 transitionQualifiers: ["client_redirect"], 352 transitionQualifiers: ["client_redirect"],
(...skipping 22 matching lines...) Expand all
394 // number. 375 // number.
395 chrome.tabs.update( 376 chrome.tabs.update(
396 tabId, 377 tabId,
397 { url: getURL('d.html?' + config.testServer.port + "/test2") }); 378 { url: getURL('d.html?' + config.testServer.port + "/test2") });
398 }, 379 },
399 380
400 ]); 381 ]);
401 }); 382 });
402 }); 383 });
403 }; 384 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698