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

Side by Side Diff: LayoutTests/http/tests/inspector/websocket/websocket-handshake.html

Issue 130863002: [WebSocket] Merge duplicated HTTP headers for devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed a platform dependent test Created 6 years, 11 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
(Empty)
1 <html>
2 <head>
3 <script src="../inspector-test.js"></script>
4 <script src="/js-test-resources/js-test.js"></script>
5 <script>
6 var ws;
7 function sendMessages() {
8 ws = new WebSocket('ws://localhost:8880/duplicated-headers');
9 ws.onopen = function() {
10 debug('onopen');
11 };
12 }
13
14
15 function test() {
16 function outputHeaders(name, headers) {
17 var headersToOutput = [];
18 for (var i = 0; i < headers.length; ++i) {
19 if (headers[i].name === 'Sec-WebSocket-Key' ||
20 headers[i].name == 'Sec-WebSocket-Accept' ||
21 headers[i].name == 'User-Agent') {
22 // We hide the header value of these headers because
23 // they can be flaky or platform dependent.
24 headersToOutput.push({name: headers[i].name, value: '***'});
25 } else {
26 headersToOutput.push(headers[i]);
27 }
28 }
29 headersToOutput.sort(function(x, y) {
30 function compare(x, y) {
31 if (x < y) {
32 return -1;
33 } else if (x === y) {
34 return 0;
35 } else {
36 return 1;
37 }
38 }
39 return x.name === y.name ? compare(x.value, y.value) : compare(x.nam e, y.name);
40 });
41 console.log(name);
42 for (var i = 0; i < headersToOutput.length; ++i) {
43 console.log(' ' + headersToOutput[i].name + ': ' + headersToOutpu t[i].value);
44 }
45 }
46 function onRequest(event) {
47 if (event.data.statusCode === 101) {
48 console.log('requestMethod: ' + event.data.requestMethod);
49 outputHeaders('requestHeaders', event.data.requestHeaders());
50 console.log('statusCode: ' + event.data.statusCode);
51 console.log('statusText: ' + event.data.statusText);
52 outputHeaders('responseHeaders', event.data.responseHeaders);
53 InspectorTest.completeTest();
54 }
55 }
56 console.log(WebInspector.Network);
57 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve ntTypes.RequestUpdated, onRequest);
58 InspectorTest.evaluateInPage('sendMessages()');
59 }
60 </script>
61 </head>
62 <body onload="runTest()">
63 <p>Tests that WebSocket handshake information is passed to Web Inspector.</p>
64 </body>
65 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698