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

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

Issue 10870080: Add SPDY request headers to DevTools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Back to CL #6 Created 8 years, 3 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 | Annotate | Revision Log
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
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 ['Proxy-Authenticate: Kerberos,Digest,Basic', null], 55 ['Proxy-Authenticate: Kerberos,Digest,Basic', null],
56 ['Proxy-Authenticate: Digest realm="asdfasdf", nonce=5, qop="auth"', null], 56 ['Proxy-Authenticate: Digest realm="asdfasdf", nonce=5, qop="auth"', null],
57 ['Proxy-Authenticate: Basic realm=foo,foo=bar , Digest ', null] 57 ['Proxy-Authenticate: Basic realm=foo,foo=bar , Digest ', null]
58 ]; 58 ];
59 59
60 for (var i = 0; i < expectations.length; ++i) { 60 for (var i = 0; i < expectations.length; ++i) {
61 var expectation = expectations[i]; 61 var expectation = expectations[i];
62 // Position within params.headers where the authentication information goes. 62 // Position within params.headers where the authentication information goes.
63 for (var position = 0; position < 3; ++position) { 63 for (var position = 0; position < 3; ++position) {
64 var entry = { 64 var entry = {
65 'params': { 65 'params': {
66 'headers': [ 66 'headers': [
67 'Host: clients1.google.com', 67 'Host: clients1.google.com',
68 'Connection: keep-alive', 68 'Connection: keep-alive',
69 'User-Agent: Mozilla/5.0'], 69 'User-Agent: Mozilla/5.0'
70 'line': 'GET / HTTP/1.1\r\n'}, 70 ],
71 'phase': 0, 71 'line': 'GET / HTTP/1.1\r\n'
72 'source': {'id': 329, 'type': 1}, 72 },
73 'time': '22468349', 73 'phase': EventPhase.PHASE_BEGIN,
74 'type': 104}; 74 'source': {'id': 329, 'type': EventSourceType.URL_REQUEST},
75 'time': '22468349',
76 'type': EventSourceType.URL_REQUEST
77 };
75 78
76 entry.params.headers[position] = expectation[0]; 79 entry.params.headers[position] = expectation[0];
77 var stripped = stripCookiesAndLoginInfo(entry); 80 var stripped = stripCookiesAndLoginInfo(entry);
78 // The entry should be duplicated, so the original still has the deleted 81 // The entry should be duplicated, so the original still has the deleted
79 // information. 82 // information.
80 expectNotEquals(stripped, entry); 83 expectNotEquals(stripped, entry);
81 if (expectation[1] == null) { 84 if (expectation[1] == null) {
82 expectEquals(stripped.params.headers[position], expectation[0]); 85 expectEquals(expectation[0], stripped.params.headers[position]);
83 } else { 86 } else {
84 expectEquals(stripped.params.headers[position], expectation[1]); 87 expectEquals(expectation[1], stripped.params.headers[position]);
85 } 88 }
86 } 89 }
87 } 90 }
91
92 // Test with SPDY request headers, which use an object rather than an array.
93 var spdyRequestHeadersEntry = {
94 'params': {
95 'headers': {
96 ':host': 'clients1.google.com',
97 ':method': 'GET',
98 ':path': '/cute/cat/pictures/',
99 'cookie': 'blah'
100 },
101 'line': 'GET / HTTP/1.1\r\n'
102 },
103 'phase': EventPhase.PHASE_BEGIN,
104 'source': {'id': 329, 'type': EventSourceType.URL_REQUEST},
105 'time': '22468349',
106 'type': EventSourceType.HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS
107 };
108 var strippedSpdyRequestHeadersEntry =
109 stripCookiesAndLoginInfo(spdyRequestHeadersEntry);
110 expectEquals('cookie: [value was stripped]',
111 strippedSpdyRequestHeadersEntry.params.headers[3]);
112
88 testDone(); 113 testDone();
89 }); 114 });
90 115
91 /** 116 /**
92 * Tests the formatting of log entries to fixed width text. 117 * Tests the formatting of log entries to fixed width text.
93 */ 118 */
94 TEST_F('NetInternalsTest', 'netInternalsLogViewPainterPrintAsText', function() { 119 TEST_F('NetInternalsTest', 'netInternalsLogViewPainterPrintAsText', function() {
95 // Add a DOM node to draw the log entries into. 120 // Add a DOM node to draw the log entries into.
96 var div = addNode(document.body, 'div'); 121 var div = addNode(document.body, 'div');
97 122
(...skipping 18 matching lines...) Expand all
116 runTestCase(painterTestURLRequestIncomplete()); 141 runTestCase(painterTestURLRequestIncomplete());
117 runTestCase(painterTestURLRequestIncompleteFromLoadedLog()); 142 runTestCase(painterTestURLRequestIncompleteFromLoadedLog());
118 runTestCase(painterTestNetError()); 143 runTestCase(painterTestNetError());
119 runTestCase(painterTestHexEncodedBytes()); 144 runTestCase(painterTestHexEncodedBytes());
120 runTestCase(painterTestCertVerifierJob()); 145 runTestCase(painterTestCertVerifierJob());
121 runTestCase(painterTestProxyConfig()); 146 runTestCase(painterTestProxyConfig());
122 runTestCase(painterTestDontStripCookiesURLRequest()); 147 runTestCase(painterTestDontStripCookiesURLRequest());
123 runTestCase(painterTestStripCookiesURLRequest()); 148 runTestCase(painterTestStripCookiesURLRequest());
124 runTestCase(painterTestDontStripCookiesSPDYSession()); 149 runTestCase(painterTestDontStripCookiesSPDYSession());
125 runTestCase(painterTestStripCookiesSPDYSession()); 150 runTestCase(painterTestStripCookiesSPDYSession());
151 runTestCase(painterTestSpdyURLRequestDontStripCookies());
152 runTestCase(painterTestSpdyURLRequestStripCookies());
126 runTestCase(painterTestExtraCustomParameter()); 153 runTestCase(painterTestExtraCustomParameter());
127 runTestCase(painterTestMissingCustomParameter()); 154 runTestCase(painterTestMissingCustomParameter());
128 runTestCase(painterTestSSLVersionFallback()); 155 runTestCase(painterTestSSLVersionFallback());
129 156
130 testDone(); 157 testDone();
131 }); 158 });
132 159
133 /** 160 /**
134 * Test case for a URLRequest. This includes custom formatting for load flags, 161 * Test case for a URLRequest. This includes custom formatting for load flags,
135 * request/response HTTP headers, dependent sources, as well as basic 162 * request/response HTTP headers, dependent sources, as well as basic
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 */ 1495 */
1469 function painterTestStripCookiesSPDYSession() { 1496 function painterTestStripCookiesSPDYSession() {
1470 var testCase = painterTestDontStripCookiesSPDYSession(); 1497 var testCase = painterTestDontStripCookiesSPDYSession();
1471 testCase.privacyStripping = true; 1498 testCase.privacyStripping = true;
1472 testCase.expectedText = 1499 testCase.expectedText =
1473 testCase.expectedText.replace(/MyLittlePony/g, '[value was stripped]'); 1500 testCase.expectedText.replace(/MyLittlePony/g, '[value was stripped]');
1474 return testCase; 1501 return testCase;
1475 } 1502 }
1476 1503
1477 /** 1504 /**
1505 * Tests that cookies are NOT stripped from SPDY URL request headers when
1506 * stripping is not enabled. The difference from the above requests is that SPDY
1507 * URL request headers use dictionaries rather than lists.
1508 */
1509 function painterTestSpdyURLRequestDontStripCookies() {
1510 var testCase = {};
1511 testCase.tickOffset = '1337911098481';
1512
1513 testCase.logEntries = [
1514 {
1515 'params': {
1516 'headers': {
1517 ':host': 'www.google.com',
1518 ':method': 'GET',
1519 ':path': '/',
1520 ':scheme': 'https',
1521 ':version': 'HTTP/1.1',
1522 'cookie': 'MyMagicPony'},
1523 },
1524 'phase': EventPhase.PHASE_NONE,
1525 'source': {'id': 329, 'type': EventSourceType.URL_REQUEST},
1526 'time': '954124663',
1527 'type': EventType.HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS
1528 }
1529 ];
1530
1531 testCase.expectedText =
1532 't=1338865223144 [st=0] HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS\n' +
1533 ' --> :host: www.google.com\n' +
1534 ' :method: GET\n' +
1535 ' :path: /\n' +
1536 ' :scheme: https\n' +
1537 ' :version: HTTP/1.1\n' +
1538 ' cookie: MyMagicPony';
1539 return testCase;
1540 }
1541
1542 /**
1543 * Tests that cookies are NOT stripped from SPDY URL request headers when
1544 * stripping is not enabled. The difference from the above requests is that
1545 */
1546 function painterTestSpdyURLRequestStripCookies() {
1547 var testCase = painterTestSpdyURLRequestDontStripCookies();
1548 testCase.privacyStripping = true;
1549 testCase.expectedText =
1550 testCase.expectedText.replace(/MyMagicPony/g, '[value was stripped]');
1551 return testCase;
1552 }
1553
1554 /**
1478 * Tests that when there are more custom parameters than we expect for an 1555 * Tests that when there are more custom parameters than we expect for an
1479 * event type, they are printed out in addition to the custom formatting. 1556 * event type, they are printed out in addition to the custom formatting.
1480 */ 1557 */
1481 function painterTestExtraCustomParameter() { 1558 function painterTestExtraCustomParameter() {
1482 var testCase = {}; 1559 var testCase = {};
1483 testCase.tickOffset = '1337911098446'; 1560 testCase.tickOffset = '1337911098446';
1484 1561
1485 testCase.logEntries = [ 1562 testCase.logEntries = [
1486 { 1563 {
1487 'params': { 1564 'params': {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 ' --> TLS 1.0 ==> SSL 3.0\n' + 1689 ' --> TLS 1.0 ==> SSL 3.0\n' +
1613 ' --> host_and_port = "www-927.ibm.com:443"\n' + 1690 ' --> host_and_port = "www-927.ibm.com:443"\n' +
1614 ' --> net_error = -107 (ERR_SSL_PROTOCOL_ERROR)\n' + 1691 ' --> net_error = -107 (ERR_SSL_PROTOCOL_ERROR)\n' +
1615 't=1339030161250 [st=171] SSL_VERSION_FALLBACK\n' + 1692 't=1339030161250 [st=171] SSL_VERSION_FALLBACK\n' +
1616 ' --> SSL 3.0 ==> SSL 0x123456'; 1693 ' --> SSL 3.0 ==> SSL 0x123456';
1617 1694
1618 return testCase; 1695 return testCase;
1619 } 1696 }
1620 1697
1621 })(); // Anonymous namespace 1698 })(); // Anonymous namespace
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/log_view_painter.js ('k') | content/browser/debugger/devtools_netlog_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698