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

Unified Diff: net/websockets/websocket_stream_test.cc

Issue 902553002: Change error message for WebSocket tunnel failure. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix memory leak and simplify SetProxyService() 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_stream.cc ('k') | net/websockets/websocket_test_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_stream_test.cc
diff --git a/net/websockets/websocket_stream_test.cc b/net/websockets/websocket_stream_test.cc
index 713af37715f2b427b8ec9f76a1c8e7b488c892c7..8cfc0f1d1e59760b392ce9f9a2388c74252e7a8e 100644
--- a/net/websockets/websocket_stream_test.cc
+++ b/net/websockets/websocket_stream_test.cc
@@ -22,6 +22,7 @@
#include "net/base/test_data_directory.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
+#include "net/proxy/proxy_service.h"
#include "net/socket/client_socket_handle.h"
#include "net/socket/socket_test_util.h"
#include "net/test/cert_test_util.h"
@@ -1412,5 +1413,33 @@ TEST_F(WebSocketStreamCreateTest, HandleErrConnectionClosed) {
EXPECT_TRUE(has_failed());
}
+TEST_F(WebSocketStreamCreateTest, HandleErrTunnelConnectionFailed) {
+ static const char kConnectRequest[] =
+ "CONNECT localhost:80 HTTP/1.1\r\n"
+ "Host: localhost\r\n"
+ "Proxy-Connection: keep-alive\r\n"
+ "\r\n";
+
+ static const char kProxyResponse[] =
+ "HTTP/1.1 403 Forbidden\r\n"
+ "Content-Type: text/html\r\n"
+ "Content-Length: 9\r\n"
+ "Connection: keep-alive\r\n"
+ "\r\n"
+ "Forbidden";
+
+ MockRead reads[] = {MockRead(SYNCHRONOUS, 1, kProxyResponse)};
+ MockWrite writes[] = {MockWrite(SYNCHRONOUS, 0, kConnectRequest)};
+ scoped_ptr<DeterministicSocketData> socket_data(
+ BuildSocketData(reads, writes));
+ url_request_context_host_.SetProxyConfig("https=proxy:8000");
+ CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(),
+ "http://localhost", socket_data.Pass());
+ RunUntilIdle();
+ EXPECT_TRUE(has_failed());
+ EXPECT_EQ("Establishing a tunnel via proxy server failed.",
+ failure_message());
+}
+
} // namespace
} // namespace net
« no previous file with comments | « net/websockets/websocket_stream.cc ('k') | net/websockets/websocket_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698