Supervised user import: Listen for profile creation/deletion
[chromium-blink-merge.git] / chrome / test / data / webui / net_internals / waterfall_view.js
bloba8825d9f73f959549ada56a79d6beb07384a6748
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(testCase.expectedEventPairs.length, eventPairs.length);
15 for (var i = 0; i < eventPairs.length; ++i) {
16 expectEquals(testCase.expectedEventPairs[i].startTime,
17 eventPairs[i].startEntry.time);
18 expectEquals(testCase.expectedEventPairs[i].endTime,
19 eventPairs[i].endEntry.time);
20 expectEquals(testCase.expectedEventPairs[i].eventType,
21 eventPairs[i].startEntry.type);
22 expectEquals(testCase.expectedEventPairs[i].eventType,
23 eventPairs[i].endEntry.type);
25 SourceTracker.getInstance().clearEntries_();
28 function expectedEventPairsWithoutTcp() {
29 var expectedEventPairs = [
31 startTime: "369047367",
32 endTime: "369047371",
33 eventType: EventType.PROXY_SERVICE
36 startTime: "369047398",
37 endTime: "369047437",
38 eventType: EventType.SSL_CONNECT
41 startTime: "369047444",
42 endTime: "369047474",
43 eventType: EventType.HTTP_TRANSACTION_READ_HEADERS
46 return expectedEventPairs;
49 function logEntriesWithoutTcpConnection() {
50 var logEntries = [
52 "phase": EventPhase.PHASE_BEGIN,
53 "source": {
54 "id": 111,
55 "type": EventSourceType.URL_REQUEST
57 "time": "369047366",
58 "type": EventType.REQUEST_ALIVE
61 "params": {
62 "load_flags": 16480,
63 "method": "GET",
64 "priority": 1,
65 "url":
66 "https://www.google.com/searchdomaincheck?format=url&type=chrome"
68 "phase": EventPhase.PHASE_BEGIN,
69 "source": {
70 "id": 111,
71 "type": EventSourceType.URL_REQUEST
73 "time": "369047366",
74 "type": EventType.URL_REQUEST_START_JOB
77 "phase": EventPhase.PHASE_BEGIN,
78 "source": {
79 "id": 111,
80 "type": EventSourceType.URL_REQUEST
82 "time": "369047367",
83 "type": EventType.HTTP_STREAM_REQUEST
86 "params": {
87 "original_url": "https://www.google.com/",
88 "priority": 1,
89 "url": "https://www.google.com/"
91 "phase": EventPhase.PHASE_BEGIN,
92 "source": {
93 "id": 112,
94 "type": EventSourceType.HTTP_STREAM_JOB
96 "time": "369047367",
97 "type": EventType.HTTP_STREAM_JOB
100 "phase": EventPhase.PHASE_BEGIN,
101 "source": {
102 "id": 112,
103 "type": EventSourceType.HTTP_STREAM_JOB
105 "time": "369047367",
106 "type": EventType.PROXY_SERVICE
109 "phase": EventPhase.PHASE_END,
110 "source": {
111 "id": 112,
112 "type": EventSourceType.HTTP_STREAM_JOB
114 "time": "369047371",
115 "type": EventType.PROXY_SERVICE
118 "params": {
119 "address_family": 0,
120 "allow_cached_response": true,
121 "host": "www.google.com:443",
122 "is_speculative": false,
123 "priority": 3
125 "phase": EventPhase.PHASE_BEGIN,
126 "source": {
127 "id": 112,
128 "type": EventSourceType.HTTP_STREAM_JOB
130 "time": "369047371",
131 "type": EventType.HOST_RESOLVER_IMPL_REQUEST
134 "phase": EventPhase.PHASE_END,
135 "source": {
136 "id": 112,
137 "type": EventSourceType.HTTP_STREAM_JOB
139 "time": "369047372",
140 "type": EventType.HOST_RESOLVER_IMPL_REQUEST
143 "params": {
144 "group_name": "ssl/www.google.com:443"
146 "phase": EventPhase.PHASE_BEGIN,
147 "source": {
148 "id": 115,
149 "type": EventSourceType.CONNECT_JOB
151 "time": "369047372",
152 "type": EventType.SOCKET_POOL_CONNECT_JOB
155 "phase": EventPhase.PHASE_END,
156 "source": {
157 "id": 115,
158 "type": EventSourceType.CONNECT_JOB
160 "time": "369047437",
161 "type": EventType.SOCKET_POOL_CONNECT_JOB
164 "params": {
165 "source_dependency": {
166 "id": 124,
167 "type": EventSourceType.SOCKET
170 "phase": EventPhase.PHASE_NONE,
171 "source": {
172 "id": 112,
173 "type": EventSourceType.HTTP_STREAM_JOB
175 "time": "369047438",
176 "type": EventType.SOCKET_POOL_BOUND_TO_SOCKET
179 "phase": EventPhase.PHASE_END,
180 "source": {
181 "id": 112,
182 "type": EventSourceType.HTTP_STREAM_JOB
184 "time": "369047438",
185 "type": EventType.SOCKET_POOL
188 "params": {
189 "next_proto_status": "negotiated",
190 "proto": "spdy/3",
191 "server_protos": ""
193 "phase": EventPhase.PHASE_NONE,
194 "source": {
195 "id": 112,
196 "type": EventSourceType.HTTP_STREAM_JOB
198 "time": "369047438",
199 "type": EventType.HTTP_STREAM_REQUEST_PROTO
202 "params": {
203 "address_family": 0,
204 "allow_cached_response": true,
205 "host": "www.google.com:443",
206 "is_speculative": false,
207 "priority": 3
209 "phase": EventPhase.PHASE_BEGIN,
210 "source": {
211 "id": 112,
212 "type": EventSourceType.HTTP_STREAM_JOB
214 "time": "369047438",
215 "type": EventType.HOST_RESOLVER_IMPL_REQUEST
218 "phase": EventPhase.PHASE_END,
219 "source": {
220 "id": 112,
221 "type": EventSourceType.HTTP_STREAM_JOB
223 "time": "369047439",
224 "type": EventType.HOST_RESOLVER_IMPL_REQUEST
227 "params": {
228 "source_dependency": {
229 "id": 112,
230 "type": EventSourceType.HTTP_STREAM_JOB
233 "phase": EventPhase.PHASE_NONE,
234 "source": {
235 "id": 111,
236 "type": EventSourceType.URL_REQUEST
238 "time": "369047440",
239 "type": EventType.HTTP_STREAM_REQUEST_BOUND_TO_JOB
242 "phase": EventPhase.PHASE_END,
243 "source": {
244 "id": 111,
245 "type": EventSourceType.URL_REQUEST
247 "time": "369047440",
248 "type": EventType.HTTP_STREAM_REQUEST
251 "phase": EventPhase.PHASE_END,
252 "source": {
253 "id": 112,
254 "type": EventSourceType.HTTP_STREAM_JOB
256 "time": "369047440",
257 "type": EventType.HTTP_STREAM_JOB
260 "phase": EventPhase.PHASE_BEGIN,
261 "source": {
262 "id": 111,
263 "type": EventSourceType.URL_REQUEST
265 "time": "369047444",
266 "type": EventType.HTTP_TRANSACTION_READ_HEADERS
269 "phase": EventPhase.PHASE_END,
270 "source": {
271 "id": 111,
272 "type": EventSourceType.URL_REQUEST
274 "time": "369047474",
275 "type": EventType.HTTP_TRANSACTION_READ_HEADERS
278 "phase": EventPhase.PHASE_END,
279 "source": {
280 "id": 111,
281 "type": EventSourceType.URL_REQUEST
283 "time": "369047475",
284 "type": EventType.URL_REQUEST_START_JOB
287 "phase": EventPhase.PHASE_END,
288 "source": {
289 "id": 111,
290 "type": EventSourceType.URL_REQUEST
292 "time": "369047476",
293 "type": EventType.REQUEST_ALIVE
296 return logEntries;
299 function urlRequestConnectionAfterProxyService() {
300 var socketLogEntries = [
302 "params": {
303 "source_dependency": {
304 "id": 115,
305 "type": EventSourceType.CONNECT_JOB,
307 "phase": EventPhase.PHASE_BEGIN
309 "source": {
310 "id": 124,
311 "type": EventSourceType.SOCKET,
313 "time": "369047210",
314 "type": EventType.SOCKET_ALIVE
317 "params": {
318 "address_list": [
319 "[2607:f8b0:4006:802::1010]:443",
320 "74.125.226.211:443",
321 "74.125.226.212:443",
322 "74.125.226.208:443",
323 "74.125.226.209:443",
324 "74.125.226.210:443"
327 "phase": EventPhase.PHASE_BEGIN,
328 "source": {
329 "id": 124,
330 "type": EventSourceType.SOCKET
332 "time": "369047390",
333 "type": EventType.TCP_CONNECT
336 "params": {
337 "source_address": "[2620:0:1004:2:be30:5bff:fedb:49b2]:42259"
339 "phase": EventPhase.PHASE_END,
340 "source": {
341 "id": 124,
342 "type": EventSourceType.SOCKET
344 "time": "369047397",
345 "type": EventType.TCP_CONNECT
348 "params": {
349 "source_dependency": {
350 "id": 124,
351 "type": EventSourceType.SOCKET
354 "phase": EventPhase.PHASE_NONE,
355 "source": {
356 "id": 115,
357 "type": EventSourceType.CONNECT_JOB
359 "time": "369047398",
360 "type": EventType.SOCKET_POOL_BOUND_TO_SOCKET
363 "phase": EventPhase.PHASE_BEGIN,
364 "source": {
365 "id": 124,
366 "type": EventSourceType.SOCKET
368 "time": "369047398",
369 "type": EventType.SSL_CONNECT
372 "phase": EventPhase.PHASE_END,
373 "source": {
374 "id": 124,
375 "type": EventSourceType.SOCKET
377 "time": "369047437",
378 "type": EventType.SSL_CONNECT
382 var tcpConnect = {
383 startTime: "369047390",
384 endTime: "369047397",
385 eventType: EventType.TCP_CONNECT
388 var logEntries = logEntriesWithoutTcpConnection().concat(socketLogEntries);
389 g_browser.receivedLogEntries(logEntries);
391 var testCase = {};
392 testCase.sourceEntry = SourceTracker.getInstance().getSourceEntry(111);
394 var expectedEventPairs = expectedEventPairsWithoutTcp();
395 expectedEventPairs.splice(1, 0, tcpConnect);
396 testCase.expectedEventPairs = expectedEventPairs;
398 return testCase;
401 function urlRequestConnectionInProxyService() {
402 var socketLogEntries = [
404 "params": {
405 "source_dependency": {
406 "id": 115,
407 "type": EventSourceType.CONNECT_JOB,
409 "phase": EventPhase.PHASE_BEGIN
411 "source": {
412 "id": 124,
413 "type": EventSourceType.SOCKET,
415 "time": "369047210",
416 "type": EventType.SOCKET_ALIVE
419 "params": {
420 "address_list": [
421 "[2607:f8b0:4006:802::1010]:443",
422 "74.125.226.211:443",
423 "74.125.226.212:443",
424 "74.125.226.208:443",
425 "74.125.226.209:443",
426 "74.125.226.210:443"
429 "phase": EventPhase.PHASE_BEGIN,
430 "source": {
431 "id": 124,
432 "type": EventSourceType.SOCKET
434 "time": "369047370",
435 "type": EventType.TCP_CONNECT
438 "params": {
439 "source_address": "[2620:0:1004:2:be30:5bff:fedb:49b2]:42259"
441 "phase": EventPhase.PHASE_END,
442 "source": {
443 "id": 124,
444 "type": EventSourceType.SOCKET
446 "time": "369047397",
447 "type": EventType.TCP_CONNECT
450 "params": {
451 "source_dependency": {
452 "id": 124,
453 "type": EventSourceType.SOCKET
456 "phase": EventPhase.PHASE_NONE,
457 "source": {
458 "id": 115,
459 "type": EventSourceType.CONNECT_JOB
461 "time": "369047398",
462 "type": EventType.SOCKET_POOL_BOUND_TO_SOCKET
465 "phase": EventPhase.PHASE_BEGIN,
466 "source": {
467 "id": 124,
468 "type": EventSourceType.SOCKET
470 "time": "369047398",
471 "type": EventType.SSL_CONNECT
474 "phase": EventPhase.PHASE_END,
475 "source": {
476 "id": 124,
477 "type": EventSourceType.SOCKET
479 "time": "369047437",
480 "type": EventType.SSL_CONNECT
484 var tcpConnect = {
485 startTime: "369047371",
486 endTime: "369047397",
487 eventType: EventType.TCP_CONNECT
490 var logEntries = logEntriesWithoutTcpConnection().concat(socketLogEntries);
491 g_browser.receivedLogEntries(logEntries);
493 var testCase = {};
494 testCase.sourceEntry = SourceTracker.getInstance().getSourceEntry(111);
496 var expectedEventPairs = expectedEventPairsWithoutTcp();
497 expectedEventPairs.splice(1, 0, tcpConnect);
498 testCase.expectedEventPairs = expectedEventPairs;
500 return testCase;
503 function urlRequestConnectionBeforeProxyService() {
505 var socketLogEntries = [
507 "params": {
508 "source_dependency": {
509 "id": 115,
510 "type": EventSourceType.CONNECT_JOB,
512 "phase": EventPhase.PHASE_BEGIN
514 "source": {
515 "id": 124,
516 "type": EventSourceType.SOCKET,
518 "time": "369047210",
519 "type": EventType.SOCKET_ALIVE
522 "params": {
523 "address_list": [
524 "[2607:f8b0:4006:802::1010]:443",
525 "74.125.226.211:443",
526 "74.125.226.212:443",
527 "74.125.226.208:443",
528 "74.125.226.209:443",
529 "74.125.226.210:443"
532 "phase": EventPhase.PHASE_BEGIN,
533 "source": {
534 "id": 124,
535 "type": EventSourceType.SOCKET
537 "time": "369047350",
538 "type": EventType.TCP_CONNECT
541 "params": {
542 "source_address": "[2620:0:1004:2:be30:5bff:fedb:49b2]:42259"
544 "phase": EventPhase.PHASE_END,
545 "source": {
546 "id": 124,
547 "type": EventSourceType.SOCKET
549 "time": "369047357",
550 "type": EventType.TCP_CONNECT
553 "params": {
554 "source_dependency": {
555 "id": 124,
556 "type": EventSourceType.SOCKET
559 "phase": EventPhase.PHASE_NONE,
560 "source": {
561 "id": 115,
562 "type": EventSourceType.CONNECT_JOB
564 "time": "369047398",
565 "type": EventType.SOCKET_POOL_BOUND_TO_SOCKET
568 "phase": EventPhase.PHASE_BEGIN,
569 "source": {
570 "id": 124,
571 "type": EventSourceType.SOCKET
573 "time": "369047398",
574 "type": EventType.SSL_CONNECT
577 "phase": EventPhase.PHASE_END,
578 "source": {
579 "id": 124,
580 "type": EventSourceType.SOCKET
582 "time": "369047437",
583 "type": EventType.SSL_CONNECT
586 var logEntries = logEntriesWithoutTcpConnection().concat(socketLogEntries);
587 g_browser.receivedLogEntries(logEntries);
589 var testCase = {};
590 testCase.sourceEntry = SourceTracker.getInstance().getSourceEntry(111);
591 testCase.expectedEventPairs = expectedEventPairsWithoutTcp();
593 return testCase;
596 runTestCase(urlRequestConnectionAfterProxyService());
597 runTestCase(urlRequestConnectionInProxyService());
598 runTestCase(urlRequestConnectionBeforeProxyService());
600 testDone();
603 })(); // Anonymous namespace