| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/websockets/websocket_stream.h" | 5 #include "net/websockets/websocket_stream.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); | 1284 socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); |
| 1285 CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), | 1285 CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), |
| 1286 "http://localhost", socket_data.Pass()); | 1286 "http://localhost", socket_data.Pass()); |
| 1287 WaitUntilConnectDone(); | 1287 WaitUntilConnectDone(); |
| 1288 EXPECT_TRUE(has_failed()); | 1288 EXPECT_TRUE(has_failed()); |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 TEST_F(WebSocketStreamCreateTest, HandleErrTunnelConnectionFailed) { | 1291 TEST_F(WebSocketStreamCreateTest, HandleErrTunnelConnectionFailed) { |
| 1292 static const char kConnectRequest[] = | 1292 static const char kConnectRequest[] = |
| 1293 "CONNECT localhost:80 HTTP/1.1\r\n" | 1293 "CONNECT localhost:80 HTTP/1.1\r\n" |
| 1294 "Host: localhost\r\n" | 1294 "Host: localhost:80\r\n" |
| 1295 "Proxy-Connection: keep-alive\r\n" | 1295 "Proxy-Connection: keep-alive\r\n" |
| 1296 "\r\n"; | 1296 "\r\n"; |
| 1297 | 1297 |
| 1298 static const char kProxyResponse[] = | 1298 static const char kProxyResponse[] = |
| 1299 "HTTP/1.1 403 Forbidden\r\n" | 1299 "HTTP/1.1 403 Forbidden\r\n" |
| 1300 "Content-Type: text/html\r\n" | 1300 "Content-Type: text/html\r\n" |
| 1301 "Content-Length: 9\r\n" | 1301 "Content-Length: 9\r\n" |
| 1302 "Connection: keep-alive\r\n" | 1302 "Connection: keep-alive\r\n" |
| 1303 "\r\n" | 1303 "\r\n" |
| 1304 "Forbidden"; | 1304 "Forbidden"; |
| 1305 | 1305 |
| 1306 MockRead reads[] = {MockRead(SYNCHRONOUS, 1, kProxyResponse)}; | 1306 MockRead reads[] = {MockRead(SYNCHRONOUS, 1, kProxyResponse)}; |
| 1307 MockWrite writes[] = {MockWrite(SYNCHRONOUS, 0, kConnectRequest)}; | 1307 MockWrite writes[] = {MockWrite(SYNCHRONOUS, 0, kConnectRequest)}; |
| 1308 scoped_ptr<DeterministicSocketData> socket_data( | 1308 scoped_ptr<DeterministicSocketData> socket_data( |
| 1309 BuildSocketData(reads, writes)); | 1309 BuildSocketData(reads, writes)); |
| 1310 url_request_context_host_.SetProxyConfig("https=proxy:8000"); | 1310 url_request_context_host_.SetProxyConfig("https=proxy:8000"); |
| 1311 CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), | 1311 CreateAndConnectRawExpectations("ws://localhost/", NoSubProtocols(), |
| 1312 "http://localhost", socket_data.Pass()); | 1312 "http://localhost", socket_data.Pass()); |
| 1313 WaitUntilConnectDone(); | 1313 WaitUntilConnectDone(); |
| 1314 EXPECT_TRUE(has_failed()); | 1314 EXPECT_TRUE(has_failed()); |
| 1315 EXPECT_EQ("Establishing a tunnel via proxy server failed.", | 1315 EXPECT_EQ("Establishing a tunnel via proxy server failed.", |
| 1316 failure_message()); | 1316 failure_message()); |
| 1317 } | 1317 } |
| 1318 | 1318 |
| 1319 } // namespace | 1319 } // namespace |
| 1320 } // namespace net | 1320 } // namespace net |
| OLD | NEW |