Move Webstore URL concepts to //extensions and out
[chromium-blink-merge.git] / chrome / test / data / webui / net_internals / waterfall_view.js
blob8340ce12b14ec62436422993dd33e7dd01463c7a
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.
5 // Include test fixture.
6 GEN_INCLUDE(['net_internals_test.js']);
8 // Anonymous namespace
9 (function() {
11 TEST_F('NetInternalsTest', 'netInternalsWaterfallView', function() {
12 function runTestCase(testCase) {
13 var eventPairs = WaterfallRow.findUrlRequestEvents(testCase.sourceEntry);
14 expectEquals(eventPairs.length, testCase.expectedEventPairs.length);
15 for (var i = 0; i < eventPairs.length; ++i) {
16 expectEquals(eventPairs[i].startEntry.time,
17 testCase.expectedEventPairs[i].startTime);
18 expectEquals(eventPairs[i].endEntry.time,
19 testCase.expectedEventPairs[i].endTime);
20 expectEquals(eventPairs[i].startEntry.type,
21 testCase.expectedEventPairs[i].eventType);
22 expectEquals(eventPairs[i].endEntry.type,
23 testCase.expectedEventPairs[i].eventType);
25 SourceTracker.getInstance().clearEntries_();
28 function expectedEventPairsWithoutTcp() {
29 var expectedEventPairs = [
31 startTime: "369047367",
32 endTime: "369047371",
33 eventType: EventType.PROXY_SERVICE
36 startTime: "369047371",
37 endTime: "369047372",
38 eventType: EventType.HOST_RESOLVER_IMPL_REQUEST
41 startTime: "369047398",
42 endTime: "369047437",
43 eventType: EventType.SSL_CONNECT
46 startTime: "369047444",
47 endTime: "369047474",
48 eventType: EventType.HTTP_TRANSACTION_READ_HEADERS
51 return expectedEventPairs;
54 function logEntriesWithoutTcpConnection() {
55 var logEntries = [
57 "phase": EventPhase.PHASE_BEGIN,
58 "source": {
59 "id": 111,
60 "type": EventSourceType.URL_REQUEST
62 "time": "369047366",
63 "type": EventType.REQUEST_ALIVE
66 "params": {
67 "load_flags": 16480,
68 "method": "GET",
69 "priority": 1,
70 "url":
71 "https://www.google.com/searchdomaincheck?format=url&type=chrome"
73 "phase": EventPhase.PHASE_BEGIN,
74 "source": {
75 "id": 111,
76 "type": EventSourceType.URL_REQUEST
78 "time": "369047366",
79 "type": EventType.URL_REQUEST_START_JOB
82 "phase": EventPhase.PHASE_BEGIN,
83 "source": {
84 "id": 111,
85 "type": EventSourceType.URL_REQUEST
87 "time": "369047367",
88 "type": EventType.HTTP_STREAM_REQUEST
91 "params": {
92 "original_url": "https://www.google.com/",
93 "priority": 1,
94 "url": "https://www.google.com/"
96 "phase": EventPhase.PHASE_BEGIN,
97 "source": {
98 "id": 112,
99 "type": EventSourceType.HTTP_STREAM_JOB
101 "time": "369047367",
102 "type": EventType.HTTP_STREAM_JOB
105 "phase": EventPhase.PHASE_BEGIN,
106 "source": {
107 "id": 112,
108 "type": EventSourceType.HTTP_STREAM_JOB
110 "time": "369047367",
111 "type": EventType.PROXY_SERVICE
114 "phase": EventPhase.PHASE_END,
115 "source": {
116 "id": 112,
117 "type": EventSourceType.HTTP_STREAM_JOB
119 "time": "369047371",
120 "type": EventType.PROXY_SERVICE
123 "params": {
124 "source_dependency": {
125 "id": 113,
126 "type": EventSourceType.HOST_RESOLVER_IMPL_REQUEST
129 "phase": EventPhase.PHASE_BEGIN,
130 "source": {
131 "id": 112,
132 "type": EventSourceType.HTTP_STREAM_JOB
134 "time": "369047371",
135 "type": EventType.HOST_RESOLVER_IMPL
138 "params": {
139 "address_family": 0,
140 "allow_cached_response": true,
141 "host": "www.google.com:443",
142 "is_speculative": false,
143 "priority": 3,
144 "source_dependency": {
145 "id": 112,
146 "type": EventSourceType.HTTP_STREAM_JOB
149 "phase": EventPhase.PHASE_BEGIN,
150 "source": {
151 "id": 113,
152 "type": EventSourceType.HOST_RESOLVER_IMPL_REQUEST
154 "time": "369047371",
155 "type": EventType.HOST_RESOLVER_IMPL_REQUEST
158 "phase": EventPhase.PHASE_END,
159 "source": {
160 "id": 113,
161 "type": EventSourceType.HOST_RESOLVER_IMPL_REQUEST
163 "time": "369047372",
164 "type": EventType.HOST_RESOLVER_IMPL_REQUEST
167 "phase": EventPhase.PHASE_END,
168 "source": {
169 "id": 112,
170 "type": EventSourceType.HTTP_STREAM_JOB
172 "time": "369047372",
173 "type": EventType.HOST_RESOLVER_IMPL
176 "params": {
177 "group_name": "ssl/www.google.com:443"
179 "phase": EventPhase.PHASE_BEGIN,
180 "source": {
181 "id": 115,
182 "type": EventSourceType.CONNECT_JOB
184 "time": "369047372",
185 "type": EventType.SOCKET_POOL_CONNECT_JOB
188 "phase": EventPhase.PHASE_END,
189 "source": {
190 "id": 115,
191 "type": EventSourceType.CONNECT_JOB
193 "time": "369047437",
194 "type": EventType.SOCKET_POOL_CONNECT_JOB
197 "params": {
198 "source_dependency": {
199 "id": 124,
200 "type": EventSourceType.SOCKET
203 "phase": EventPhase.PHASE_NONE,
204 "source": {
205 "id": 112,
206 "type": EventSourceType.HTTP_STREAM_JOB
208 "time": "369047438",
209 "type": EventType.SOCKET_POOL_BOUND_TO_SOCKET
212 "phase": EventPhase.PHASE_END,
213 "source": {
214 "id": 112,
215 "type": EventSourceType.HTTP_STREAM_JOB
217 "time": "369047438",
218 "type": EventType.SOCKET_POOL
221 "params": {
222 "next_proto_status": "negotiated",
223 "proto": "spdy/3",
224 "server_protos": ""
226 "phase": EventPhase.PHASE_NONE,
227 "source": {
228 "id": 112,
229 "type": EventSourceType.HTTP_STREAM_JOB
231 "time": "369047438",
232 "type": EventType.HTTP_STREAM_REQUEST_PROTO
235 "params": {
236 "source_dependency": {
237 "id": 126,
238 "type": EventSourceType.HOST_RESOLVER_IMPL_REQUEST
241 "phase": EventPhase.PHASE_BEGIN,
242 "source": {
243 "id": 112,
244 "type": EventSourceType.HTTP_STREAM_JOB
246 "time": "369047438",
247 "type": EventType.HOST_RESOLVER_IMPL
250 "params": {
251 "address_family": 0,
252 "allow_cached_response": true,
253 "host": "www.google.com:443",
254 "is_speculative": false,
255 "priority": 3,
256 "source_dependency": {
257 "id": 112,
258 "type": EventSourceType.HTTP_STREAM_JOB
261 "phase": EventPhase.PHASE_BEGIN,
262 "source": {
263 "id": 126,
264 "type": EventSourceType.HOST_RESOLVER_IMPL_REQUEST
266 "time": "369047438",
267 "type": EventType.HOST_RESOLVER_IMPL_REQUEST
270 "phase": EventPhase.PHASE_END,
271 "source": {
272 "id": 112,
273 "type": EventSourceType.HTTP_STREAM_JOB
275 "time": "369047439",
276 "type": EventType.HOST_RESOLVER_IMPL
279 "params": {
280 "source_dependency": {
281 "id": 112,
282 "type": EventSourceType.HTTP_STREAM_JOB
285 "phase": EventPhase.PHASE_NONE,
286 "source": {
287 "id": 111,
288 "type": EventSourceType.URL_REQUEST
290 "time": "369047440",
291 "type": EventType.HTTP_STREAM_REQUEST_BOUND_TO_JOB
294 "phase": EventPhase.PHASE_END,
295 "source": {
296 "id": 111,
297 "type": EventSourceType.URL_REQUEST
299 "time": "369047440",
300 "type": EventType.HTTP_STREAM_REQUEST
303 "phase": EventPhase.PHASE_END,
304 "source": {
305 "id": 112,
306 "type": EventSourceType.HTTP_STREAM_JOB
308 "time": "369047440",
309 "type": EventType.HTTP_STREAM_JOB
312 "phase": EventPhase.PHASE_BEGIN,
313 "source": {
314 "id": 111,
315 "type": EventSourceType.URL_REQUEST
317 "time": "369047444",
318 "type": EventType.HTTP_TRANSACTION_READ_HEADERS
321 "phase": EventPhase.PHASE_END,
322 "source": {
323 "id": 111,
324 "type": EventSourceType.URL_REQUEST
326 "time": "369047474",
327 "type": EventType.HTTP_TRANSACTION_READ_HEADERS
330 "phase": EventPhase.PHASE_END,
331 "source": {
332 "id": 111,
333 "type": EventSourceType.URL_REQUEST
335 "time": "369047475",
336 "type": EventType.URL_REQUEST_START_JOB
339 "phase": EventPhase.PHASE_END,
340 "source": {
341 "id": 111,
342 "type": EventSourceType.URL_REQUEST
344 "time": "369047476",
345 "type": EventType.REQUEST_ALIVE
348 return logEntries;
351 function urlRequestConnectionAfterProxyService() {
352 var socketLogEntries = [
354 "params": {
355 "source_dependency": {
356 "id": 115,
357 "type": EventSourceType.CONNECT_JOB,
359 "phase": EventPhase.PHASE_BEGIN
361 "source": {
362 "id": 124,
363 "type": EventSourceType.SOCKET,
365 "time": "369047210",
366 "type": EventType.SOCKET_ALIVE
369 "params": {
370 "address_list": [
371 "[2607:f8b0:4006:802::1010]:443",
372 "74.125.226.211:443",
373 "74.125.226.212:443",
374 "74.125.226.208:443",
375 "74.125.226.209:443",
376 "74.125.226.210:443"
379 "phase": EventPhase.PHASE_BEGIN,
380 "source": {
381 "id": 124,
382 "type": EventSourceType.SOCKET
384 "time": "369047390",
385 "type": EventType.TCP_CONNECT
388 "params": {
389 "source_address": "[2620:0:1004:2:be30:5bff:fedb:49b2]:42259"
391 "phase": EventPhase.PHASE_END,
392 "source": {
393 "id": 124,
394 "type": EventSourceType.SOCKET
396 "time": "369047397",
397 "type": EventType.TCP_CONNECT
400 "params": {
401 "source_dependency": {
402 "id": 124,
403 "type": EventSourceType.SOCKET
406 "phase": EventPhase.PHASE_NONE,
407 "source": {
408 "id": 115,
409 "type": EventSourceType.CONNECT_JOB
411 "time": "369047398",
412 "type": EventType.SOCKET_POOL_BOUND_TO_SOCKET
415 "phase": EventPhase.PHASE_BEGIN,
416 "source": {
417 "id": 124,
418 "type": EventSourceType.SOCKET
420 "time": "369047398",
421 "type": EventType.SSL_CONNECT
424 "phase": EventPhase.PHASE_END,
425 "source": {
426 "id": 124,
427 "type": EventSourceType.SOCKET
429 "time": "369047437",
430 "type": EventType.SSL_CONNECT
434 var tcpConnect = {
435 startTime: "369047390",
436 endTime: "369047397",
437 eventType: EventType.TCP_CONNECT
440 var logEntries = logEntriesWithoutTcpConnection().concat(socketLogEntries);
441 g_browser.receivedLogEntries(logEntries);
443 var testCase = {};
444 testCase.sourceEntry = SourceTracker.getInstance().getSourceEntry(111);
446 var expectedEventPairs = expectedEventPairsWithoutTcp();
447 expectedEventPairs.splice(2, 0, tcpConnect);
448 testCase.expectedEventPairs = expectedEventPairs;
450 return testCase;
453 function urlRequestConnectionInProxyService() {
454 var socketLogEntries = [
456 "params": {
457 "source_dependency": {
458 "id": 115,
459 "type": EventSourceType.CONNECT_JOB,
461 "phase": EventPhase.PHASE_BEGIN
463 "source": {
464 "id": 124,
465 "type": EventSourceType.SOCKET,
467 "time": "369047210",
468 "type": EventType.SOCKET_ALIVE
471 "params": {
472 "address_list": [
473 "[2607:f8b0:4006:802::1010]:443",
474 "74.125.226.211:443",
475 "74.125.226.212:443",
476 "74.125.226.208:443",
477 "74.125.226.209:443",
478 "74.125.226.210:443"
481 "phase": EventPhase.PHASE_BEGIN,
482 "source": {
483 "id": 124,
484 "type": EventSourceType.SOCKET
486 "time": "369047370",
487 "type": EventType.TCP_CONNECT
490 "params": {
491 "source_address": "[2620:0:1004:2:be30:5bff:fedb:49b2]:42259"
493 "phase": EventPhase.PHASE_END,
494 "source": {
495 "id": 124,
496 "type": EventSourceType.SOCKET
498 "time": "369047397",
499 "type": EventType.TCP_CONNECT
502 "params": {
503 "source_dependency": {
504 "id": 124,
505 "type": EventSourceType.SOCKET
508 "phase": EventPhase.PHASE_NONE,
509 "source": {
510 "id": 115,
511 "type": EventSourceType.CONNECT_JOB
513 "time": "369047398",
514 "type": EventType.SOCKET_POOL_BOUND_TO_SOCKET
517 "phase": EventPhase.PHASE_BEGIN,
518 "source": {
519 "id": 124,
520 "type": EventSourceType.SOCKET
522 "time": "369047398",
523 "type": EventType.SSL_CONNECT
526 "phase": EventPhase.PHASE_END,
527 "source": {
528 "id": 124,
529 "type": EventSourceType.SOCKET
531 "time": "369047437",
532 "type": EventType.SSL_CONNECT
536 var tcpConnect = {
537 startTime: "369047371",
538 endTime: "369047397",
539 eventType: EventType.TCP_CONNECT
542 var logEntries = logEntriesWithoutTcpConnection().concat(socketLogEntries);
543 g_browser.receivedLogEntries(logEntries);
545 var testCase = {};
546 testCase.sourceEntry = SourceTracker.getInstance().getSourceEntry(111);
548 var expectedEventPairs = expectedEventPairsWithoutTcp();
549 expectedEventPairs.splice(2, 0, tcpConnect);
550 testCase.expectedEventPairs = expectedEventPairs;
552 return testCase;
555 function urlRequestConnectionBeforeProxyService() {
557 var socketLogEntries = [
559 "params": {
560 "source_dependency": {
561 "id": 115,
562 "type": EventSourceType.CONNECT_JOB,
564 "phase": EventPhase.PHASE_BEGIN
566 "source": {
567 "id": 124,
568 "type": EventSourceType.SOCKET,
570 "time": "369047210",
571 "type": EventType.SOCKET_ALIVE
574 "params": {
575 "address_list": [
576 "[2607:f8b0:4006:802::1010]:443",
577 "74.125.226.211:443",
578 "74.125.226.212:443",
579 "74.125.226.208:443",
580 "74.125.226.209:443",
581 "74.125.226.210:443"
584 "phase": EventPhase.PHASE_BEGIN,
585 "source": {
586 "id": 124,
587 "type": EventSourceType.SOCKET
589 "time": "369047350",
590 "type": EventType.TCP_CONNECT
593 "params": {
594 "source_address": "[2620:0:1004:2:be30:5bff:fedb:49b2]:42259"
596 "phase": EventPhase.PHASE_END,
597 "source": {
598 "id": 124,
599 "type": EventSourceType.SOCKET
601 "time": "369047357",
602 "type": EventType.TCP_CONNECT
605 "params": {
606 "source_dependency": {
607 "id": 124,
608 "type": EventSourceType.SOCKET
611 "phase": EventPhase.PHASE_NONE,
612 "source": {
613 "id": 115,
614 "type": EventSourceType.CONNECT_JOB
616 "time": "369047398",
617 "type": EventType.SOCKET_POOL_BOUND_TO_SOCKET
620 "phase": EventPhase.PHASE_BEGIN,
621 "source": {
622 "id": 124,
623 "type": EventSourceType.SOCKET
625 "time": "369047398",
626 "type": EventType.SSL_CONNECT
629 "phase": EventPhase.PHASE_END,
630 "source": {
631 "id": 124,
632 "type": EventSourceType.SOCKET
634 "time": "369047437",
635 "type": EventType.SSL_CONNECT
638 var logEntries = logEntriesWithoutTcpConnection().concat(socketLogEntries);
639 g_browser.receivedLogEntries(logEntries);
641 var testCase = {};
642 testCase.sourceEntry = SourceTracker.getInstance().getSourceEntry(111);
643 testCase.expectedEventPairs = expectedEventPairsWithoutTcp();
645 return testCase;
648 runTestCase(urlRequestConnectionAfterProxyService());
649 runTestCase(urlRequestConnectionInProxyService());
650 runTestCase(urlRequestConnectionBeforeProxyService());
652 testDone();
655 })(); // Anonymous namespace