OLD | NEW |
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 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 }; | 115 }; |
116 var strippedSpdyRequestHeadersEntry = | 116 var strippedSpdyRequestHeadersEntry = |
117 stripCookiesAndLoginInfo(spdyRequestHeadersEntry); | 117 stripCookiesAndLoginInfo(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 stripCookiesAndLoginInfo correctly removes HTTP/2 GOAWAY frame |
| 126 * 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 = stripCookiesAndLoginInfo(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 Loading... |
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 |
OLD | NEW |