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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/websocket/resources/get-request-header.js

Issue 2102993002: Fix WebSocket to set first party for cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update testRunner calls to setBlockThirdPartyCookies() Created 4 years, 5 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: third_party/WebKit/LayoutTests/http/tests/websocket/resources/get-request-header.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/websocket/resources/get-request-header.js b/third_party/WebKit/LayoutTests/http/tests/websocket/resources/get-request-header.js
index da429bd2ecb55f3f5f3d12cb066f2ef453ea928d..23791e37683d9a28716c624675d987a1391b0d1c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/websocket/resources/get-request-header.js
+++ b/third_party/WebKit/LayoutTests/http/tests/websocket/resources/get-request-header.js
@@ -1,22 +1,27 @@
-var ECHO_REQUEST_HEADERS_WS_URL = 'ws://127.0.0.1:8880/echo-request-headers';
+var WS_ORIGIN = 'ws://127.0.0.1:8880';
+var WS_REMOTE_ORIGIN = 'ws://localhost:8880';
+var WS_ECHO_REQUEST_HEADERS_URL = WS_ORIGIN + '/echo-request-headers';
// Returns a Promise which will create a new WebSocket, and resolve to the value
// of the specified header in the request, or reject with an error message if
// something goes wrong. The header must be specified in lower-case.
function connectAndGetRequestHeader(request_header)
{
- return connectAndGetRequestHeaders().then(function(headers)
- {
- return headers[request_header];
- });
+ return connectAndGetRequestHeaders(WS_ORIGIN).then(
+ headers => headers[request_header]);
+}
+
+function connectAndGetRequestHeaders()
+{
+ return connectAndGetRequestHeadersFrom(WS_ORIGIN);
}
// Returns a Promise which will create a new WebSocket, and return all the
// request headers as an object, with the header names as keys in lower-case.
-function connectAndGetRequestHeaders()
+function connectAndGetRequestHeadersFrom(server)
{
return new Promise(function(resolve, reject) {
- var header_ws = new WebSocket(ECHO_REQUEST_HEADERS_WS_URL);
+ var header_ws = new WebSocket(server + '/echo-request-headers');
header_ws.onmessage = function (evt) {
try {
var headers = JSON.parse(evt.data);

Powered by Google App Engine
This is Rietveld 408576698