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

Unified Diff: net/websockets/websocket_test_util.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « net/websockets/websocket_test_util.h ('k') | sandbox/linux/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_test_util.cc
diff --git a/net/websockets/websocket_test_util.cc b/net/websockets/websocket_test_util.cc
index 6091c9e0be16a1a95d48e2c7cb7ba5f37b41eda7..3f963bf0e9437a4290333fe4e0bd440c47987c5e 100644
--- a/net/websockets/websocket_test_util.cc
+++ b/net/websockets/websocket_test_util.cc
@@ -11,6 +11,7 @@
#include "base/memory/scoped_vector.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
+#include "net/proxy/proxy_service.h"
#include "net/socket/socket_test_util.h"
namespace net {
@@ -36,6 +37,16 @@ std::string WebSocketStandardRequest(const std::string& path,
const std::string& host,
const std::string& origin,
const std::string& extra_headers) {
+ return WebSocketStandardRequestWithCookies(path, host, origin, std::string(),
+ extra_headers);
+}
+
+std::string WebSocketStandardRequestWithCookies(
+ const std::string& path,
+ const std::string& host,
+ const std::string& origin,
+ const std::string& cookies,
+ const std::string& extra_headers) {
// Unrelated changes in net/http may change the order and default-values of
// HTTP headers, causing WebSocket tests to fail. It is safe to update this
// string in that case.
@@ -51,10 +62,12 @@ std::string WebSocketStandardRequest(const std::string& path,
"User-Agent:\r\n"
"Accept-Encoding: gzip, deflate\r\n"
"Accept-Language: en-us,fr\r\n"
+ "%s"
"Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n"
"Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\n"
"%s\r\n",
- path.c_str(), host.c_str(), origin.c_str(), extra_headers.c_str());
+ path.c_str(), host.c_str(), origin.c_str(), cookies.c_str(),
+ extra_headers.c_str());
}
std::string WebSocketStandardResponse(const std::string& extra_headers) {
@@ -151,6 +164,13 @@ void WebSocketTestURLRequestContextHost::AddSSLSocketDataProvider(
maker_.AddSSLSocketDataProvider(ssl_socket_data.Pass());
}
+void WebSocketTestURLRequestContextHost::SetProxyConfig(
+ const std::string& proxy_rules) {
+ DCHECK(!url_request_context_initialized_);
+ proxy_service_.reset(ProxyService::CreateFixed(proxy_rules));
+ url_request_context_.set_proxy_service(proxy_service_.get());
+}
+
TestURLRequestContext*
WebSocketTestURLRequestContextHost::GetURLRequestContext() {
if (!url_request_context_initialized_) {
« no previous file with comments | « net/websockets/websocket_test_util.h ('k') | sandbox/linux/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698