1 // Copyright (c) 2012 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']);
12 * Check that stripCookiesAndLoginInfo correctly removes cookies and login
15 TEST_F('NetInternalsTest', 'netInternalsLogViewPainterStripInfo', function() {
16 // Each entry in |expectations| is a list consisting of a header element
17 // before and after applying the filter. If the second entry is null, the
18 // element should be unmodified.
20 ['set-cookie: blah', 'set-cookie: [4 bytes were stripped]'],
21 ['set-cookie2: blah', 'set-cookie2: [4 bytes were stripped]'],
22 ['cookie: blah', 'cookie: [4 bytes were stripped]'],
23 ['authorization: NTLM blah', 'authorization: NTLM [4 bytes were stripped]'],
25 ['proxy-authorization: Basic blah',
26 'proxy-authorization: Basic [4 bytes were stripped]'],
28 ['WWW-Authenticate: Basic realm="Something, or another"', null],
30 ['WWW-Authenticate: Negotiate blah-token-blah',
31 'WWW-Authenticate: Negotiate [15 bytes were stripped]'],
33 ['WWW-Authenticate: NTLM asdllk2j3l423lk4j23l4kj',
34 'WWW-Authenticate: NTLM [23 bytes were stripped]'],
36 ['WWW-Authenticate: Kerberos , Negotiate asdfasdfasdfasfa', null],
37 ['WWW-Authenticate: Kerberos, Negotiate asdfasdfasdfasfa', null],
38 ['WWW-Authenticate: Digest , Negotiate asdfasdfasdfasfa', null],
39 ['WWW-Authenticate: Digest realm="Foo realm", Negotiate asdf', null],
40 ['WWW-Authenticate: Kerberos,Digest,Basic', null],
41 ['WWW-Authenticate: Digest realm="asdfasdf", nonce=5, qop="auth"', null],
42 ['WWW-Authenticate: Basic realm=foo,foo=bar , Digest ', null],
43 ['Proxy-Authenticate: Basic realm="Something, or another"', null],
45 ['Proxy-Authenticate: Negotiate blah-token-blah',
46 'Proxy-Authenticate: Negotiate [15 bytes were stripped]'],
48 ['Proxy-Authenticate: NTLM asdllk2j3l423lk4j23l4kj',
49 'Proxy-Authenticate: NTLM [23 bytes were stripped]'],
51 ['Proxy-Authenticate: Kerberos , Negotiate asdfasdfa', null],
52 ['Proxy-Authenticate: Kerberos, Negotiate asdfasdfa', null],
53 ['Proxy-Authenticate: Digest , Negotiate asdfasdfa', null],
54 ['Proxy-Authenticate: Digest realm="Foo realm", Negotiate asdfasdfa', null],
55 ['Proxy-Authenticate: Kerberos,Digest,Basic', null],
56 ['Proxy-Authenticate: Digest realm="asdfasdf", nonce=5, qop="auth"', null],
57 ['Proxy-Authenticate: Basic realm=foo,foo=bar , Digest ', null],
59 ['cookie: Stuff [4 bytes were stripped]',
60 'cookie: [29 bytes were stripped]'],
61 ['cookie: [4 bytes were stripped] Stuff',
62 'cookie: [29 bytes were stripped]'],
63 ['set-cookie: [4 bytes were stripped]', null],
64 ['Proxy-Authenticate: NTLM [23 bytes were stripped]', null],
65 ['cookie: [value was stripped]', null],
68 for (var i
= 0; i
< expectations
.length
; ++i
) {
69 var expectation
= expectations
[i
];
70 // Position within params.headers where the authentication information goes.
71 for (var position
= 0; position
< 3; ++position
) {
75 'Host: clients1.google.com',
76 'Connection: keep-alive',
77 'User-Agent: Mozilla/5.0'
79 'line': 'GET / HTTP/1.1\r\n'
81 'phase': EventPhase
.PHASE_BEGIN
,
82 'source': {'id': 329, 'type': EventSourceType
.URL_REQUEST
},
84 'type': EventSourceType
.URL_REQUEST
87 entry
.params
.headers
[position
] = expectation
[0];
88 var stripped
= stripCookiesAndLoginInfo(entry
);
89 // The entry should be duplicated, so the original still has the deleted
91 expectNotEquals(stripped
, entry
);
92 if (expectation
[1] == null) {
93 expectEquals(expectation
[0], stripped
.params
.headers
[position
]);
95 expectEquals(expectation
[1], stripped
.params
.headers
[position
]);
100 // Test with SPDY request headers, which use an object rather than an array.
101 var spdyRequestHeadersEntry
= {
104 ':host': 'clients1.google.com',
106 ':path': '/cute/cat/pictures/',
109 'line': 'GET / HTTP/1.1\r\n'
111 'phase': EventPhase
.PHASE_BEGIN
,
112 'source': {'id': 329, 'type': EventSourceType
.URL_REQUEST
},
114 'type': EventSourceType
.HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS
116 var strippedSpdyRequestHeadersEntry
=
117 stripCookiesAndLoginInfo(spdyRequestHeadersEntry
);
118 expectEquals('cookie: [4 bytes were stripped]',
119 strippedSpdyRequestHeadersEntry
.params
.headers
[3]);
125 * Tests the formatting of log entries to fixed width text.
127 TEST_F('NetInternalsTest', 'netInternalsLogViewPainterPrintAsText', function() {
128 // Add a DOM node to draw the log entries into.
129 var div
= addNode(document
.body
, 'div');
131 // Helper function to run a particular "test case". This comprises an input
132 // and the resulting formatted text expectation.
133 function runTestCase(testCase
) {
135 timeutil
.setTimeTickOffset(testCase
.tickOffset
);
138 if (typeof testCase
.baseTimeTicks
!= 'undefined')
139 baseTime
= timeutil
.convertTimeTicksToTime(testCase
.baseTimeTicks
);
142 createLogEntryTablePrinter(testCase
.logEntries
,
143 testCase
.privacyStripping
,
144 baseTime
, testCase
.logCreationTime
);
145 tablePrinter
.toText(0, div
);
147 // Strip any trailing newlines, since the whitespace when using innerText
148 // can be a bit unpredictable.
149 var actualText
= div
.innerText
;
150 actualText
= actualText
.replace(/^\s+|\s+$/g, '');
152 expectEquals(testCase
.expectedText
, actualText
);
155 runTestCase(painterTestURLRequest());
156 runTestCase(painterTestURLRequestIncomplete());
157 runTestCase(painterTestURLRequestIncompleteFromLoadedLog());
158 runTestCase(painterTestURLRequestIncompleteFromLoadedLogSingleEvent());
159 runTestCase(painterTestNetError());
160 runTestCase(painterTestQuicError());
161 runTestCase(painterTestQuicCryptoHandshakeMessage());
162 runTestCase(painterTestHexEncodedBytes());
163 runTestCase(painterTestCertVerifierJob());
164 runTestCase(painterTestCertVerifyResult());
165 runTestCase(painterTestProxyConfigOneProxyAllSchemes());
166 runTestCase(painterTestProxyConfigTwoProxiesAllSchemes());
167 runTestCase(painterTestDontStripCookiesURLRequest());
168 runTestCase(painterTestStripCookiesURLRequest());
169 runTestCase(painterTestDontStripCookiesSPDYSession());
170 runTestCase(painterTestStripCookiesSPDYSession());
171 runTestCase(painterTestSpdyURLRequestDontStripCookies());
172 runTestCase(painterTestSpdyURLRequestStripCookies());
173 runTestCase(painterTestExtraCustomParameter());
174 runTestCase(painterTestMissingCustomParameter());
175 runTestCase(painterTestSSLVersionFallback());
176 runTestCase(painterTestInProgressURLRequest());
177 runTestCase(painterTestBaseTime());
183 * Test case for a URLRequest. This includes custom formatting for load flags,
184 * request/response HTTP headers, dependent sources, as well as basic
185 * indentation and grouping. Also makes sure that no extra event is logged
186 * for finished sources when there's a logCreationTime.
188 function painterTestURLRequest() {
190 testCase
.tickOffset
= '1337911098446';
191 testCase
.logCreationTime
= 1338864634013;
193 testCase
.logEntries
= [
195 'phase': EventPhase
.PHASE_BEGIN
,
198 'type': EventSourceType
.URL_REQUEST
201 'type': EventType
.REQUEST_ALIVE
205 'load_flags': 68222976,
208 'url': 'http://www.google.com/'
210 'phase': EventPhase
.PHASE_BEGIN
,
213 'type': EventSourceType
.URL_REQUEST
216 'type': EventType
.URL_REQUEST_START_JOB
219 'phase': EventPhase
.PHASE_END
,
222 'type': EventSourceType
.URL_REQUEST
225 'type': EventType
.URL_REQUEST_START_JOB
229 'load_flags': 68222976,
232 'url': 'http://www.google.com/'
234 'phase': EventPhase
.PHASE_BEGIN
,
237 'type': EventSourceType
.URL_REQUEST
240 'type': EventType
.URL_REQUEST_START_JOB
243 'phase': EventPhase
.PHASE_BEGIN
,
246 'type': EventSourceType
.URL_REQUEST
249 'type': EventType
.HTTP_CACHE_GET_BACKEND
252 'phase': EventPhase
.PHASE_END
,
255 'type': EventSourceType
.URL_REQUEST
258 'type': EventType
.HTTP_CACHE_GET_BACKEND
261 'phase': EventPhase
.PHASE_BEGIN
,
264 'type': EventSourceType
.URL_REQUEST
267 'type': EventType
.HTTP_CACHE_OPEN_ENTRY
270 'phase': EventPhase
.PHASE_END
,
273 'type': EventSourceType
.URL_REQUEST
276 'type': EventType
.HTTP_CACHE_OPEN_ENTRY
279 'phase': EventPhase
.PHASE_BEGIN
,
282 'type': EventSourceType
.URL_REQUEST
285 'type': EventType
.HTTP_CACHE_ADD_TO_ENTRY
288 'phase': EventPhase
.PHASE_END
,
291 'type': EventSourceType
.URL_REQUEST
294 'type': EventType
.HTTP_CACHE_ADD_TO_ENTRY
297 'phase': EventPhase
.PHASE_BEGIN
,
300 'type': EventSourceType
.URL_REQUEST
303 'type': EventType
.HTTP_CACHE_READ_INFO
306 'phase': EventPhase
.PHASE_END
,
309 'type': EventSourceType
.URL_REQUEST
312 'type': EventType
.HTTP_CACHE_READ_INFO
315 'phase': EventPhase
.PHASE_BEGIN
,
318 'type': EventSourceType
.URL_REQUEST
321 'type': EventType
.HTTP_STREAM_REQUEST
325 'source_dependency': {
327 'type': EventSourceType
.HTTP_STREAM_JOB
330 'phase': EventPhase
.PHASE_NONE
,
333 'type': EventSourceType
.URL_REQUEST
336 'type': EventType
.HTTP_STREAM_REQUEST_BOUND_TO_JOB
339 'phase': EventPhase
.PHASE_END
,
342 'type': EventSourceType
.URL_REQUEST
345 'type': EventType
.HTTP_STREAM_REQUEST
348 'phase': EventPhase
.PHASE_BEGIN
,
351 'type': EventSourceType
.URL_REQUEST
354 'type': EventType
.HTTP_TRANSACTION_SEND_REQUEST
359 'Host: www.google.com',
360 'Connection: keep-alive',
361 'User-Agent: Mozilla/5.0',
363 'Accept-Encoding: gzip,deflate,sdch',
364 'Accept-Language: en-US,en;q=0.8',
365 'Accept-Charset: ISO-8859-1'
367 'line': 'GET / HTTP/1.1\r\n'
369 'phase': EventPhase
.PHASE_NONE
,
372 'type': EventSourceType
.URL_REQUEST
375 'type': EventType
.HTTP_TRANSACTION_SEND_REQUEST_HEADERS
378 'phase': EventPhase
.PHASE_END
,
381 'type': EventSourceType
.URL_REQUEST
384 'type': EventType
.HTTP_TRANSACTION_SEND_REQUEST
387 'phase': EventPhase
.PHASE_BEGIN
,
390 'type': EventSourceType
.URL_REQUEST
393 'type': EventType
.HTTP_TRANSACTION_READ_HEADERS
396 'phase': EventPhase
.PHASE_BEGIN
,
399 'type': EventSourceType
.URL_REQUEST
402 'type': EventType
.HTTP_STREAM_PARSER_READ_HEADERS
405 'phase': EventPhase
.PHASE_END
,
408 'type': EventSourceType
.URL_REQUEST
411 'type': EventType
.HTTP_STREAM_PARSER_READ_HEADERS
417 'Date: Tue, 05 Jun 2012 02:50:33 GMT',
419 'Cache-Control: private, max-age=0',
420 'Content-Type: text/html; charset=UTF-8',
421 'Content-Encoding: gzip',
423 'Content-Length: 23798',
426 'phase': EventPhase
.PHASE_NONE
,
429 'type': EventSourceType
.URL_REQUEST
432 'type': EventType
.HTTP_TRANSACTION_READ_RESPONSE_HEADERS
435 'phase': EventPhase
.PHASE_END
,
438 'type': EventSourceType
.URL_REQUEST
441 'type': EventType
.HTTP_TRANSACTION_READ_HEADERS
444 'phase': EventPhase
.PHASE_BEGIN
,
447 'type': EventSourceType
.URL_REQUEST
450 'type': EventType
.HTTP_CACHE_WRITE_INFO
453 'phase': EventPhase
.PHASE_END
,
456 'type': EventSourceType
.URL_REQUEST
459 'type': EventType
.HTTP_CACHE_WRITE_INFO
462 'phase': EventPhase
.PHASE_BEGIN
,
465 'type': EventSourceType
.URL_REQUEST
468 'type': EventType
.HTTP_CACHE_WRITE_DATA
471 'phase': EventPhase
.PHASE_END
,
474 'type': EventSourceType
.URL_REQUEST
477 'type': EventType
.HTTP_CACHE_WRITE_DATA
480 'phase': EventPhase
.PHASE_BEGIN
,
483 'type': EventSourceType
.URL_REQUEST
486 'type': EventType
.HTTP_CACHE_WRITE_INFO
489 'phase': EventPhase
.PHASE_END
,
492 'type': EventSourceType
.URL_REQUEST
495 'type': EventType
.HTTP_CACHE_WRITE_INFO
498 'phase': EventPhase
.PHASE_END
,
501 'type': EventSourceType
.URL_REQUEST
504 'type': EventType
.URL_REQUEST_START_JOB
507 'phase': EventPhase
.PHASE_BEGIN
,
510 'type': EventSourceType
.URL_REQUEST
513 'type': EventType
.HTTP_TRANSACTION_READ_BODY
516 'phase': EventPhase
.PHASE_END
,
519 'type': EventSourceType
.URL_REQUEST
522 'type': EventType
.HTTP_TRANSACTION_READ_BODY
525 'phase': EventPhase
.PHASE_BEGIN
,
528 'type': EventSourceType
.URL_REQUEST
531 'type': EventType
.HTTP_CACHE_WRITE_DATA
534 'phase': EventPhase
.PHASE_END
,
537 'type': EventSourceType
.URL_REQUEST
540 'type': EventType
.HTTP_CACHE_WRITE_DATA
543 'phase': EventPhase
.PHASE_BEGIN
,
546 'type': EventSourceType
.URL_REQUEST
549 'type': EventType
.HTTP_TRANSACTION_READ_BODY
552 'phase': EventPhase
.PHASE_END
,
555 'type': EventSourceType
.URL_REQUEST
558 'type': EventType
.HTTP_TRANSACTION_READ_BODY
561 'phase': EventPhase
.PHASE_BEGIN
,
564 'type': EventSourceType
.URL_REQUEST
567 'type': EventType
.HTTP_CACHE_WRITE_DATA
570 'phase': EventPhase
.PHASE_END
,
573 'type': EventSourceType
.URL_REQUEST
576 'type': EventType
.HTTP_CACHE_WRITE_DATA
579 'phase': EventPhase
.PHASE_BEGIN
,
582 'type': EventSourceType
.URL_REQUEST
585 'type': EventType
.HTTP_TRANSACTION_READ_BODY
588 'phase': EventPhase
.PHASE_END
,
591 'type': EventSourceType
.URL_REQUEST
594 'type': EventType
.HTTP_TRANSACTION_READ_BODY
597 'phase': EventPhase
.PHASE_BEGIN
,
600 'type': EventSourceType
.URL_REQUEST
603 'type': EventType
.HTTP_CACHE_WRITE_DATA
606 'phase': EventPhase
.PHASE_END
,
609 'type': EventSourceType
.URL_REQUEST
612 'type': EventType
.HTTP_CACHE_WRITE_DATA
615 'phase': EventPhase
.PHASE_BEGIN
,
618 'type': EventSourceType
.URL_REQUEST
621 'type': EventType
.HTTP_TRANSACTION_READ_BODY
624 'phase': EventPhase
.PHASE_END
,
627 'type': EventSourceType
.URL_REQUEST
630 'type': EventType
.HTTP_TRANSACTION_READ_BODY
633 'phase': EventPhase
.PHASE_BEGIN
,
636 'type': EventSourceType
.URL_REQUEST
639 'type': EventType
.HTTP_CACHE_WRITE_DATA
642 'phase': EventPhase
.PHASE_END
,
645 'type': EventSourceType
.URL_REQUEST
648 'type': EventType
.HTTP_CACHE_WRITE_DATA
651 'phase': EventPhase
.PHASE_BEGIN
,
654 'type': EventSourceType
.URL_REQUEST
657 'type': EventType
.HTTP_TRANSACTION_READ_BODY
660 'phase': EventPhase
.PHASE_END
,
663 'type': EventSourceType
.URL_REQUEST
666 'type': EventType
.HTTP_TRANSACTION_READ_BODY
669 'phase': EventPhase
.PHASE_BEGIN
,
672 'type': EventSourceType
.URL_REQUEST
675 'type': EventType
.HTTP_CACHE_WRITE_DATA
678 'phase': EventPhase
.PHASE_END
,
681 'type': EventSourceType
.URL_REQUEST
684 'type': EventType
.HTTP_CACHE_WRITE_DATA
687 'phase': EventPhase
.PHASE_BEGIN
,
690 'type': EventSourceType
.URL_REQUEST
693 'type': EventType
.HTTP_TRANSACTION_READ_BODY
696 'phase': EventPhase
.PHASE_END
,
699 'type': EventSourceType
.URL_REQUEST
702 'type': EventType
.HTTP_TRANSACTION_READ_BODY
705 'phase': EventPhase
.PHASE_BEGIN
,
708 'type': EventSourceType
.URL_REQUEST
711 'type': EventType
.HTTP_CACHE_WRITE_DATA
714 'phase': EventPhase
.PHASE_END
,
717 'type': EventSourceType
.URL_REQUEST
720 'type': EventType
.HTTP_CACHE_WRITE_DATA
723 'phase': EventPhase
.PHASE_END
,
726 'type': EventSourceType
.URL_REQUEST
729 'type': EventType
.REQUEST_ALIVE
733 testCase
.expectedText
=
734 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=789]\n' +
735 't=1338864633238 [st= 14] URL_REQUEST_START_JOB [dt=8]\n' +
736 ' --> load_flags = 68222976 ' +
737 '(MAIN_FRAME | MAYBE_USER_GESTURE ' +
738 '| VERIFY_EV_CERT)\n' +
739 ' --> method = "GET"\n' +
740 ' --> priority = 4\n' +
741 ' --> url = "http://www.google.com/"\n' +
742 't=1338864633248 [st= 24] +URL_REQUEST_START_JOB [dt=279]\n' +
743 ' --> load_flags = 68222976 ' +
744 '(MAIN_FRAME | MAYBE_USER_GESTURE ' +
745 '| VERIFY_EV_CERT)\n' +
746 ' --> method = "GET"\n' +
747 ' --> priority = 4\n' +
748 ' --> url = "http://www.google.com/"\n' +
749 't=1338864633255 [st= 31] HTTP_CACHE_GET_BACKEND [dt=1]\n' +
750 't=1338864633257 [st= 33] HTTP_CACHE_OPEN_ENTRY [dt=5]\n' +
751 't=1338864633263 [st= 39] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' +
752 't=1338864633269 [st= 45] HTTP_CACHE_READ_INFO [dt=4]\n' +
753 't=1338864633276 [st= 52] +HTTP_STREAM_REQUEST [dt=72]\n' +
754 't=1338864633344 [st=120] HTTP_STREAM_REQUEST_BOUND_TO_JOB\n' +
755 ' --> source_dependency = 149 ' +
756 '(HTTP_STREAM_JOB)\n' +
757 't=1338864633348 [st=124] -HTTP_STREAM_REQUEST\n' +
758 't=1338864633352 [st=128] +HTTP_TRANSACTION_SEND_REQUEST [dt=9]\n' +
759 't=1338864633356 [st=132] HTTP_TRANSACTION_SEND_REQUEST_HEADERS\n' +
760 ' --> GET / HTTP/1.1\n' +
761 ' Host: www.google.com\n' +
762 ' Connection: keep-alive\n' +
763 ' User-Agent: Mozilla/5.0\n' +
764 ' Accept: text/html\n' +
765 ' Accept-Encoding: gzip,deflate,sdch\n' +
766 ' Accept-Language: en-US,en;q=0.8\n' +
767 ' Accept-Charset: ISO-8859-1\n' +
768 't=1338864633361 [st=137] -HTTP_TRANSACTION_SEND_REQUEST\n' +
769 't=1338864633362 [st=138] +HTTP_TRANSACTION_READ_HEADERS [dt=76]\n' +
770 't=1338864633363 [st=139] HTTP_STREAM_PARSER_READ_HEADERS [dt=70]\n' +
771 't=1338864633435 [st=211] HTTP_TRANSACTION_READ_RESPONSE_HEADERS\n' +
772 ' --> HTTP/1.1 200 OK\n' +
773 ' Date: Tue, 05 Jun 2012 02:50:33 GMT\n' +
775 ' Cache-Control: private, max-age=0\n' +
776 ' Content-Type: text/html; charset=UTF-8\n' +
777 ' Content-Encoding: gzip\n' +
779 ' Content-Length: 23798\n' +
780 't=1338864633438 [st=214] -HTTP_TRANSACTION_READ_HEADERS\n' +
781 't=1338864633439 [st=215] HTTP_CACHE_WRITE_INFO [dt=30]\n' +
782 't=1338864633470 [st=246] HTTP_CACHE_WRITE_DATA [dt=38]\n' +
783 't=1338864633508 [st=284] HTTP_CACHE_WRITE_INFO [dt=13]\n' +
784 't=1338864633527 [st=303] -URL_REQUEST_START_JOB\n' +
785 't=1338864633983 [st=759] HTTP_TRANSACTION_READ_BODY [dt=1]\n' +
786 't=1338864633984 [st=760] HTTP_CACHE_WRITE_DATA [dt=3]\n' +
787 't=1338864633988 [st=764] HTTP_TRANSACTION_READ_BODY [dt=3]\n' +
788 't=1338864633992 [st=768] HTTP_CACHE_WRITE_DATA [dt=2]\n' +
789 't=1338864633994 [st=770] HTTP_TRANSACTION_READ_BODY [dt=0]\n' +
790 't=1338864633995 [st=771] HTTP_CACHE_WRITE_DATA [dt=0]\n' +
791 't=1338864633996 [st=772] HTTP_TRANSACTION_READ_BODY [dt=0]\n' +
792 't=1338864633996 [st=772] HTTP_CACHE_WRITE_DATA [dt=1]\n' +
793 't=1338864633998 [st=774] HTTP_TRANSACTION_READ_BODY [dt=1]\n' +
794 't=1338864633999 [st=775] HTTP_CACHE_WRITE_DATA [dt=3]\n' +
795 't=1338864634002 [st=778] HTTP_TRANSACTION_READ_BODY [dt=3]\n' +
796 't=1338864634005 [st=781] HTTP_CACHE_WRITE_DATA [dt=0]\n' +
797 't=1338864634013 [st=789] -REQUEST_ALIVE';
803 * Test case for a URLRequest that was not completed that did not come from a
806 function painterTestURLRequestIncomplete() {
808 testCase
.tickOffset
= '1337911098446';
810 testCase
.logEntries
= [
812 'phase': EventPhase
.PHASE_BEGIN
,
815 'type': EventSourceType
.URL_REQUEST
818 'type': EventType
.REQUEST_ALIVE
825 'url': 'http://www.google.com/'
827 'phase': EventPhase
.PHASE_BEGIN
,
830 'type': EventSourceType
.URL_REQUEST
833 'type': EventType
.URL_REQUEST_START_JOB
836 'phase': EventPhase
.PHASE_END
,
839 'type': EventSourceType
.URL_REQUEST
842 'type': EventType
.URL_REQUEST_START_JOB
846 testCase
.expectedText
=
847 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=?]\n' +
848 't=1338864633356 [st=132] URL_REQUEST_START_JOB [dt=60]\n' +
849 ' --> load_flags = 0 (NORMAL)\n' +
850 ' --> method = "GET"\n' +
851 ' --> priority = 4\n' +
852 ' --> url = "http://www.google.com/"';
858 * Test case for a URLRequest that was not completed that came from a loaded
861 function painterTestURLRequestIncompleteFromLoadedLog() {
862 var testCase
= painterTestURLRequestIncomplete();
863 testCase
.logCreationTime
= 1338864634013;
864 testCase
.expectedText
=
865 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=789+]\n' +
866 't=1338864633356 [st=132] URL_REQUEST_START_JOB [dt=60]\n' +
867 ' --> load_flags = 0 (NORMAL)\n' +
868 ' --> method = "GET"\n' +
869 ' --> priority = 4\n' +
870 ' --> url = "http://www.google.com/"\n' +
871 't=1338864634013 [st=789]';
876 * Test case for a URLRequest that was not completed that came from a loaded
877 * log file when there's only a begin event.
879 function painterTestURLRequestIncompleteFromLoadedLogSingleEvent() {
880 var testCase
= painterTestURLRequestIncomplete();
881 testCase
.logEntries
= [testCase
.logEntries
[0]];
882 testCase
.logCreationTime
= 1338864634013;
883 testCase
.expectedText
=
884 't=1338864633224 [st= 0] +REQUEST_ALIVE [dt=789+]\n' +
885 't=1338864634013 [st=789]';
890 * Tests the custom formatting of net_errors across several different event
893 function painterTestNetError() {
895 testCase
.tickOffset
= '1337911098446';
897 testCase
.logEntries
= [
899 'phase': EventPhase
.PHASE_BEGIN
,
902 'type': EventSourceType
.URL_REQUEST
905 'type': EventType
.REQUEST_ALIVE
909 'load_flags': 68222976,
912 'url': 'http://www.doesnotexistdomain.com/'
914 'phase': EventPhase
.PHASE_BEGIN
,
917 'type': EventSourceType
.URL_REQUEST
920 'type': EventType
.URL_REQUEST_START_JOB
923 'phase': EventPhase
.PHASE_END
,
926 'type': EventSourceType
.URL_REQUEST
929 'type': EventType
.URL_REQUEST_START_JOB
933 'load_flags': 68222976,
936 'url': 'http://www.doesnotexistdomain.com/'
938 'phase': EventPhase
.PHASE_BEGIN
,
941 'type': EventSourceType
.URL_REQUEST
944 'type': EventType
.URL_REQUEST_START_JOB
947 'phase': EventPhase
.PHASE_BEGIN
,
950 'type': EventSourceType
.URL_REQUEST
953 'type': EventType
.HTTP_CACHE_GET_BACKEND
956 'phase': EventPhase
.PHASE_END
,
959 'type': EventSourceType
.URL_REQUEST
962 'type': EventType
.HTTP_CACHE_GET_BACKEND
965 'phase': EventPhase
.PHASE_BEGIN
,
968 'type': EventSourceType
.URL_REQUEST
971 'type': EventType
.HTTP_CACHE_OPEN_ENTRY
977 'phase': EventPhase
.PHASE_END
,
980 'type': EventSourceType
.URL_REQUEST
983 'type': EventType
.HTTP_CACHE_OPEN_ENTRY
986 'phase': EventPhase
.PHASE_BEGIN
,
989 'type': EventSourceType
.URL_REQUEST
992 'type': EventType
.HTTP_CACHE_CREATE_ENTRY
995 'phase': EventPhase
.PHASE_END
,
998 'type': EventSourceType
.URL_REQUEST
1000 'time': '953675473',
1001 'type': EventType
.HTTP_CACHE_CREATE_ENTRY
1004 'phase': EventPhase
.PHASE_BEGIN
,
1007 'type': EventSourceType
.URL_REQUEST
1009 'time': '953675473',
1010 'type': EventType
.HTTP_CACHE_ADD_TO_ENTRY
1013 'phase': EventPhase
.PHASE_END
,
1016 'type': EventSourceType
.URL_REQUEST
1018 'time': '953675474',
1019 'type': EventType
.HTTP_CACHE_ADD_TO_ENTRY
1022 'phase': EventPhase
.PHASE_BEGIN
,
1025 'type': EventSourceType
.URL_REQUEST
1027 'time': '953675474',
1028 'type': EventType
.HTTP_STREAM_REQUEST
1031 'phase': EventPhase
.PHASE_END
,
1034 'type': EventSourceType
.URL_REQUEST
1036 'time': '953675699',
1037 'type': EventType
.HTTP_STREAM_REQUEST
1043 'phase': EventPhase
.PHASE_END
,
1046 'type': EventSourceType
.URL_REQUEST
1048 'time': '953675705',
1049 'type': EventType
.URL_REQUEST_START_JOB
1055 'phase': EventPhase
.PHASE_END
,
1058 'type': EventSourceType
.URL_REQUEST
1060 'time': '953675923',
1061 'type': EventType
.REQUEST_ALIVE
1065 testCase
.expectedText
=
1066 't=1338864773894 [st= 0] +REQUEST_ALIVE [dt=475]\n' +
1067 't=1338864773901 [st= 7] URL_REQUEST_START_JOB [dt=5]\n' +
1068 ' --> load_flags = 68222976 (' +
1069 'MAIN_FRAME | MAYBE_USER_GESTURE ' +
1070 '| VERIFY_EV_CERT)\n' +
1071 ' --> method = "GET"\n' +
1072 ' --> priority = 4\n' +
1073 ' --> url = "http://www.doesnotexistdomain.com/"\n' +
1074 't=1338864773906 [st= 12] +URL_REQUEST_START_JOB [dt=245]\n' +
1075 ' --> load_flags = 68222976 (' +
1076 'MAIN_FRAME | MAYBE_USER_GESTURE ' +
1077 '| VERIFY_EV_CERT)\n' +
1078 ' --> method = "GET"\n' +
1079 ' --> priority = 4\n' +
1080 ' --> url = "http://www.doesnotexistdomain.com/"\n' +
1081 't=1338864773915 [st= 21] HTTP_CACHE_GET_BACKEND [dt=0]\n' +
1082 't=1338864773915 [st= 21] HTTP_CACHE_OPEN_ENTRY [dt=1]\n' +
1083 ' --> net_error = -2 (ERR_FAILED)\n' +
1084 't=1338864773917 [st= 23] HTTP_CACHE_CREATE_ENTRY [dt=2]\n' +
1085 't=1338864773919 [st= 25] HTTP_CACHE_ADD_TO_ENTRY [dt=1]\n' +
1086 't=1338864773920 [st= 26] HTTP_STREAM_REQUEST [dt=225]\n' +
1087 't=1338864774151 [st=257] -URL_REQUEST_START_JOB\n' +
1088 ' --> net_error = -105 (ERR_NAME_NOT_RESOLVED)\n' +
1089 't=1338864774369 [st=475] -REQUEST_ALIVE\n' +
1090 ' --> net_error = -105 (ERR_NAME_NOT_RESOLVED)';
1096 * Tests the custom formatting of QUIC errors across several different event
1099 function painterTestQuicError() {
1101 testCase
.tickOffset
= '1337911098446';
1103 testCase
.logEntries
= [
1106 "host": "www.example.com"
1108 'phase': EventPhase
.PHASE_BEGIN
,
1111 'type': EventSourceType
.URL_REQUEST
1113 'time': '953675448',
1114 'type': EventType
.QUIC_SESSION
1118 'details': "invalid headers",
1119 'quic_rst_stream_error':
1120 QuicRstStreamError
.QUIC_BAD_APPLICATION_PAYLOAD
,
1123 'phase': EventPhase
.PHASE_NONE
,
1126 'type': EventSourceType
.URL_REQUEST
1128 'time': '953675460',
1129 'type': EventType
.QUIC_SESSION_RST_STREAM_FRAME_RECEIVED
1133 'quic_error': QuicError
.QUIC_CONNECTION_TIMED_OUT
,
1135 'phase': EventPhase
.PHASE_NONE
,
1138 'type': EventSourceType
.URL_REQUEST
1140 'time': '953675705',
1141 'type': EventType
.QUIC_SESSION_CONNECTION_CLOSE_FRAME_RECEIVED
1145 'quic_error': QuicError
.QUIC_CONNECTION_TIMED_OUT
1147 'phase': EventPhase
.PHASE_END
,
1150 'type': EventSourceType
.URL_REQUEST
1152 'time': '953675923',
1153 'type': EventType
.QUIC_SESSION
1157 testCase
.expectedText
=
1158 't=1338864773894 [st= 0] +QUIC_SESSION [dt=475]\n' +
1159 ' --> host = "www.example.com"\n' +
1160 't=1338864773906 [st= 12] QUIC_SESSION_RST_STREAM_FRAME_RECEIVED\n' +
1161 ' --> details = "invalid headers"\n' +
1162 ' --> quic_rst_stream_error = ' +
1163 QuicRstStreamError
.QUIC_BAD_APPLICATION_PAYLOAD
+ ' (' +
1164 'QUIC_BAD_APPLICATION_PAYLOAD)\n' +
1165 ' --> stream_id = 1\n' +
1166 't=1338864774151 [st=257] QUIC_SESSION_CONNECTION_CLOSE_FRAME_RECEIVED\n' +
1167 ' --> quic_error = ' +
1168 QuicError
.QUIC_CONNECTION_TIMED_OUT
+ ' (QUIC_CONNECTION_TIMED_OUT)\n' +
1169 't=1338864774369 [st=475] -QUIC_SESSION\n' +
1170 ' --> quic_error = ' +
1171 QuicError
.QUIC_CONNECTION_TIMED_OUT
+ ' (QUIC_CONNECTION_TIMED_OUT)';
1177 * Tests the custom formatting of QUIC crypto handshake messages.
1179 function painterTestQuicCryptoHandshakeMessage() {
1181 testCase
.tickOffset
= '1337911098446';
1183 testCase
.logEntries
= [
1186 "host": "www.example.com"
1188 'phase': EventPhase
.PHASE_BEGIN
,
1191 'type': EventSourceType
.URL_REQUEST
1193 'time': '953675448',
1194 'type': EventType
.QUIC_SESSION
1198 'quic_crypto_handshake_message':
1210 " KEXS: C255,P256\n" +
1211 " OBIT: 7883764781F2DFD0\n" +
1212 " EXPY: FFEE725200000000\n" +
1216 'phase': EventPhase
.PHASE_NONE
,
1219 'type': EventSourceType
.URL_REQUEST
1221 'time': '953675460',
1222 'type': EventType
.QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_SENT
1225 'phase': EventPhase
.PHASE_END
,
1228 'type': EventSourceType
.URL_REQUEST
1230 'time': '953675923',
1231 'type': EventType
.QUIC_SESSION
1235 testCase
.expectedText
=
1236 't=1338864773894 [st= 0] +QUIC_SESSION [dt=475]\n' +
1237 ' --> host = "www.example.com"\n' +
1238 't=1338864773906 [st= 12] QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_SENT\n' +
1250 ' KEXS: C255,P256\n' +
1251 ' OBIT: 7883764781F2DFD0\n' +
1252 ' EXPY: FFEE725200000000\n' +
1255 't=1338864774369 [st=475] -QUIC_SESSION';
1261 * Tests the formatting of bytes sent/received as hex + ASCII. Note that the
1262 * test data was truncated which is why the byte_count doesn't quite match the
1263 * hex_encoded_bytes.
1265 function painterTestHexEncodedBytes() {
1267 testCase
.tickOffset
= '1337911098473';
1269 testCase
.logEntries
= [
1272 'source_dependency': {
1274 'type': EventSourceType
.CONNECT_JOB
1277 'phase': EventPhase
.PHASE_BEGIN
,
1280 'type': EventSourceType
.SOCKET
1282 'time': '953918459',
1283 'type': EventType
.SOCKET_ALIVE
1291 'phase': EventPhase
.PHASE_BEGIN
,
1294 'type': EventSourceType
.SOCKET
1296 'time': '953918460',
1297 'type': EventType
.TCP_CONNECT
1301 'address': '184.30.253.15:80'
1303 'phase': EventPhase
.PHASE_BEGIN
,
1306 'type': EventSourceType
.SOCKET
1308 'time': '953918461',
1309 'type': EventType
.TCP_CONNECT_ATTEMPT
1312 'phase': EventPhase
.PHASE_END
,
1315 'type': EventSourceType
.SOCKET
1317 'time': '953918464',
1318 'type': EventType
.TCP_CONNECT_ATTEMPT
1322 'source_address': '127.0.0.1:54041'
1324 'phase': EventPhase
.PHASE_END
,
1327 'type': EventSourceType
.SOCKET
1329 'time': '953918465',
1330 'type': EventType
.TCP_CONNECT
1334 'source_dependency': {
1336 'type': EventSourceType
.HTTP_STREAM_JOB
1339 'phase': EventPhase
.PHASE_BEGIN
,
1342 'type': EventSourceType
.SOCKET
1344 'time': '953918472',
1345 'type': EventType
.SOCKET_IN_USE
1350 'hex_encoded_bytes': '474554202F66617669636F6E2E69636F20485454502' +
1351 'F312E310D0A486F73743A207777772E6170706C652E' +
1352 '636F6D0D0A436F6E6E656374696F6E3A20'
1354 'phase': EventPhase
.PHASE_NONE
,
1357 'type': EventSourceType
.SOCKET
1359 'time': '953918484',
1360 'type': EventType
.SOCKET_BYTES_SENT
1365 'hex_encoded_bytes': '485454502F312E3120323030204F4B0D0A4C6173742' +
1366 'D4D6F6469666965643A204D6F6E2C20313920446563' +
1367 '20323031312032323A34363A353920474D'
1369 'phase': EventPhase
.PHASE_NONE
,
1372 'type': EventSourceType
.SOCKET
1374 'time': '953918596',
1375 'type': EventType
.SOCKET_BYTES_RECEIVED
1379 testCase
.expectedText
=
1380 't=1338865016932 [st= 0] +SOCKET_ALIVE [dt=?]\n' +
1381 ' --> source_dependency = 634 (CONNECT_JOB)\n' +
1382 't=1338865016933 [st= 1] +TCP_CONNECT [dt=5]\n' +
1383 ' --> address_list = ["184.30.253.15:80"]\n' +
1384 't=1338865016934 [st= 2] TCP_CONNECT_ATTEMPT [dt=3]\n' +
1385 ' --> address = "184.30.253.15:80"\n' +
1386 't=1338865016938 [st= 6] -TCP_CONNECT\n' +
1387 ' --> source_address = "127.0.0.1:54041"\n' +
1388 't=1338865016945 [st= 13] +SOCKET_IN_USE [dt=?]\n' +
1389 ' --> source_dependency = 628 (HTTP_STREAM_JOB)\n' +
1390 't=1338865016957 [st= 25] SOCKET_BYTES_SENT\n' +
1391 ' --> byte_count = 780\n' +
1392 ' --> hex_encoded_bytes =\n' +
1393 ' 47 45 54 20 2F 66 61 76 69 63 6F 6E 2E 69 ' +
1394 '63 6F 20 48 54 54 GET /favicon.ico HTT\n' +
1395 ' 50 2F 31 2E 31 0D 0A 48 6F 73 74 3A 20 77 ' +
1396 '77 77 2E 61 70 70 P/1.1..Host: www.app\n' +
1397 ' 6C 65 2E 63 6F 6D 0D 0A 43 6F 6E 6E 65 63 ' +
1398 '74 69 6F 6E 3A 20 le.com..Connection: \n' +
1399 't=1338865017069 [st=137] SOCKET_BYTES_RECEIVED\n' +
1400 ' --> byte_count = 1024\n' +
1401 ' --> hex_encoded_bytes =\n' +
1402 ' 48 54 54 50 2F 31 2E 31 20 32 30 30 20 4F ' +
1403 '4B 0D 0A 4C 61 73 HTTP/1.1 200 OK..Las\n' +
1404 ' 74 2D 4D 6F 64 69 66 69 65 64 3A 20 4D 6F ' +
1405 '6E 2C 20 31 39 20 t-Modified: Mon, 19 \n' +
1406 ' 44 65 63 20 32 30 31 31 20 32 32 3A 34 36 ' +
1407 '3A 35 39 20 47 4D Dec 2011 22:46:59 GM';
1413 * Tests the formatting of certificates.
1415 function painterTestCertVerifierJob() {
1417 testCase
.tickOffset
= '1337911098481';
1419 testCase
.logEntries
= [
1423 '-----BEGIN CERTIFICATE-----\n1\n-----END CERTIFICATE-----\n',
1424 '-----BEGIN CERTIFICATE-----\n2\n-----END CERTIFICATE-----\n',
1427 'phase': EventPhase
.PHASE_BEGIN
,
1430 'type': EventSourceType
.CERT_VERIFIER_JOB
1432 'time': '954124663',
1433 'type': EventType
.CERT_VERIFIER_JOB
1436 'phase': EventPhase
.PHASE_END
,
1439 'type': EventSourceType
.CERT_VERIFIER_JOB
1441 'time': '954124697',
1442 'type': EventType
.CERT_VERIFIER_JOB
1446 testCase
.expectedText
=
1447 't=1338865223144 [st=0] CERT_VERIFIER_JOB [dt=34]\n' +
1448 ' --> certificates =\n' +
1449 ' -----BEGIN CERTIFICATE-----\n' +
1451 ' -----END CERTIFICATE-----\n' +
1453 ' -----BEGIN CERTIFICATE-----\n' +
1455 ' -----END CERTIFICATE-----';
1461 * Tests the formatting of CertVerifyResult fields.
1463 function painterTestCertVerifyResult() {
1465 testCase
.tickOffset
= '1337911098481';
1467 testCase
.logEntries
= [
1471 '-----BEGIN CERTIFICATE-----\n1\n-----END CERTIFICATE-----\n',
1472 '-----BEGIN CERTIFICATE-----\n2\n-----END CERTIFICATE-----\n',
1475 'phase': EventPhase
.PHASE_BEGIN
,
1478 'type': EventSourceType
.CERT_VERIFIER_JOB
1480 'time': '954124663',
1481 'type': EventType
.CERT_VERIFIER_JOB
1488 'is_issued_by_known_root': true,
1489 'is_issued_by_additional_trust_anchor': false,
1490 'common_name_fallback_used': true,
1494 '-----BEGIN CERTIFICATE-----\n1\n-----END CERTIFICATE-----\n',
1495 '-----BEGIN CERTIFICATE-----\n2\n-----END CERTIFICATE-----\n',
1498 'public_key_hashes': [
1503 'phase': EventPhase
.PHASE_END
,
1506 'type': EventSourceType
.CERT_VERIFIER_JOB
1508 'time': '954124697',
1509 'type': EventType
.CERT_VERIFIER_JOB
1513 testCase
.expectedText
=
1514 't=1338865223144 [st= 0] +CERT_VERIFIER_JOB [dt=34]\n' +
1515 ' --> certificates =\n' +
1516 ' -----BEGIN CERTIFICATE-----\n' +
1518 ' -----END CERTIFICATE-----\n' +
1520 ' -----BEGIN CERTIFICATE-----\n' +
1522 ' -----END CERTIFICATE-----\n' +
1524 't=1338865223178 [st=34] -CERT_VERIFIER_JOB\n' +
1525 ' --> verified_cert =\n' +
1526 ' -----BEGIN CERTIFICATE-----\n' +
1528 ' -----END CERTIFICATE-----\n' +
1530 ' -----BEGIN CERTIFICATE-----\n' +
1532 ' -----END CERTIFICATE-----\n' +
1534 ' --> cert_status = 5 (AUTHORITY_INVALID |' +
1535 ' COMMON_NAME_INVALID)\n' +
1536 ' --> has_md5 = true\n' +
1537 ' --> has_md2 = false\n' +
1538 ' --> has_md4 = true\n' +
1539 ' --> is_issued_by_known_root = true\n' +
1540 ' --> is_issued_by_additional_trust_anchor =' +
1541 ' false\n --> common_name_fallback_used = true\n' +
1542 ' --> public_key_hashes = ["hash1","hash2"]';
1548 * Tests the formatting of proxy configurations when using one proxy server for
1551 function painterTestProxyConfigOneProxyAllSchemes() {
1553 testCase
.tickOffset
= '1337911098481';
1555 testCase
.logEntries
= [
1559 'auto_detect': true,
1565 'pac_url': 'https://config/wpad.dat',
1566 'single_proxy': 'cache-proxy:3128',
1573 'phase': EventPhase
.PHASE_NONE
,
1576 'type': EventSourceType
.NONE
1578 'time': '954443578',
1579 'type': EventType
.PROXY_CONFIG_CHANGED
1583 testCase
.expectedText
=
1584 't=1338865542059 [st=0] PROXY_CONFIG_CHANGED\n' +
1585 ' --> old_config =\n' +
1587 ' --> new_config =\n' +
1588 ' (1) Auto-detect\n' +
1589 ' (2) PAC script: https://config/wpad.dat\n' +
1590 ' (3) Proxy server: cache-proxy:3128\n' +
1591 ' Bypass list: \n' +
1601 * Tests the formatting of proxy configurations when using two proxy servers for
1604 function painterTestProxyConfigTwoProxiesAllSchemes() {
1606 testCase
.tickOffset
= '1337911098481';
1608 testCase
.logEntries
= [
1612 'auto_detect': true,
1618 'pac_url': 'https://config/wpad.dat',
1619 'single_proxy': ['cache-proxy:3128', 'socks4://other:999'],
1626 'phase': EventPhase
.PHASE_NONE
,
1629 'type': EventSourceType
.NONE
1631 'time': '954443578',
1632 'type': EventType
.PROXY_CONFIG_CHANGED
1636 testCase
.expectedText
=
1637 't=1338865542059 [st=0] PROXY_CONFIG_CHANGED\n' +
1638 ' --> old_config =\n' +
1640 ' --> new_config =\n' +
1641 ' (1) Auto-detect\n' +
1642 ' (2) PAC script: https://config/wpad.dat\n' +
1643 ' (3) Proxy server: [cache-proxy:3128, ' +
1644 'socks4://other:999]\n' +
1645 ' Bypass list: \n' +
1655 * Tests that cookies are NOT stripped from URLRequests when stripping is
1658 function painterTestDontStripCookiesURLRequest() {
1660 testCase
.tickOffset
= '1337911098139';
1662 testCase
.logEntries
= [
1666 'HTTP/1.1 301 Moved Permanently',
1667 'Cache-Control: private',
1668 'Content-Length: 23',
1669 'Content-Type: text/html',
1670 'Location: http://msdn.microsoft.com',
1671 'Server: Microsoft-IIS/7.5',
1672 'Set-Cookie: MyMagicPony',
1674 'X-Powered-By: ASP.NET',
1675 'X-UA-Compatible: IE=EmulateIE7',
1676 'Date: Tue, 05 Jun 2012 21:06:45 GMT',
1680 'phase': EventPhase
.PHASE_NONE
,
1683 'type': EventSourceType
.URL_REQUEST
1685 'time': '1019307339',
1686 'type': EventType
.HTTP_TRANSACTION_READ_RESPONSE_HEADERS
1691 'Host: msdn.microsoft.com',
1692 'Connection: keep-alive',
1693 'User-Agent: Mozilla/5.0',
1694 'Accept: text/html',
1695 'Accept-Encoding: gzip,deflate,sdch',
1696 'Accept-Language: en-US,en;q=0.8',
1697 'Accept-Charset: ISO-8859-1',
1698 'Cookie: MyMagicPony'
1700 'line': 'GET / HTTP/1.1\r\n'
1702 'phase': EventPhase
.PHASE_NONE
,
1705 'type': EventSourceType
.URL_REQUEST
1707 'time': '1019307458',
1708 'type': EventType
.HTTP_TRANSACTION_SEND_REQUEST_HEADERS
1712 testCase
.expectedText
=
1713 't=1338930405478 [st= 0] HTTP_TRANSACTION_READ_RESPONSE_HEADERS\n' +
1714 ' --> HTTP/1.1 301 Moved Permanently\n' +
1715 ' Cache-Control: private\n' +
1716 ' Content-Length: 23\n' +
1717 ' Content-Type: text/html\n' +
1718 ' Location: http://msdn.microsoft.com\n' +
1719 ' Server: Microsoft-IIS/7.5\n' +
1720 ' Set-Cookie: MyMagicPony\n' +
1721 ' P3P: CP="ALL"\n' +
1722 ' X-Powered-By: ASP.NET\n' +
1723 ' X-UA-Compatible: IE=EmulateIE7\n' +
1724 ' Date: Tue, 05 Jun 2012 21:06:45 GMT\n' +
1725 ' Connection: close\n' +
1726 't=1338930405597 [st=119] HTTP_TRANSACTION_SEND_REQUEST_HEADERS\n' +
1727 ' --> GET / HTTP/1.1\n' +
1728 ' Host: msdn.microsoft.com\n' +
1729 ' Connection: keep-alive\n' +
1730 ' User-Agent: Mozilla/5.0\n' +
1731 ' Accept: text/html\n' +
1732 ' Accept-Encoding: gzip,deflate,sdch\n' +
1733 ' Accept-Language: en-US,en;q=0.8\n' +
1734 ' Accept-Charset: ISO-8859-1\n' +
1735 ' Cookie: MyMagicPony';
1741 * Tests that cookies are stripped from URLRequest when stripping is enabled.
1743 function painterTestStripCookiesURLRequest() {
1744 var testCase
= painterTestDontStripCookiesURLRequest();
1745 testCase
.privacyStripping
= true;
1746 testCase
.expectedText
=
1747 testCase
.expectedText
.replace(/MyMagicPony/g, '[11 bytes were stripped]');
1752 * Tests that cookies are NOT stripped from SPDY sessions when stripping is not
1753 * enabled. This test data was pieced together in order to get a "cookie" and
1754 * "set-cookie" header.
1756 function painterTestDontStripCookiesSPDYSession() {
1758 testCase
.tickOffset
= '1337911097783';
1760 testCase
.logEntries
= [
1765 ':host: mail.google.com',
1767 ':path: /a/google.com',
1769 ':version: HTTP/1.1',
1770 'accept: text/html',
1771 'accept-charset: ISO-8859-1',
1772 'accept-encoding: gzip,deflate,sdch',
1773 'accept-language: en-US,en;q=0.8',
1774 'cookie: MyMagicPony',
1775 'user-agent: Mozilla/5.0'
1779 'phase': EventPhase
.PHASE_NONE
,
1782 'type': EventSourceType
.SPDY_SESSION
1784 'time': '1012984638',
1785 'type': EventType
.SPDY_SESSION_SYN_STREAM
1791 ':status: 204 No Content',
1792 ':version: HTTP/1.1',
1793 'date: Tue, 05 Jun 2012 19:21:30 GMT',
1795 'set-cookie: MyMagicPony',
1796 'x-random-header: sup'
1800 'phase': EventPhase
.PHASE_NONE
,
1803 'type': EventSourceType
.SPDY_SESSION
1805 'time': '1012992266',
1806 'type': EventType
.SPDY_SESSION_SYN_REPLY
1810 testCase
.expectedText
=
1811 't=1338924082421 [st= 0] SPDY_SESSION_SYN_STREAM\n' +
1812 ' --> flags = 1\n' +
1813 ' --> :host: mail.google.com\n' +
1815 ' :path: /a/google.com\n' +
1816 ' :scheme: https\n' +
1817 ' :version: HTTP/1.1\n' +
1818 ' accept: text/html\n' +
1819 ' accept-charset: ISO-8859-1\n' +
1820 ' accept-encoding: gzip,deflate,sdch\n' +
1821 ' accept-language: en-US,en;q=0.8\n' +
1822 ' cookie: MyMagicPony\n' +
1823 ' user-agent: Mozilla/5.0\n' +
1824 ' --> stream_id = 1\n' +
1825 't=1338924090049 [st=7628] SPDY_SESSION_SYN_REPLY\n' +
1826 ' --> flags = 0\n' +
1827 ' --> :status: 204 No Content\n' +
1828 ' :version: HTTP/1.1\n' +
1829 ' date: Tue, 05 Jun 2012 19:21:30 GMT\n' +
1831 ' set-cookie: MyMagicPony\n' +
1832 ' x-random-header: sup\n' +
1833 ' --> stream_id = 5';
1839 * Tests that cookies are stripped from SPDY sessions when stripping is enabled.
1841 function painterTestStripCookiesSPDYSession() {
1842 var testCase
= painterTestDontStripCookiesSPDYSession();
1843 testCase
.privacyStripping
= true;
1844 testCase
.expectedText
=
1845 testCase
.expectedText
.replace(/MyMagicPony/g, '[11 bytes were stripped]');
1850 * Tests that cookies are NOT stripped from SPDY URL request headers when
1851 * stripping is not enabled. The difference from the above requests is that SPDY
1852 * URL request headers use dictionaries rather than lists.
1854 function painterTestSpdyURLRequestDontStripCookies() {
1856 testCase
.tickOffset
= '1337911098481';
1858 testCase
.logEntries
= [
1862 ':host': 'www.google.com',
1866 ':version': 'HTTP/1.1',
1867 'cookie': 'MyMagicPony'},
1869 'phase': EventPhase
.PHASE_NONE
,
1870 'source': {'id': 329, 'type': EventSourceType
.URL_REQUEST
},
1871 'time': '954124663',
1872 'type': EventType
.HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS
1876 testCase
.expectedText
=
1877 't=1338865223144 [st=0] HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS\n' +
1878 ' --> :host: www.google.com\n' +
1881 ' :scheme: https\n' +
1882 ' :version: HTTP/1.1\n' +
1883 ' cookie: MyMagicPony';
1888 * Tests that cookies are NOT stripped from SPDY URL request headers when
1889 * stripping is not enabled. The difference from the above requests is that
1891 function painterTestSpdyURLRequestStripCookies() {
1892 var testCase
= painterTestSpdyURLRequestDontStripCookies();
1893 testCase
.privacyStripping
= true;
1894 testCase
.expectedText
=
1895 testCase
.expectedText
.replace(/MyMagicPony/g, '[11 bytes were stripped]');
1900 * Tests that when there are more custom parameters than we expect for an
1901 * event type, they are printed out in addition to the custom formatting.
1903 function painterTestExtraCustomParameter() {
1905 testCase
.tickOffset
= '1337911098446';
1907 testCase
.logEntries
= [
1911 'Host: www.google.com',
1912 'Connection: keep-alive'
1914 'line': 'GET / HTTP/1.1\r\n',
1915 // This is unexpected!
1916 'hello': 'yo dawg, i heard you like strings'
1918 'phase': EventPhase
.PHASE_NONE
,
1921 'type': EventSourceType
.URL_REQUEST
1923 'time': '953534910',
1924 'type': EventType
.HTTP_TRANSACTION_SEND_REQUEST_HEADERS
1928 testCase
.expectedText
=
1929 't=1338864633356 [st=0] HTTP_TRANSACTION_SEND_REQUEST_HEADERS\n' +
1930 ' --> GET / HTTP/1.1\n' +
1931 ' Host: www.google.com\n' +
1932 ' Connection: keep-alive\n' +
1933 ' --> hello = "yo dawg, i heard you like strings"';
1939 * Tests that when the custom parameters for an event type don't match
1940 * what we expect, we fall back to default formatting.
1942 function painterTestMissingCustomParameter() {
1944 testCase
.tickOffset
= '1337911098446';
1946 testCase
.logEntries
= [
1949 // The expectation is for this to be called "headers".
1951 'Host: www.google.com',
1952 'Connection: keep-alive'
1954 'line': 'GET / HTTP/1.1\r\n'
1956 'phase': EventPhase
.PHASE_NONE
,
1959 'type': EventSourceType
.URL_REQUEST
1961 'time': '953534910',
1962 'type': EventType
.HTTP_TRANSACTION_SEND_REQUEST_HEADERS
1966 testCase
.expectedText
=
1967 't=1338864633356 [st=0] HTTP_TRANSACTION_SEND_REQUEST_HEADERS\n' +
1968 ' --> headersWRONG = ["Host: www.google.com",' +
1969 '"Connection: keep-alive"]\n' +
1970 ' --> line = "GET / HTTP/1.1\\r\\n"';
1976 * Tests the formatting for an SSL version fallback event.
1978 function painterTestSSLVersionFallback() {
1980 testCase
.tickOffset
= '1337911098400';
1982 testCase
.logEntries
= [
1985 'host_and_port': 'www-927.ibm.com:443',
1987 'version_after': 0x301,
1988 'version_before': 0x302
1990 'phase': EventPhase
.PHASE_NONE
,
1993 'type': EventSourceType
.URL_REQUEST
1995 'time': '1119062679',
1996 'type': EventType
.SSL_VERSION_FALLBACK
2000 'host_and_port': 'www-927.ibm.com:443',
2002 'version_after': 0x300,
2003 'version_before': 0x301
2005 'phase': EventPhase
.PHASE_NONE
,
2008 'type': EventSourceType
.URL_REQUEST
2010 'time': '1119062850',
2011 'type': EventType
.SSL_VERSION_FALLBACK
2015 'version_after': 0x123456,
2016 'version_before': 0x300
2018 'phase': EventPhase
.PHASE_NONE
,
2021 'type': EventSourceType
.URL_REQUEST
2023 'time': '1119062850',
2024 'type': EventType
.SSL_VERSION_FALLBACK
2028 testCase
.expectedText
=
2029 't=1339030161079 [st= 0] SSL_VERSION_FALLBACK\n' +
2030 ' --> TLS 1.1 ==> TLS 1.0\n' +
2031 ' --> host_and_port = "www-927.ibm.com:443"\n' +
2032 ' --> net_error = -107 (ERR_SSL_PROTOCOL_ERROR)\n' +
2033 't=1339030161250 [st=171] SSL_VERSION_FALLBACK\n' +
2034 ' --> TLS 1.0 ==> SSL 3.0\n' +
2035 ' --> host_and_port = "www-927.ibm.com:443"\n' +
2036 ' --> net_error = -107 (ERR_SSL_PROTOCOL_ERROR)\n' +
2037 't=1339030161250 [st=171] SSL_VERSION_FALLBACK\n' +
2038 ' --> SSL 3.0 ==> SSL 0x123456';
2044 * Tests the formatting of a URL request that was just finishing up when
2045 * net-internals was opened.
2047 function painterTestInProgressURLRequest() {
2049 testCase
.tickOffset
= '1337911098446';
2051 testCase
.logEntries
= [
2054 'load_flags': 68222976,
2055 'load_state': LoadState
.READING_RESPONSE
,
2057 'url': 'http://www.MagicPonyShopper.com'
2059 'phase': EventPhase
.PHASE_BEGIN
,
2062 'type': EventSourceType
.URL_REQUEST
2064 'time': '953675548',
2065 'type': EventType
.REQUEST_ALIVE
2068 'phase': EventPhase
.PHASE_END
,
2071 'type': EventSourceType
.URL_REQUEST
2073 'time': '953675699',
2074 'type': EventType
.HTTP_STREAM_REQUEST
2077 'phase': EventPhase
.PHASE_END
,
2080 'type': EventSourceType
.URL_REQUEST
2082 'time': '953675705',
2083 'type': EventType
.URL_REQUEST_START_JOB
2086 'phase': EventPhase
.PHASE_END
,
2089 'type': EventSourceType
.URL_REQUEST
2091 'time': '953675923',
2092 'type': EventType
.REQUEST_ALIVE
2096 testCase
.expectedText
=
2097 't=1338864773994 [st= 0] +REQUEST_ALIVE [dt=375]\n' +
2098 ' --> load_flags = 68222976 ' +
2099 '(MAIN_FRAME | MAYBE_USER_GESTURE ' +
2100 '| VERIFY_EV_CERT)\n' +
2101 ' --> load_state = ' + LoadState
.READING_RESPONSE
+
2102 ' (READING_RESPONSE)\n' +
2103 ' --> method = "GET"\n' +
2104 ' --> url = "http://www.MagicPonyShopper.com"\n' +
2105 't=1338864774145 [st=151] -HTTP_STREAM_REQUEST\n' +
2106 't=1338864774151 [st=157] -URL_REQUEST_START_JOB\n' +
2107 't=1338864774369 [st=375] -REQUEST_ALIVE';
2113 * Tests the formatting using a non-zero base time. Also has no final event,
2114 * to make sure logCreationTime is handled correctly.
2116 function painterTestBaseTime() {
2118 testCase
.tickOffset
= '1337911098446';
2119 testCase
.logCreationTime
= 1338864774783;
2120 testCase
.baseTimeTicks
= '953675546';
2122 testCase
.logEntries
= [
2124 'phase': EventPhase
.PHASE_BEGIN
,
2127 'type': EventSourceType
.URL_REQUEST
2129 'time': '953675548',
2130 'type': EventType
.REQUEST_ALIVE
2133 'phase': EventPhase
.PHASE_BEGIN
,
2136 'type': EventSourceType
.URL_REQUEST
2138 'time': '953675698',
2139 'type': EventType
.HTTP_STREAM_REQUEST
2142 'phase': EventPhase
.PHASE_END
,
2145 'type': EventSourceType
.URL_REQUEST
2147 'time': '953675699',
2148 'type': EventType
.HTTP_STREAM_REQUEST
2152 testCase
.expectedText
=
2153 't= 2 [st= 0] +REQUEST_ALIVE [dt=789+]\n' +
2154 't=152 [st=150] HTTP_STREAM_REQUEST [dt=1]\n' +
2160 })(); // Anonymous namespace