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

Side by Side Diff: chrome/test/data/webui/net_internals/log_view_painter.js

Issue 1360253002: Log GOAWAY frame debug data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #7. Created 5 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 // Include test fixture. 5 // Include test fixture.
6 GEN_INCLUDE(['net_internals_test.js']); 6 GEN_INCLUDE(['net_internals_test.js']);
7 7
8 // Anonymous namespace 8 // Anonymous namespace
9 (function() { 9 (function() {
10 10
11 /** 11 /**
12 * Check that stripCookiesAndLoginInfo correctly removes cookies and login 12 * Check that stripCookiesAndLoginInfoAndGoAwayDebugData correctly removes
13 * information. 13 * cookies and login information.
14 */ 14 */
15 TEST_F('NetInternalsTest', 'netInternalsLogViewPainterStripInfo', function() { 15 TEST_F('NetInternalsTest', 'netInternalsLogViewPainterStripInfo', function() {
16 // Each entry in |expectations| is a list consisting of a header element 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 17 // before and after applying the filter. If the second entry is null, the
18 // element should be unmodified. 18 // element should be unmodified.
19 var expectations = [ 19 var expectations = [
20 ['set-cookie: blah', 'set-cookie: [4 bytes were stripped]'], 20 ['set-cookie: blah', 'set-cookie: [4 bytes were stripped]'],
21 ['set-cookie2: blah', 'set-cookie2: [4 bytes were stripped]'], 21 ['set-cookie2: blah', 'set-cookie2: [4 bytes were stripped]'],
22 ['cookie: blah', 'cookie: [4 bytes were stripped]'], 22 ['cookie: blah', 'cookie: [4 bytes were stripped]'],
23 ['authorization: NTLM blah', 'authorization: NTLM [4 bytes were stripped]'], 23 ['authorization: NTLM blah', 'authorization: NTLM [4 bytes were stripped]'],
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 ], 78 ],
79 'line': 'GET / HTTP/1.1\r\n' 79 'line': 'GET / HTTP/1.1\r\n'
80 }, 80 },
81 'phase': EventPhase.PHASE_BEGIN, 81 'phase': EventPhase.PHASE_BEGIN,
82 'source': {'id': 329, 'type': EventSourceType.URL_REQUEST}, 82 'source': {'id': 329, 'type': EventSourceType.URL_REQUEST},
83 'time': '22468349', 83 'time': '22468349',
84 'type': EventSourceType.URL_REQUEST 84 'type': EventSourceType.URL_REQUEST
85 }; 85 };
86 86
87 entry.params.headers[position] = expectation[0]; 87 entry.params.headers[position] = expectation[0];
88 var stripped = stripCookiesAndLoginInfo(entry); 88 var stripped = stripCookiesAndLoginInfoAndGoAwayDebugData(entry);
89 // The entry should be duplicated, so the original still has the deleted 89 // The entry should be duplicated, so the original still has the deleted
90 // information. 90 // information.
91 expectNotEquals(stripped, entry); 91 expectNotEquals(stripped, entry);
92 if (expectation[1] == null) { 92 if (expectation[1] == null) {
93 expectEquals(expectation[0], stripped.params.headers[position]); 93 expectEquals(expectation[0], stripped.params.headers[position]);
94 } else { 94 } else {
95 expectEquals(expectation[1], stripped.params.headers[position]); 95 expectEquals(expectation[1], stripped.params.headers[position]);
96 } 96 }
97 } 97 }
98 } 98 }
99 99
100 // Test with HTTP/2 request headers, which use an object rather than an array. 100 // Test with HTTP/2 request headers, which use an object rather than an array.
101 var spdyRequestHeadersEntry = { 101 var spdyRequestHeadersEntry = {
102 'params': { 102 'params': {
103 'headers': { 103 'headers': {
104 ':host': 'clients1.google.com', 104 ':host': 'clients1.google.com',
105 ':method': 'GET', 105 ':method': 'GET',
106 ':path': '/cute/cat/pictures/', 106 ':path': '/cute/cat/pictures/',
107 'cookie': 'blah' 107 'cookie': 'blah'
108 }, 108 },
109 'line': 'GET / HTTP/1.1\r\n' 109 'line': 'GET / HTTP/1.1\r\n'
110 }, 110 },
111 'phase': EventPhase.PHASE_BEGIN, 111 'phase': EventPhase.PHASE_BEGIN,
112 'source': {'id': 329, 'type': EventSourceType.URL_REQUEST}, 112 'source': {'id': 329, 'type': EventSourceType.URL_REQUEST},
113 'time': '22468349', 113 'time': '22468349',
114 'type': EventSourceType.HTTP_TRANSACTION_HTTP2_SEND_REQUEST_HEADERS 114 'type': EventSourceType.HTTP_TRANSACTION_HTTP2_SEND_REQUEST_HEADERS
115 }; 115 };
116 var strippedSpdyRequestHeadersEntry = 116 var strippedSpdyRequestHeadersEntry =
117 stripCookiesAndLoginInfo(spdyRequestHeadersEntry); 117 stripCookiesAndLoginInfoAndGoAwayDebugData(spdyRequestHeadersEntry);
118 expectEquals('cookie: [4 bytes were stripped]', 118 expectEquals('cookie: [4 bytes were stripped]',
119 strippedSpdyRequestHeadersEntry.params.headers[3]); 119 strippedSpdyRequestHeadersEntry.params.headers[3]);
120 120
121 testDone(); 121 testDone();
122 }); 122 });
123 123
124 /** 124 /**
125 * Check that stripCookiesAndLoginInfoAndGoAwayDebugData correctly removes
126 * HTTP/2 GOAWAY frame debug data.
127 */
128 TEST_F('NetInternalsTest', 'netInternalsLogViewPainterStripGoAway', function() {
129 var entry = {
130 'params': {
131 'active_streams': 1,
132 'debug_data': 'potentially privacy sensitive information',
133 'last_accepted_stream_id': 1,
134 'status': 0,
135 'unclaimed_streams': 0,
136 },
137 'phase': 0,
138 'source': {'id': 404, 'type': 5},
139 'time': '49236780',
140 'type': EventType.HTTP2_SESSION_GOAWAY,
141 };
142
143 var stripped = stripCookiesAndLoginInfoAndGoAwayDebugData(entry);
144
145 // The entry should be duplicated, so the original still has the deleted
146 // information.
147 expectNotEquals(stripped, entry);
148 expectEquals('[41 bytes were stripped]',
149 stripped.params.debug_data);
150
151 testDone();
152 });
153
154 /**
125 * Tests the formatting of log entries to fixed width text. 155 * Tests the formatting of log entries to fixed width text.
126 */ 156 */
127 TEST_F('NetInternalsTest', 'netInternalsLogViewPainterPrintAsText', function() { 157 TEST_F('NetInternalsTest', 'netInternalsLogViewPainterPrintAsText', function() {
128 // Add a DOM node to draw the log entries into. 158 // Add a DOM node to draw the log entries into.
129 var div = addNode(document.body, 'div'); 159 var div = addNode(document.body, 'div');
130 160
131 // Helper function to run a particular "test case". This comprises an input 161 // Helper function to run a particular "test case". This comprises an input
132 // and the resulting formatted text expectation. 162 // and the resulting formatted text expectation.
133 function runTestCase(testCase) { 163 function runTestCase(testCase) {
134 div.innerHTML = ''; 164 div.innerHTML = '';
(...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 2197
2168 testCase.expectedText = 2198 testCase.expectedText =
2169 't= 2 [st= 0] +REQUEST_ALIVE [dt=789+]\n' + 2199 't= 2 [st= 0] +REQUEST_ALIVE [dt=789+]\n' +
2170 't=152 [st=150] HTTP_STREAM_REQUEST [dt=1]\n' + 2200 't=152 [st=150] HTTP_STREAM_REQUEST [dt=1]\n' +
2171 't=791 [st=789]'; 2201 't=791 [st=789]';
2172 2202
2173 return testCase; 2203 return testCase;
2174 } 2204 }
2175 2205
2176 })(); // Anonymous namespace 2206 })(); // Anonymous namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698