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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/inspector/websocket/websocket-handshake.html
diff --git a/LayoutTests/http/tests/inspector/websocket/websocket-handshake.html b/LayoutTests/http/tests/inspector/websocket/websocket-handshake.html
new file mode 100644
index 0000000000000000000000000000000000000000..7f4c5582821c076d785d5ee9e6ee8f5904bb8131
--- /dev/null
+++ b/LayoutTests/http/tests/inspector/websocket/websocket-handshake.html
@@ -0,0 +1,65 @@
+<html>
+<head>
+<script src="../inspector-test.js"></script>
+<script src="/js-test-resources/js-test.js"></script>
+<script>
+var ws;
+function sendMessages() {
+ ws = new WebSocket('ws://localhost:8880/duplicated-headers');
+ ws.onopen = function() {
+ debug('onopen');
+ };
+}
+
+
+function test() {
+ function outputHeaders(name, headers) {
+ var headersToOutput = [];
+ for (var i = 0; i < headers.length; ++i) {
+ if (headers[i].name === 'Sec-WebSocket-Key' ||
+ headers[i].name == 'Sec-WebSocket-Accept' ||
+ headers[i].name == 'User-Agent') {
+ // We hide the header value of these headers because
+ // they can be flaky or platform dependent.
+ headersToOutput.push({name: headers[i].name, value: '***'});
+ } else {
+ headersToOutput.push(headers[i]);
+ }
+ }
+ headersToOutput.sort(function(x, y) {
+ function compare(x, y) {
+ if (x < y) {
+ return -1;
+ } else if (x === y) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+ return x.name === y.name ? compare(x.value, y.value) : compare(x.name, y.name);
+ });
+ console.log(name);
+ for (var i = 0; i < headersToOutput.length; ++i) {
+ console.log(' ' + headersToOutput[i].name + ': ' + headersToOutput[i].value);
+ }
+ }
+ function onRequest(event) {
+ if (event.data.statusCode === 101) {
+ console.log('requestMethod: ' + event.data.requestMethod);
+ outputHeaders('requestHeaders', event.data.requestHeaders());
+ console.log('statusCode: ' + event.data.statusCode);
+ console.log('statusText: ' + event.data.statusText);
+ outputHeaders('responseHeaders', event.data.responseHeaders);
+ InspectorTest.completeTest();
+ }
+ }
+ console.log(WebInspector.Network);
+ WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestUpdated, onRequest);
+ InspectorTest.evaluateInPage('sendMessages()');
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests that WebSocket handshake information is passed to Web Inspector.</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698