| 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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 225 } |
| 226 | 226 |
| 227 void AddWebSocketHeaders(HttpRequestHeaders* headers) { | 227 void AddWebSocketHeaders(HttpRequestHeaders* headers) { |
| 228 headers->SetHeader("Connection", "Upgrade"); | 228 headers->SetHeader("Connection", "Upgrade"); |
| 229 headers->SetHeader("Upgrade", "websocket"); | 229 headers->SetHeader("Upgrade", "websocket"); |
| 230 headers->SetHeader("Origin", "http://www.example.org"); | 230 headers->SetHeader("Origin", "http://www.example.org"); |
| 231 headers->SetHeader("Sec-WebSocket-Version", "13"); | 231 headers->SetHeader("Sec-WebSocket-Version", "13"); |
| 232 headers->SetHeader("Sec-WebSocket-Key", "dGhlIHNhbXBsZSBub25jZQ=="); | 232 headers->SetHeader("Sec-WebSocket-Key", "dGhlIHNhbXBsZSBub25jZQ=="); |
| 233 } | 233 } |
| 234 | 234 |
| 235 HttpNetworkSession* CreateSession(SpdySessionDependencies* session_deps) { | 235 scoped_ptr<HttpNetworkSession> CreateSession( |
| 236 SpdySessionDependencies* session_deps) { |
| 236 return SpdySessionDependencies::SpdyCreateSession(session_deps); | 237 return SpdySessionDependencies::SpdyCreateSession(session_deps); |
| 237 } | 238 } |
| 238 | 239 |
| 239 } // namespace | 240 } // namespace |
| 240 | 241 |
| 241 class HttpNetworkTransactionTest | 242 class HttpNetworkTransactionTest |
| 242 : public PlatformTest, | 243 : public PlatformTest, |
| 243 public ::testing::WithParamInterface<NextProto> { | 244 public ::testing::WithParamInterface<NextProto> { |
| 244 public: | 245 public: |
| 245 virtual ~HttpNetworkTransactionTest() { | 246 virtual ~HttpNetworkTransactionTest() { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 size_t data_count) { | 322 size_t data_count) { |
| 322 SimpleGetHelperResult out; | 323 SimpleGetHelperResult out; |
| 323 | 324 |
| 324 HttpRequestInfo request; | 325 HttpRequestInfo request; |
| 325 request.method = "GET"; | 326 request.method = "GET"; |
| 326 request.url = GURL("http://www.example.org/"); | 327 request.url = GURL("http://www.example.org/"); |
| 327 request.load_flags = 0; | 328 request.load_flags = 0; |
| 328 | 329 |
| 329 BoundTestNetLog log; | 330 BoundTestNetLog log; |
| 330 session_deps_.net_log = log.bound().net_log(); | 331 session_deps_.net_log = log.bound().net_log(); |
| 331 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 332 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 332 scoped_ptr<HttpTransaction> trans( | 333 scoped_ptr<HttpTransaction> trans( |
| 333 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 334 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 334 | 335 |
| 335 for (size_t i = 0; i < data_count; ++i) { | 336 for (size_t i = 0; i < data_count; ++i) { |
| 336 session_deps_.socket_factory->AddSocketDataProvider(data[i]); | 337 session_deps_.socket_factory->AddSocketDataProvider(data[i]); |
| 337 } | 338 } |
| 338 | 339 |
| 339 TestCompletionCallback callback; | 340 TestCompletionCallback callback; |
| 340 | 341 |
| 341 EXPECT_TRUE(log.bound().IsCapturing()); | 342 EXPECT_TRUE(log.bound().IsCapturing()); |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 EXPECT_EQ("172.22.68.17:80", auth_challenge->challenger.ToString()); | 673 EXPECT_EQ("172.22.68.17:80", auth_challenge->challenger.ToString()); |
| 673 EXPECT_EQ(std::string(), auth_challenge->realm); | 674 EXPECT_EQ(std::string(), auth_challenge->realm); |
| 674 EXPECT_EQ("ntlm", auth_challenge->scheme); | 675 EXPECT_EQ("ntlm", auth_challenge->scheme); |
| 675 return true; | 676 return true; |
| 676 } | 677 } |
| 677 #endif // defined(NTLM_PORTABLE) | 678 #endif // defined(NTLM_PORTABLE) |
| 678 | 679 |
| 679 } // namespace | 680 } // namespace |
| 680 | 681 |
| 681 TEST_P(HttpNetworkTransactionTest, Basic) { | 682 TEST_P(HttpNetworkTransactionTest, Basic) { |
| 682 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 683 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 683 scoped_ptr<HttpTransaction> trans( | 684 scoped_ptr<HttpTransaction> trans( |
| 684 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 685 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 685 } | 686 } |
| 686 | 687 |
| 687 TEST_P(HttpNetworkTransactionTest, SimpleGET) { | 688 TEST_P(HttpNetworkTransactionTest, SimpleGET) { |
| 688 MockRead data_reads[] = { | 689 MockRead data_reads[] = { |
| 689 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 690 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
| 690 MockRead("hello world"), | 691 MockRead("hello world"), |
| 691 MockRead(SYNCHRONOUS, OK), | 692 MockRead(SYNCHRONOUS, OK), |
| 692 }; | 693 }; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 MockRead("Location: http://good.com/\r\n"), | 994 MockRead("Location: http://good.com/\r\n"), |
| 994 MockRead("Content-Length: 0\r\n\r\n"), | 995 MockRead("Content-Length: 0\r\n\r\n"), |
| 995 MockRead(SYNCHRONOUS, OK), | 996 MockRead(SYNCHRONOUS, OK), |
| 996 }; | 997 }; |
| 997 | 998 |
| 998 HttpRequestInfo request; | 999 HttpRequestInfo request; |
| 999 request.method = "GET"; | 1000 request.method = "GET"; |
| 1000 request.url = GURL("http://redirect.com/"); | 1001 request.url = GURL("http://redirect.com/"); |
| 1001 request.load_flags = 0; | 1002 request.load_flags = 0; |
| 1002 | 1003 |
| 1003 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1004 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1004 scoped_ptr<HttpTransaction> trans( | 1005 scoped_ptr<HttpTransaction> trans( |
| 1005 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1006 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1006 | 1007 |
| 1007 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1008 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 1008 session_deps_.socket_factory->AddSocketDataProvider(&data); | 1009 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 1009 | 1010 |
| 1010 TestCompletionCallback callback; | 1011 TestCompletionCallback callback; |
| 1011 | 1012 |
| 1012 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 1013 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 1013 EXPECT_EQ(ERR_IO_PENDING, rv); | 1014 EXPECT_EQ(ERR_IO_PENDING, rv); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1038 } | 1039 } |
| 1039 | 1040 |
| 1040 // Do a request using the HEAD method. Verify that we don't try to read the | 1041 // Do a request using the HEAD method. Verify that we don't try to read the |
| 1041 // message body (since HEAD has none). | 1042 // message body (since HEAD has none). |
| 1042 TEST_P(HttpNetworkTransactionTest, Head) { | 1043 TEST_P(HttpNetworkTransactionTest, Head) { |
| 1043 HttpRequestInfo request; | 1044 HttpRequestInfo request; |
| 1044 request.method = "HEAD"; | 1045 request.method = "HEAD"; |
| 1045 request.url = GURL("http://www.example.org/"); | 1046 request.url = GURL("http://www.example.org/"); |
| 1046 request.load_flags = 0; | 1047 request.load_flags = 0; |
| 1047 | 1048 |
| 1048 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1049 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1049 scoped_ptr<HttpTransaction> trans( | 1050 scoped_ptr<HttpTransaction> trans( |
| 1050 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1051 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1051 BeforeProxyHeadersSentHandler proxy_headers_handler; | 1052 BeforeProxyHeadersSentHandler proxy_headers_handler; |
| 1052 trans->SetBeforeProxyHeadersSentCallback( | 1053 trans->SetBeforeProxyHeadersSentCallback( |
| 1053 base::Bind(&BeforeProxyHeadersSentHandler::OnBeforeProxyHeadersSent, | 1054 base::Bind(&BeforeProxyHeadersSentHandler::OnBeforeProxyHeadersSent, |
| 1054 base::Unretained(&proxy_headers_handler))); | 1055 base::Unretained(&proxy_headers_handler))); |
| 1055 | 1056 |
| 1056 MockWrite data_writes1[] = { | 1057 MockWrite data_writes1[] = { |
| 1057 MockWrite("HEAD / HTTP/1.1\r\n" | 1058 MockWrite("HEAD / HTTP/1.1\r\n" |
| 1058 "Host: www.example.org\r\n" | 1059 "Host: www.example.org\r\n" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 | 1099 |
| 1099 // Reading should give EOF right away, since there is no message body | 1100 // Reading should give EOF right away, since there is no message body |
| 1100 // (despite non-zero content-length). | 1101 // (despite non-zero content-length). |
| 1101 std::string response_data; | 1102 std::string response_data; |
| 1102 rv = ReadTransaction(trans.get(), &response_data); | 1103 rv = ReadTransaction(trans.get(), &response_data); |
| 1103 EXPECT_EQ(OK, rv); | 1104 EXPECT_EQ(OK, rv); |
| 1104 EXPECT_EQ("", response_data); | 1105 EXPECT_EQ("", response_data); |
| 1105 } | 1106 } |
| 1106 | 1107 |
| 1107 TEST_P(HttpNetworkTransactionTest, ReuseConnection) { | 1108 TEST_P(HttpNetworkTransactionTest, ReuseConnection) { |
| 1108 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1109 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1109 | 1110 |
| 1110 MockRead data_reads[] = { | 1111 MockRead data_reads[] = { |
| 1111 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\n"), | 1112 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\n"), |
| 1112 MockRead("hello"), | 1113 MockRead("hello"), |
| 1113 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\n"), | 1114 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\n"), |
| 1114 MockRead("world"), | 1115 MockRead("world"), |
| 1115 MockRead(SYNCHRONOUS, OK), | 1116 MockRead(SYNCHRONOUS, OK), |
| 1116 }; | 1117 }; |
| 1117 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1118 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 1118 session_deps_.socket_factory->AddSocketDataProvider(&data); | 1119 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 ScopedVector<UploadElementReader> element_readers; | 1157 ScopedVector<UploadElementReader> element_readers; |
| 1157 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 1158 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 1158 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 1159 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 1159 | 1160 |
| 1160 HttpRequestInfo request; | 1161 HttpRequestInfo request; |
| 1161 request.method = "POST"; | 1162 request.method = "POST"; |
| 1162 request.url = GURL("http://www.foo.com/"); | 1163 request.url = GURL("http://www.foo.com/"); |
| 1163 request.upload_data_stream = &upload_data_stream; | 1164 request.upload_data_stream = &upload_data_stream; |
| 1164 request.load_flags = 0; | 1165 request.load_flags = 0; |
| 1165 | 1166 |
| 1166 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1167 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1167 scoped_ptr<HttpTransaction> trans( | 1168 scoped_ptr<HttpTransaction> trans( |
| 1168 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1169 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1169 | 1170 |
| 1170 MockRead data_reads[] = { | 1171 MockRead data_reads[] = { |
| 1171 MockRead("HTTP/1.0 100 Continue\r\n\r\n"), | 1172 MockRead("HTTP/1.0 100 Continue\r\n\r\n"), |
| 1172 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 1173 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
| 1173 MockRead("hello world"), | 1174 MockRead("hello world"), |
| 1174 MockRead(SYNCHRONOUS, OK), | 1175 MockRead(SYNCHRONOUS, OK), |
| 1175 }; | 1176 }; |
| 1176 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1177 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1198 | 1199 |
| 1199 // This test is almost the same as Ignores100 above, but the response contains | 1200 // This test is almost the same as Ignores100 above, but the response contains |
| 1200 // a 102 instead of a 100. Also, instead of HTTP/1.0 the response is | 1201 // a 102 instead of a 100. Also, instead of HTTP/1.0 the response is |
| 1201 // HTTP/1.1 and the two status headers are read in one read. | 1202 // HTTP/1.1 and the two status headers are read in one read. |
| 1202 TEST_P(HttpNetworkTransactionTest, Ignores1xx) { | 1203 TEST_P(HttpNetworkTransactionTest, Ignores1xx) { |
| 1203 HttpRequestInfo request; | 1204 HttpRequestInfo request; |
| 1204 request.method = "GET"; | 1205 request.method = "GET"; |
| 1205 request.url = GURL("http://www.foo.com/"); | 1206 request.url = GURL("http://www.foo.com/"); |
| 1206 request.load_flags = 0; | 1207 request.load_flags = 0; |
| 1207 | 1208 |
| 1208 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1209 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1209 scoped_ptr<HttpTransaction> trans( | 1210 scoped_ptr<HttpTransaction> trans( |
| 1210 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1211 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1211 | 1212 |
| 1212 MockRead data_reads[] = { | 1213 MockRead data_reads[] = { |
| 1213 MockRead("HTTP/1.1 102 Unspecified status code\r\n\r\n" | 1214 MockRead("HTTP/1.1 102 Unspecified status code\r\n\r\n" |
| 1214 "HTTP/1.1 200 OK\r\n\r\n"), | 1215 "HTTP/1.1 200 OK\r\n\r\n"), |
| 1215 MockRead("hello world"), | 1216 MockRead("hello world"), |
| 1216 MockRead(SYNCHRONOUS, OK), | 1217 MockRead(SYNCHRONOUS, OK), |
| 1217 }; | 1218 }; |
| 1218 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1219 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1237 EXPECT_EQ(OK, rv); | 1238 EXPECT_EQ(OK, rv); |
| 1238 EXPECT_EQ("hello world", response_data); | 1239 EXPECT_EQ("hello world", response_data); |
| 1239 } | 1240 } |
| 1240 | 1241 |
| 1241 TEST_P(HttpNetworkTransactionTest, Incomplete100ThenEOF) { | 1242 TEST_P(HttpNetworkTransactionTest, Incomplete100ThenEOF) { |
| 1242 HttpRequestInfo request; | 1243 HttpRequestInfo request; |
| 1243 request.method = "POST"; | 1244 request.method = "POST"; |
| 1244 request.url = GURL("http://www.foo.com/"); | 1245 request.url = GURL("http://www.foo.com/"); |
| 1245 request.load_flags = 0; | 1246 request.load_flags = 0; |
| 1246 | 1247 |
| 1247 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1248 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1248 scoped_ptr<HttpTransaction> trans( | 1249 scoped_ptr<HttpTransaction> trans( |
| 1249 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1250 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1250 | 1251 |
| 1251 MockRead data_reads[] = { | 1252 MockRead data_reads[] = { |
| 1252 MockRead(SYNCHRONOUS, "HTTP/1.0 100 Continue\r\n"), | 1253 MockRead(SYNCHRONOUS, "HTTP/1.0 100 Continue\r\n"), |
| 1253 MockRead(ASYNC, 0), | 1254 MockRead(ASYNC, 0), |
| 1254 }; | 1255 }; |
| 1255 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1256 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 1256 session_deps_.socket_factory->AddSocketDataProvider(&data); | 1257 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 1257 | 1258 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1268 EXPECT_EQ(OK, rv); | 1269 EXPECT_EQ(OK, rv); |
| 1269 EXPECT_EQ("", response_data); | 1270 EXPECT_EQ("", response_data); |
| 1270 } | 1271 } |
| 1271 | 1272 |
| 1272 TEST_P(HttpNetworkTransactionTest, EmptyResponse) { | 1273 TEST_P(HttpNetworkTransactionTest, EmptyResponse) { |
| 1273 HttpRequestInfo request; | 1274 HttpRequestInfo request; |
| 1274 request.method = "POST"; | 1275 request.method = "POST"; |
| 1275 request.url = GURL("http://www.foo.com/"); | 1276 request.url = GURL("http://www.foo.com/"); |
| 1276 request.load_flags = 0; | 1277 request.load_flags = 0; |
| 1277 | 1278 |
| 1278 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1279 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1279 scoped_ptr<HttpTransaction> trans( | 1280 scoped_ptr<HttpTransaction> trans( |
| 1280 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1281 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1281 | 1282 |
| 1282 MockRead data_reads[] = { | 1283 MockRead data_reads[] = { |
| 1283 MockRead(ASYNC, 0), | 1284 MockRead(ASYNC, 0), |
| 1284 }; | 1285 }; |
| 1285 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1286 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 1286 session_deps_.socket_factory->AddSocketDataProvider(&data); | 1287 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 1287 | 1288 |
| 1288 TestCompletionCallback callback; | 1289 TestCompletionCallback callback; |
| 1289 | 1290 |
| 1290 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 1291 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 1291 EXPECT_EQ(ERR_IO_PENDING, rv); | 1292 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1292 | 1293 |
| 1293 rv = callback.WaitForResult(); | 1294 rv = callback.WaitForResult(); |
| 1294 EXPECT_EQ(ERR_EMPTY_RESPONSE, rv); | 1295 EXPECT_EQ(ERR_EMPTY_RESPONSE, rv); |
| 1295 } | 1296 } |
| 1296 | 1297 |
| 1297 void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest( | 1298 void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest( |
| 1298 const MockWrite* write_failure, | 1299 const MockWrite* write_failure, |
| 1299 const MockRead* read_failure) { | 1300 const MockRead* read_failure) { |
| 1300 HttpRequestInfo request; | 1301 HttpRequestInfo request; |
| 1301 request.method = "GET"; | 1302 request.method = "GET"; |
| 1302 request.url = GURL("http://www.foo.com/"); | 1303 request.url = GURL("http://www.foo.com/"); |
| 1303 request.load_flags = 0; | 1304 request.load_flags = 0; |
| 1304 | 1305 |
| 1305 TestNetLog net_log; | 1306 TestNetLog net_log; |
| 1306 session_deps_.net_log = &net_log; | 1307 session_deps_.net_log = &net_log; |
| 1307 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1308 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1308 | 1309 |
| 1309 // Written data for successfully sending both requests. | 1310 // Written data for successfully sending both requests. |
| 1310 MockWrite data1_writes[] = { | 1311 MockWrite data1_writes[] = { |
| 1311 MockWrite("GET / HTTP/1.1\r\n" | 1312 MockWrite("GET / HTTP/1.1\r\n" |
| 1312 "Host: www.foo.com\r\n" | 1313 "Host: www.foo.com\r\n" |
| 1313 "Connection: keep-alive\r\n\r\n"), | 1314 "Connection: keep-alive\r\n\r\n"), |
| 1314 MockWrite("GET / HTTP/1.1\r\n" | 1315 MockWrite("GET / HTTP/1.1\r\n" |
| 1315 "Host: www.foo.com\r\n" | 1316 "Host: www.foo.com\r\n" |
| 1316 "Connection: keep-alive\r\n\r\n") | 1317 "Connection: keep-alive\r\n\r\n") |
| 1317 }; | 1318 }; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 const MockWrite* write_failure, | 1388 const MockWrite* write_failure, |
| 1388 const MockRead* read_failure, | 1389 const MockRead* read_failure, |
| 1389 bool use_spdy) { | 1390 bool use_spdy) { |
| 1390 HttpRequestInfo request; | 1391 HttpRequestInfo request; |
| 1391 request.method = "GET"; | 1392 request.method = "GET"; |
| 1392 request.url = GURL("https://www.foo.com/"); | 1393 request.url = GURL("https://www.foo.com/"); |
| 1393 request.load_flags = 0; | 1394 request.load_flags = 0; |
| 1394 | 1395 |
| 1395 TestNetLog net_log; | 1396 TestNetLog net_log; |
| 1396 session_deps_.net_log = &net_log; | 1397 session_deps_.net_log = &net_log; |
| 1397 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1398 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1398 | 1399 |
| 1399 SSLSocketDataProvider ssl1(ASYNC, OK); | 1400 SSLSocketDataProvider ssl1(ASYNC, OK); |
| 1400 SSLSocketDataProvider ssl2(ASYNC, OK); | 1401 SSLSocketDataProvider ssl2(ASYNC, OK); |
| 1401 if (use_spdy) { | 1402 if (use_spdy) { |
| 1402 ssl1.SetNextProto(GetParam()); | 1403 ssl1.SetNextProto(GetParam()); |
| 1403 ssl2.SetNextProto(GetParam()); | 1404 ssl2.SetNextProto(GetParam()); |
| 1404 } | 1405 } |
| 1405 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); | 1406 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); |
| 1406 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); | 1407 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 1407 | 1408 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 MockRead read_failure(ASYNC, OK); // EOF | 1584 MockRead read_failure(ASYNC, OK); // EOF |
| 1584 PreconnectErrorResendRequestTest(NULL, &read_failure, true); | 1585 PreconnectErrorResendRequestTest(NULL, &read_failure, true); |
| 1585 } | 1586 } |
| 1586 | 1587 |
| 1587 TEST_P(HttpNetworkTransactionTest, NonKeepAliveConnectionReset) { | 1588 TEST_P(HttpNetworkTransactionTest, NonKeepAliveConnectionReset) { |
| 1588 HttpRequestInfo request; | 1589 HttpRequestInfo request; |
| 1589 request.method = "GET"; | 1590 request.method = "GET"; |
| 1590 request.url = GURL("http://www.example.org/"); | 1591 request.url = GURL("http://www.example.org/"); |
| 1591 request.load_flags = 0; | 1592 request.load_flags = 0; |
| 1592 | 1593 |
| 1593 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1594 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1594 scoped_ptr<HttpTransaction> trans( | 1595 scoped_ptr<HttpTransaction> trans( |
| 1595 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1596 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1596 | 1597 |
| 1597 MockRead data_reads[] = { | 1598 MockRead data_reads[] = { |
| 1598 MockRead(ASYNC, ERR_CONNECTION_RESET), | 1599 MockRead(ASYNC, ERR_CONNECTION_RESET), |
| 1599 MockRead("HTTP/1.0 200 OK\r\n\r\n"), // Should not be used | 1600 MockRead("HTTP/1.0 200 OK\r\n\r\n"), // Should not be used |
| 1600 MockRead("hello world"), | 1601 MockRead("hello world"), |
| 1601 MockRead(SYNCHRONOUS, OK), | 1602 MockRead(SYNCHRONOUS, OK), |
| 1602 }; | 1603 }; |
| 1603 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1604 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 EXPECT_EQ(ERR_EMPTY_RESPONSE, out.rv); | 1638 EXPECT_EQ(ERR_EMPTY_RESPONSE, out.rv); |
| 1638 } | 1639 } |
| 1639 | 1640 |
| 1640 // Test that network access can be deferred and resumed. | 1641 // Test that network access can be deferred and resumed. |
| 1641 TEST_P(HttpNetworkTransactionTest, ThrottleBeforeNetworkStart) { | 1642 TEST_P(HttpNetworkTransactionTest, ThrottleBeforeNetworkStart) { |
| 1642 HttpRequestInfo request; | 1643 HttpRequestInfo request; |
| 1643 request.method = "GET"; | 1644 request.method = "GET"; |
| 1644 request.url = GURL("http://www.example.org/"); | 1645 request.url = GURL("http://www.example.org/"); |
| 1645 request.load_flags = 0; | 1646 request.load_flags = 0; |
| 1646 | 1647 |
| 1647 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1648 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1648 scoped_ptr<HttpTransaction> trans( | 1649 scoped_ptr<HttpTransaction> trans( |
| 1649 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1650 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1650 | 1651 |
| 1651 // Defer on OnBeforeNetworkStart. | 1652 // Defer on OnBeforeNetworkStart. |
| 1652 BeforeNetworkStartHandler net_start_handler(true); // defer | 1653 BeforeNetworkStartHandler net_start_handler(true); // defer |
| 1653 trans->SetBeforeNetworkStartCallback( | 1654 trans->SetBeforeNetworkStartCallback( |
| 1654 base::Bind(&BeforeNetworkStartHandler::OnBeforeNetworkStart, | 1655 base::Bind(&BeforeNetworkStartHandler::OnBeforeNetworkStart, |
| 1655 base::Unretained(&net_start_handler))); | 1656 base::Unretained(&net_start_handler))); |
| 1656 | 1657 |
| 1657 MockRead data_reads[] = { | 1658 MockRead data_reads[] = { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1686 trans.reset(); | 1687 trans.reset(); |
| 1687 } | 1688 } |
| 1688 | 1689 |
| 1689 // Test that network use can be deferred and canceled. | 1690 // Test that network use can be deferred and canceled. |
| 1690 TEST_P(HttpNetworkTransactionTest, ThrottleAndCancelBeforeNetworkStart) { | 1691 TEST_P(HttpNetworkTransactionTest, ThrottleAndCancelBeforeNetworkStart) { |
| 1691 HttpRequestInfo request; | 1692 HttpRequestInfo request; |
| 1692 request.method = "GET"; | 1693 request.method = "GET"; |
| 1693 request.url = GURL("http://www.example.org/"); | 1694 request.url = GURL("http://www.example.org/"); |
| 1694 request.load_flags = 0; | 1695 request.load_flags = 0; |
| 1695 | 1696 |
| 1696 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1697 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1697 scoped_ptr<HttpTransaction> trans( | 1698 scoped_ptr<HttpTransaction> trans( |
| 1698 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1699 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1699 | 1700 |
| 1700 // Defer on OnBeforeNetworkStart. | 1701 // Defer on OnBeforeNetworkStart. |
| 1701 BeforeNetworkStartHandler net_start_handler(true); // defer | 1702 BeforeNetworkStartHandler net_start_handler(true); // defer |
| 1702 trans->SetBeforeNetworkStartCallback( | 1703 trans->SetBeforeNetworkStartCallback( |
| 1703 base::Bind(&BeforeNetworkStartHandler::OnBeforeNetworkStart, | 1704 base::Bind(&BeforeNetworkStartHandler::OnBeforeNetworkStart, |
| 1704 base::Unretained(&net_start_handler))); | 1705 base::Unretained(&net_start_handler))); |
| 1705 | 1706 |
| 1706 TestCompletionCallback callback; | 1707 TestCompletionCallback callback; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1717 // Next 2 cases (KeepAliveEarlyClose and KeepAliveEarlyClose2) are regression | 1718 // Next 2 cases (KeepAliveEarlyClose and KeepAliveEarlyClose2) are regression |
| 1718 // tests. There was a bug causing HttpNetworkTransaction to hang in the | 1719 // tests. There was a bug causing HttpNetworkTransaction to hang in the |
| 1719 // destructor in such situations. | 1720 // destructor in such situations. |
| 1720 // See http://crbug.com/154712 and http://crbug.com/156609. | 1721 // See http://crbug.com/154712 and http://crbug.com/156609. |
| 1721 TEST_P(HttpNetworkTransactionTest, KeepAliveEarlyClose) { | 1722 TEST_P(HttpNetworkTransactionTest, KeepAliveEarlyClose) { |
| 1722 HttpRequestInfo request; | 1723 HttpRequestInfo request; |
| 1723 request.method = "GET"; | 1724 request.method = "GET"; |
| 1724 request.url = GURL("http://www.example.org/"); | 1725 request.url = GURL("http://www.example.org/"); |
| 1725 request.load_flags = 0; | 1726 request.load_flags = 0; |
| 1726 | 1727 |
| 1727 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1728 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1728 scoped_ptr<HttpTransaction> trans( | 1729 scoped_ptr<HttpTransaction> trans( |
| 1729 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1730 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1730 | 1731 |
| 1731 MockRead data_reads[] = { | 1732 MockRead data_reads[] = { |
| 1732 MockRead("HTTP/1.0 200 OK\r\n"), | 1733 MockRead("HTTP/1.0 200 OK\r\n"), |
| 1733 MockRead("Connection: keep-alive\r\n"), | 1734 MockRead("Connection: keep-alive\r\n"), |
| 1734 MockRead("Content-Length: 100\r\n\r\n"), | 1735 MockRead("Content-Length: 100\r\n\r\n"), |
| 1735 MockRead("hello"), | 1736 MockRead("hello"), |
| 1736 MockRead(SYNCHRONOUS, 0), | 1737 MockRead(SYNCHRONOUS, 0), |
| 1737 }; | 1738 }; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1758 base::MessageLoop::current()->RunUntilIdle(); | 1759 base::MessageLoop::current()->RunUntilIdle(); |
| 1759 EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); | 1760 EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); |
| 1760 } | 1761 } |
| 1761 | 1762 |
| 1762 TEST_P(HttpNetworkTransactionTest, KeepAliveEarlyClose2) { | 1763 TEST_P(HttpNetworkTransactionTest, KeepAliveEarlyClose2) { |
| 1763 HttpRequestInfo request; | 1764 HttpRequestInfo request; |
| 1764 request.method = "GET"; | 1765 request.method = "GET"; |
| 1765 request.url = GURL("http://www.example.org/"); | 1766 request.url = GURL("http://www.example.org/"); |
| 1766 request.load_flags = 0; | 1767 request.load_flags = 0; |
| 1767 | 1768 |
| 1768 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1769 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1769 scoped_ptr<HttpTransaction> trans( | 1770 scoped_ptr<HttpTransaction> trans( |
| 1770 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1771 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1771 | 1772 |
| 1772 MockRead data_reads[] = { | 1773 MockRead data_reads[] = { |
| 1773 MockRead("HTTP/1.0 200 OK\r\n"), | 1774 MockRead("HTTP/1.0 200 OK\r\n"), |
| 1774 MockRead("Connection: keep-alive\r\n"), | 1775 MockRead("Connection: keep-alive\r\n"), |
| 1775 MockRead("Content-Length: 100\r\n\r\n"), | 1776 MockRead("Content-Length: 100\r\n\r\n"), |
| 1776 MockRead(SYNCHRONOUS, 0), | 1777 MockRead(SYNCHRONOUS, 0), |
| 1777 }; | 1778 }; |
| 1778 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1779 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1800 // Test that we correctly reuse a keep-alive connection after not explicitly | 1801 // Test that we correctly reuse a keep-alive connection after not explicitly |
| 1801 // reading the body. | 1802 // reading the body. |
| 1802 TEST_P(HttpNetworkTransactionTest, KeepAliveAfterUnreadBody) { | 1803 TEST_P(HttpNetworkTransactionTest, KeepAliveAfterUnreadBody) { |
| 1803 HttpRequestInfo request; | 1804 HttpRequestInfo request; |
| 1804 request.method = "GET"; | 1805 request.method = "GET"; |
| 1805 request.url = GURL("http://www.foo.com/"); | 1806 request.url = GURL("http://www.foo.com/"); |
| 1806 request.load_flags = 0; | 1807 request.load_flags = 0; |
| 1807 | 1808 |
| 1808 TestNetLog net_log; | 1809 TestNetLog net_log; |
| 1809 session_deps_.net_log = &net_log; | 1810 session_deps_.net_log = &net_log; |
| 1810 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1811 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1811 | 1812 |
| 1812 // Note that because all these reads happen in the same | 1813 // Note that because all these reads happen in the same |
| 1813 // StaticSocketDataProvider, it shows that the same socket is being reused for | 1814 // StaticSocketDataProvider, it shows that the same socket is being reused for |
| 1814 // all transactions. | 1815 // all transactions. |
| 1815 MockRead data1_reads[] = { | 1816 MockRead data1_reads[] = { |
| 1816 MockRead("HTTP/1.1 204 No Content\r\n\r\n"), | 1817 MockRead("HTTP/1.1 204 No Content\r\n\r\n"), |
| 1817 MockRead("HTTP/1.1 205 Reset Content\r\n\r\n"), | 1818 MockRead("HTTP/1.1 205 Reset Content\r\n\r\n"), |
| 1818 MockRead("HTTP/1.1 304 Not Modified\r\n\r\n"), | 1819 MockRead("HTTP/1.1 304 Not Modified\r\n\r\n"), |
| 1819 MockRead("HTTP/1.1 302 Found\r\n" | 1820 MockRead("HTTP/1.1 302 Found\r\n" |
| 1820 "Content-Length: 0\r\n\r\n"), | 1821 "Content-Length: 0\r\n\r\n"), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1909 // Test the request-challenge-retry sequence for basic auth. | 1910 // Test the request-challenge-retry sequence for basic auth. |
| 1910 // (basic auth is the easiest to mock, because it has no randomness). | 1911 // (basic auth is the easiest to mock, because it has no randomness). |
| 1911 TEST_P(HttpNetworkTransactionTest, BasicAuth) { | 1912 TEST_P(HttpNetworkTransactionTest, BasicAuth) { |
| 1912 HttpRequestInfo request; | 1913 HttpRequestInfo request; |
| 1913 request.method = "GET"; | 1914 request.method = "GET"; |
| 1914 request.url = GURL("http://www.example.org/"); | 1915 request.url = GURL("http://www.example.org/"); |
| 1915 request.load_flags = 0; | 1916 request.load_flags = 0; |
| 1916 | 1917 |
| 1917 TestNetLog log; | 1918 TestNetLog log; |
| 1918 session_deps_.net_log = &log; | 1919 session_deps_.net_log = &log; |
| 1919 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1920 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1920 scoped_ptr<HttpTransaction> trans( | 1921 scoped_ptr<HttpTransaction> trans( |
| 1921 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1922 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1922 | 1923 |
| 1923 MockWrite data_writes1[] = { | 1924 MockWrite data_writes1[] = { |
| 1924 MockWrite( | 1925 MockWrite( |
| 1925 "GET / HTTP/1.1\r\n" | 1926 "GET / HTTP/1.1\r\n" |
| 1926 "Host: www.example.org\r\n" | 1927 "Host: www.example.org\r\n" |
| 1927 "Connection: keep-alive\r\n\r\n"), | 1928 "Connection: keep-alive\r\n\r\n"), |
| 1928 }; | 1929 }; |
| 1929 | 1930 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 ASSERT_FALSE(endpoint.address().empty()); | 2131 ASSERT_FALSE(endpoint.address().empty()); |
| 2131 EXPECT_EQ("127.0.0.2:80", endpoint.ToString()); | 2132 EXPECT_EQ("127.0.0.2:80", endpoint.ToString()); |
| 2132 } | 2133 } |
| 2133 | 2134 |
| 2134 TEST_P(HttpNetworkTransactionTest, DoNotSendAuth) { | 2135 TEST_P(HttpNetworkTransactionTest, DoNotSendAuth) { |
| 2135 HttpRequestInfo request; | 2136 HttpRequestInfo request; |
| 2136 request.method = "GET"; | 2137 request.method = "GET"; |
| 2137 request.url = GURL("http://www.example.org/"); | 2138 request.url = GURL("http://www.example.org/"); |
| 2138 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2139 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2139 | 2140 |
| 2140 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2141 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2141 scoped_ptr<HttpTransaction> trans( | 2142 scoped_ptr<HttpTransaction> trans( |
| 2142 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2143 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2143 | 2144 |
| 2144 MockWrite data_writes[] = { | 2145 MockWrite data_writes[] = { |
| 2145 MockWrite( | 2146 MockWrite( |
| 2146 "GET / HTTP/1.1\r\n" | 2147 "GET / HTTP/1.1\r\n" |
| 2147 "Host: www.example.org\r\n" | 2148 "Host: www.example.org\r\n" |
| 2148 "Connection: keep-alive\r\n\r\n"), | 2149 "Connection: keep-alive\r\n\r\n"), |
| 2149 }; | 2150 }; |
| 2150 | 2151 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2181 // Test the request-challenge-retry sequence for basic auth, over a keep-alive | 2182 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
| 2182 // connection. | 2183 // connection. |
| 2183 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAlive) { | 2184 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAlive) { |
| 2184 HttpRequestInfo request; | 2185 HttpRequestInfo request; |
| 2185 request.method = "GET"; | 2186 request.method = "GET"; |
| 2186 request.url = GURL("http://www.example.org/"); | 2187 request.url = GURL("http://www.example.org/"); |
| 2187 request.load_flags = 0; | 2188 request.load_flags = 0; |
| 2188 | 2189 |
| 2189 TestNetLog log; | 2190 TestNetLog log; |
| 2190 session_deps_.net_log = &log; | 2191 session_deps_.net_log = &log; |
| 2191 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2192 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2192 | 2193 |
| 2193 MockWrite data_writes1[] = { | 2194 MockWrite data_writes1[] = { |
| 2194 MockWrite( | 2195 MockWrite( |
| 2195 "GET / HTTP/1.1\r\n" | 2196 "GET / HTTP/1.1\r\n" |
| 2196 "Host: www.example.org\r\n" | 2197 "Host: www.example.org\r\n" |
| 2197 "Connection: keep-alive\r\n\r\n"), | 2198 "Connection: keep-alive\r\n\r\n"), |
| 2198 | 2199 |
| 2199 // After calling trans->RestartWithAuth(), this is the request we should | 2200 // After calling trans->RestartWithAuth(), this is the request we should |
| 2200 // be issuing -- the final header line contains the credentials. | 2201 // be issuing -- the final header line contains the credentials. |
| 2201 MockWrite( | 2202 MockWrite( |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2284 } | 2285 } |
| 2285 | 2286 |
| 2286 // Test the request-challenge-retry sequence for basic auth, over a keep-alive | 2287 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
| 2287 // connection and with no response body to drain. | 2288 // connection and with no response body to drain. |
| 2288 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveNoBody) { | 2289 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveNoBody) { |
| 2289 HttpRequestInfo request; | 2290 HttpRequestInfo request; |
| 2290 request.method = "GET"; | 2291 request.method = "GET"; |
| 2291 request.url = GURL("http://www.example.org/"); | 2292 request.url = GURL("http://www.example.org/"); |
| 2292 request.load_flags = 0; | 2293 request.load_flags = 0; |
| 2293 | 2294 |
| 2294 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2295 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2295 | 2296 |
| 2296 MockWrite data_writes1[] = { | 2297 MockWrite data_writes1[] = { |
| 2297 MockWrite( | 2298 MockWrite( |
| 2298 "GET / HTTP/1.1\r\n" | 2299 "GET / HTTP/1.1\r\n" |
| 2299 "Host: www.example.org\r\n" | 2300 "Host: www.example.org\r\n" |
| 2300 "Connection: keep-alive\r\n\r\n"), | 2301 "Connection: keep-alive\r\n\r\n"), |
| 2301 | 2302 |
| 2302 // After calling trans->RestartWithAuth(), this is the request we should | 2303 // After calling trans->RestartWithAuth(), this is the request we should |
| 2303 // be issuing -- the final header line contains the credentials. | 2304 // be issuing -- the final header line contains the credentials. |
| 2304 MockWrite( | 2305 MockWrite( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2362 } | 2363 } |
| 2363 | 2364 |
| 2364 // Test the request-challenge-retry sequence for basic auth, over a keep-alive | 2365 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
| 2365 // connection and with a large response body to drain. | 2366 // connection and with a large response body to drain. |
| 2366 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveLargeBody) { | 2367 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveLargeBody) { |
| 2367 HttpRequestInfo request; | 2368 HttpRequestInfo request; |
| 2368 request.method = "GET"; | 2369 request.method = "GET"; |
| 2369 request.url = GURL("http://www.example.org/"); | 2370 request.url = GURL("http://www.example.org/"); |
| 2370 request.load_flags = 0; | 2371 request.load_flags = 0; |
| 2371 | 2372 |
| 2372 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2373 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2373 | 2374 |
| 2374 MockWrite data_writes1[] = { | 2375 MockWrite data_writes1[] = { |
| 2375 MockWrite( | 2376 MockWrite( |
| 2376 "GET / HTTP/1.1\r\n" | 2377 "GET / HTTP/1.1\r\n" |
| 2377 "Host: www.example.org\r\n" | 2378 "Host: www.example.org\r\n" |
| 2378 "Connection: keep-alive\r\n\r\n"), | 2379 "Connection: keep-alive\r\n\r\n"), |
| 2379 | 2380 |
| 2380 // After calling trans->RestartWithAuth(), this is the request we should | 2381 // After calling trans->RestartWithAuth(), this is the request we should |
| 2381 // be issuing -- the final header line contains the credentials. | 2382 // be issuing -- the final header line contains the credentials. |
| 2382 MockWrite( | 2383 MockWrite( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2448 } | 2449 } |
| 2449 | 2450 |
| 2450 // Test the request-challenge-retry sequence for basic auth, over a keep-alive | 2451 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
| 2451 // connection, but the server gets impatient and closes the connection. | 2452 // connection, but the server gets impatient and closes the connection. |
| 2452 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveImpatientServer) { | 2453 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveImpatientServer) { |
| 2453 HttpRequestInfo request; | 2454 HttpRequestInfo request; |
| 2454 request.method = "GET"; | 2455 request.method = "GET"; |
| 2455 request.url = GURL("http://www.example.org/"); | 2456 request.url = GURL("http://www.example.org/"); |
| 2456 request.load_flags = 0; | 2457 request.load_flags = 0; |
| 2457 | 2458 |
| 2458 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2459 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2459 | 2460 |
| 2460 MockWrite data_writes1[] = { | 2461 MockWrite data_writes1[] = { |
| 2461 MockWrite( | 2462 MockWrite( |
| 2462 "GET / HTTP/1.1\r\n" | 2463 "GET / HTTP/1.1\r\n" |
| 2463 "Host: www.example.org\r\n" | 2464 "Host: www.example.org\r\n" |
| 2464 "Connection: keep-alive\r\n\r\n"), | 2465 "Connection: keep-alive\r\n\r\n"), |
| 2465 // This simulates the seemingly successful write to a closed connection | 2466 // This simulates the seemingly successful write to a closed connection |
| 2466 // if the bug is not fixed. | 2467 // if the bug is not fixed. |
| 2467 MockWrite( | 2468 MockWrite( |
| 2468 "GET / HTTP/1.1\r\n" | 2469 "GET / HTTP/1.1\r\n" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2543 request.method = "GET"; | 2544 request.method = "GET"; |
| 2544 request.url = GURL("https://www.example.org/"); | 2545 request.url = GURL("https://www.example.org/"); |
| 2545 // when the no authentication data flag is set. | 2546 // when the no authentication data flag is set. |
| 2546 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2547 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2547 | 2548 |
| 2548 // Configure against proxy server "myproxy:70". | 2549 // Configure against proxy server "myproxy:70". |
| 2549 session_deps_.proxy_service = | 2550 session_deps_.proxy_service = |
| 2550 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); | 2551 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 2551 BoundTestNetLog log; | 2552 BoundTestNetLog log; |
| 2552 session_deps_.net_log = log.bound().net_log(); | 2553 session_deps_.net_log = log.bound().net_log(); |
| 2553 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2554 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2554 | 2555 |
| 2555 // Since we have proxy, should try to establish tunnel. | 2556 // Since we have proxy, should try to establish tunnel. |
| 2556 MockWrite data_writes1[] = { | 2557 MockWrite data_writes1[] = { |
| 2557 MockWrite( | 2558 MockWrite( |
| 2558 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2559 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2559 "Host: www.example.org\r\n" | 2560 "Host: www.example.org\r\n" |
| 2560 "Proxy-Connection: keep-alive\r\n\r\n"), | 2561 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 2561 | 2562 |
| 2562 // After calling trans->RestartWithAuth(), this is the request we should | 2563 // After calling trans->RestartWithAuth(), this is the request we should |
| 2563 // be issuing -- the final header line contains the credentials. | 2564 // be issuing -- the final header line contains the credentials. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2661 request.method = "GET"; | 2662 request.method = "GET"; |
| 2662 request.url = GURL("https://www.example.org/"); | 2663 request.url = GURL("https://www.example.org/"); |
| 2663 // when the no authentication data flag is set. | 2664 // when the no authentication data flag is set. |
| 2664 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2665 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2665 | 2666 |
| 2666 // Configure against proxy server "myproxy:70". | 2667 // Configure against proxy server "myproxy:70". |
| 2667 session_deps_.proxy_service = | 2668 session_deps_.proxy_service = |
| 2668 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); | 2669 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 2669 BoundTestNetLog log; | 2670 BoundTestNetLog log; |
| 2670 session_deps_.net_log = log.bound().net_log(); | 2671 session_deps_.net_log = log.bound().net_log(); |
| 2671 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2672 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2672 | 2673 |
| 2673 // Since we have proxy, should try to establish tunnel. | 2674 // Since we have proxy, should try to establish tunnel. |
| 2674 MockWrite data_writes1[] = { | 2675 MockWrite data_writes1[] = { |
| 2675 MockWrite( | 2676 MockWrite( |
| 2676 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2677 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2677 "Host: www.example.org\r\n" | 2678 "Host: www.example.org\r\n" |
| 2678 "Proxy-Connection: keep-alive\r\n\r\n"), | 2679 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 2679 | 2680 |
| 2680 // After calling trans->RestartWithAuth(), this is the request we should | 2681 // After calling trans->RestartWithAuth(), this is the request we should |
| 2681 // be issuing -- the final header line contains the credentials. | 2682 // be issuing -- the final header line contains the credentials. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2781 request.method = "GET"; | 2782 request.method = "GET"; |
| 2782 request.url = GURL("https://www.example.org/"); | 2783 request.url = GURL("https://www.example.org/"); |
| 2783 // Ensure that proxy authentication is attempted even | 2784 // Ensure that proxy authentication is attempted even |
| 2784 // when the no authentication data flag is set. | 2785 // when the no authentication data flag is set. |
| 2785 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2786 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2786 | 2787 |
| 2787 // Configure against proxy server "myproxy:70". | 2788 // Configure against proxy server "myproxy:70". |
| 2788 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); | 2789 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 2789 BoundTestNetLog log; | 2790 BoundTestNetLog log; |
| 2790 session_deps_.net_log = log.bound().net_log(); | 2791 session_deps_.net_log = log.bound().net_log(); |
| 2791 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2792 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2792 | 2793 |
| 2793 scoped_ptr<HttpTransaction> trans( | 2794 scoped_ptr<HttpTransaction> trans( |
| 2794 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2795 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2795 | 2796 |
| 2796 // Since we have proxy, should try to establish tunnel. | 2797 // Since we have proxy, should try to establish tunnel. |
| 2797 MockWrite data_writes1[] = { | 2798 MockWrite data_writes1[] = { |
| 2798 MockWrite( | 2799 MockWrite( |
| 2799 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2800 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2800 "Host: www.example.org\r\n" | 2801 "Host: www.example.org\r\n" |
| 2801 "Proxy-Connection: keep-alive\r\n\r\n"), | 2802 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2888 request.method = "GET"; | 2889 request.method = "GET"; |
| 2889 request.url = GURL("https://www.example.org/"); | 2890 request.url = GURL("https://www.example.org/"); |
| 2890 // Ensure that proxy authentication is attempted even | 2891 // Ensure that proxy authentication is attempted even |
| 2891 // when the no authentication data flag is set. | 2892 // when the no authentication data flag is set. |
| 2892 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2893 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2893 | 2894 |
| 2894 // Configure against proxy server "myproxy:70". | 2895 // Configure against proxy server "myproxy:70". |
| 2895 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); | 2896 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 2896 BoundTestNetLog log; | 2897 BoundTestNetLog log; |
| 2897 session_deps_.net_log = log.bound().net_log(); | 2898 session_deps_.net_log = log.bound().net_log(); |
| 2898 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2899 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2899 | 2900 |
| 2900 scoped_ptr<HttpTransaction> trans( | 2901 scoped_ptr<HttpTransaction> trans( |
| 2901 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2902 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2902 | 2903 |
| 2903 // Since we have proxy, should try to establish tunnel. | 2904 // Since we have proxy, should try to establish tunnel. |
| 2904 MockWrite data_writes1[] = { | 2905 MockWrite data_writes1[] = { |
| 2905 MockWrite( | 2906 MockWrite( |
| 2906 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2907 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2907 "Host: www.example.org\r\n" | 2908 "Host: www.example.org\r\n" |
| 2908 "Proxy-Connection: keep-alive\r\n\r\n"), | 2909 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2991 // even if the user cancels the proxy's auth attempt. | 2992 // even if the user cancels the proxy's auth attempt. |
| 2992 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) { | 2993 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) { |
| 2993 HttpRequestInfo request; | 2994 HttpRequestInfo request; |
| 2994 request.method = "GET"; | 2995 request.method = "GET"; |
| 2995 request.url = GURL("https://www.example.org/"); | 2996 request.url = GURL("https://www.example.org/"); |
| 2996 request.load_flags = 0; | 2997 request.load_flags = 0; |
| 2997 | 2998 |
| 2998 // Configure against proxy server "myproxy:70". | 2999 // Configure against proxy server "myproxy:70". |
| 2999 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); | 3000 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 3000 | 3001 |
| 3001 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3002 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3002 | 3003 |
| 3003 scoped_ptr<HttpTransaction> trans( | 3004 scoped_ptr<HttpTransaction> trans( |
| 3004 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3005 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3005 | 3006 |
| 3006 // Since we have proxy, should try to establish tunnel. | 3007 // Since we have proxy, should try to establish tunnel. |
| 3007 MockWrite data_writes[] = { | 3008 MockWrite data_writes[] = { |
| 3008 MockWrite( | 3009 MockWrite( |
| 3009 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3010 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3010 "Host: www.example.org\r\n" | 3011 "Host: www.example.org\r\n" |
| 3011 "Proxy-Connection: keep-alive\r\n\r\n"), | 3012 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3051 // caller when the proxy responds to CONNECT with 407. | 3052 // caller when the proxy responds to CONNECT with 407. |
| 3052 TEST_P(HttpNetworkTransactionTest, SanitizeProxyAuthHeaders) { | 3053 TEST_P(HttpNetworkTransactionTest, SanitizeProxyAuthHeaders) { |
| 3053 HttpRequestInfo request; | 3054 HttpRequestInfo request; |
| 3054 request.method = "GET"; | 3055 request.method = "GET"; |
| 3055 request.url = GURL("https://www.example.org/"); | 3056 request.url = GURL("https://www.example.org/"); |
| 3056 request.load_flags = 0; | 3057 request.load_flags = 0; |
| 3057 | 3058 |
| 3058 // Configure against proxy server "myproxy:70". | 3059 // Configure against proxy server "myproxy:70". |
| 3059 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); | 3060 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 3060 | 3061 |
| 3061 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3062 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3062 | 3063 |
| 3063 scoped_ptr<HttpTransaction> trans( | 3064 scoped_ptr<HttpTransaction> trans( |
| 3064 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3065 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3065 | 3066 |
| 3066 // Since we have proxy, should try to establish tunnel. | 3067 // Since we have proxy, should try to establish tunnel. |
| 3067 MockWrite data_writes[] = { | 3068 MockWrite data_writes[] = { |
| 3068 MockWrite( | 3069 MockWrite( |
| 3069 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3070 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3070 "Host: www.example.org\r\n" | 3071 "Host: www.example.org\r\n" |
| 3071 "Proxy-Connection: keep-alive\r\n\r\n"), | 3072 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3112 | 3113 |
| 3113 // Test when a server (non-proxy) returns a 407 (proxy-authenticate). | 3114 // Test when a server (non-proxy) returns a 407 (proxy-authenticate). |
| 3114 // The request should fail with ERR_UNEXPECTED_PROXY_AUTH. | 3115 // The request should fail with ERR_UNEXPECTED_PROXY_AUTH. |
| 3115 TEST_P(HttpNetworkTransactionTest, UnexpectedProxyAuth) { | 3116 TEST_P(HttpNetworkTransactionTest, UnexpectedProxyAuth) { |
| 3116 HttpRequestInfo request; | 3117 HttpRequestInfo request; |
| 3117 request.method = "GET"; | 3118 request.method = "GET"; |
| 3118 request.url = GURL("http://www.example.org/"); | 3119 request.url = GURL("http://www.example.org/"); |
| 3119 request.load_flags = 0; | 3120 request.load_flags = 0; |
| 3120 | 3121 |
| 3121 // We are using a DIRECT connection (i.e. no proxy) for this session. | 3122 // We are using a DIRECT connection (i.e. no proxy) for this session. |
| 3122 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3123 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3123 scoped_ptr<HttpTransaction> trans( | 3124 scoped_ptr<HttpTransaction> trans( |
| 3124 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3125 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3125 | 3126 |
| 3126 MockWrite data_writes1[] = { | 3127 MockWrite data_writes1[] = { |
| 3127 MockWrite( | 3128 MockWrite( |
| 3128 "GET / HTTP/1.1\r\n" | 3129 "GET / HTTP/1.1\r\n" |
| 3129 "Host: www.example.org\r\n" | 3130 "Host: www.example.org\r\n" |
| 3130 "Connection: keep-alive\r\n\r\n"), | 3131 "Connection: keep-alive\r\n\r\n"), |
| 3131 }; | 3132 }; |
| 3132 | 3133 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 3160 // issued the challenge. | 3161 // issued the challenge. |
| 3161 TEST_P(HttpNetworkTransactionTest, | 3162 TEST_P(HttpNetworkTransactionTest, |
| 3162 HttpsServerRequestsProxyAuthThroughProxy) { | 3163 HttpsServerRequestsProxyAuthThroughProxy) { |
| 3163 HttpRequestInfo request; | 3164 HttpRequestInfo request; |
| 3164 request.method = "GET"; | 3165 request.method = "GET"; |
| 3165 request.url = GURL("https://www.example.org/"); | 3166 request.url = GURL("https://www.example.org/"); |
| 3166 | 3167 |
| 3167 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); | 3168 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 3168 BoundTestNetLog log; | 3169 BoundTestNetLog log; |
| 3169 session_deps_.net_log = log.bound().net_log(); | 3170 session_deps_.net_log = log.bound().net_log(); |
| 3170 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3171 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3171 | 3172 |
| 3172 // Since we have proxy, should try to establish tunnel. | 3173 // Since we have proxy, should try to establish tunnel. |
| 3173 MockWrite data_writes1[] = { | 3174 MockWrite data_writes1[] = { |
| 3174 MockWrite( | 3175 MockWrite( |
| 3175 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3176 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3176 "Host: www.example.org\r\n" | 3177 "Host: www.example.org\r\n" |
| 3177 "Proxy-Connection: keep-alive\r\n\r\n"), | 3178 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 3178 | 3179 |
| 3179 MockWrite( | 3180 MockWrite( |
| 3180 "GET / HTTP/1.1\r\n" | 3181 "GET / HTTP/1.1\r\n" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3225 request1.url = GURL("https://www.example.org/1"); | 3226 request1.url = GURL("https://www.example.org/1"); |
| 3226 | 3227 |
| 3227 HttpRequestInfo request2; | 3228 HttpRequestInfo request2; |
| 3228 request2.method = "GET"; | 3229 request2.method = "GET"; |
| 3229 request2.url = GURL("https://www.example.org/2"); | 3230 request2.url = GURL("https://www.example.org/2"); |
| 3230 | 3231 |
| 3231 // Configure against proxy server "myproxy:70". | 3232 // Configure against proxy server "myproxy:70". |
| 3232 session_deps_.proxy_service = ProxyService::CreateFixed("PROXY myproxy:70"); | 3233 session_deps_.proxy_service = ProxyService::CreateFixed("PROXY myproxy:70"); |
| 3233 BoundTestNetLog log; | 3234 BoundTestNetLog log; |
| 3234 session_deps_.net_log = log.bound().net_log(); | 3235 session_deps_.net_log = log.bound().net_log(); |
| 3235 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3236 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3236 | 3237 |
| 3237 // Since we have proxy, should try to establish tunnel. | 3238 // Since we have proxy, should try to establish tunnel. |
| 3238 MockWrite data_writes1[] = { | 3239 MockWrite data_writes1[] = { |
| 3239 MockWrite( | 3240 MockWrite( |
| 3240 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3241 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3241 "Host: www.example.org\r\n" | 3242 "Host: www.example.org\r\n" |
| 3242 "Proxy-Connection: keep-alive\r\n\r\n"), | 3243 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 3243 | 3244 |
| 3244 MockWrite( | 3245 MockWrite( |
| 3245 "GET /1 HTTP/1.1\r\n" | 3246 "GET /1 HTTP/1.1\r\n" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3326 | 3327 |
| 3327 HttpRequestInfo request2; | 3328 HttpRequestInfo request2; |
| 3328 request2.method = "GET"; | 3329 request2.method = "GET"; |
| 3329 request2.url = GURL("https://www.example.org/2"); | 3330 request2.url = GURL("https://www.example.org/2"); |
| 3330 | 3331 |
| 3331 // Configure against proxy server "myproxy:70". | 3332 // Configure against proxy server "myproxy:70". |
| 3332 session_deps_.proxy_service = | 3333 session_deps_.proxy_service = |
| 3333 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); | 3334 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 3334 BoundTestNetLog log; | 3335 BoundTestNetLog log; |
| 3335 session_deps_.net_log = log.bound().net_log(); | 3336 session_deps_.net_log = log.bound().net_log(); |
| 3336 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3337 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3337 | 3338 |
| 3338 // Since we have proxy, should try to establish tunnel. | 3339 // Since we have proxy, should try to establish tunnel. |
| 3339 MockWrite data_writes1[] = { | 3340 MockWrite data_writes1[] = { |
| 3340 MockWrite( | 3341 MockWrite( |
| 3341 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3342 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3342 "Host: www.example.org\r\n" | 3343 "Host: www.example.org\r\n" |
| 3343 "Proxy-Connection: keep-alive\r\n\r\n"), | 3344 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 3344 | 3345 |
| 3345 MockWrite( | 3346 MockWrite( |
| 3346 "GET /1 HTTP/1.1\r\n" | 3347 "GET /1 HTTP/1.1\r\n" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3423 // Test a simple get through an HTTPS Proxy. | 3424 // Test a simple get through an HTTPS Proxy. |
| 3424 TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) { | 3425 TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) { |
| 3425 HttpRequestInfo request; | 3426 HttpRequestInfo request; |
| 3426 request.method = "GET"; | 3427 request.method = "GET"; |
| 3427 request.url = GURL("http://www.example.org/"); | 3428 request.url = GURL("http://www.example.org/"); |
| 3428 | 3429 |
| 3429 // Configure against https proxy server "proxy:70". | 3430 // Configure against https proxy server "proxy:70". |
| 3430 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); | 3431 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3431 BoundTestNetLog log; | 3432 BoundTestNetLog log; |
| 3432 session_deps_.net_log = log.bound().net_log(); | 3433 session_deps_.net_log = log.bound().net_log(); |
| 3433 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3434 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3434 | 3435 |
| 3435 // Since we have proxy, should use full url | 3436 // Since we have proxy, should use full url |
| 3436 MockWrite data_writes1[] = { | 3437 MockWrite data_writes1[] = { |
| 3437 MockWrite( | 3438 MockWrite( |
| 3438 "GET http://www.example.org/ HTTP/1.1\r\n" | 3439 "GET http://www.example.org/ HTTP/1.1\r\n" |
| 3439 "Host: www.example.org\r\n" | 3440 "Host: www.example.org\r\n" |
| 3440 "Proxy-Connection: keep-alive\r\n\r\n"), | 3441 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 3441 }; | 3442 }; |
| 3442 | 3443 |
| 3443 MockRead data_reads1[] = { | 3444 MockRead data_reads1[] = { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3485 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) { | 3486 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGet) { |
| 3486 HttpRequestInfo request; | 3487 HttpRequestInfo request; |
| 3487 request.method = "GET"; | 3488 request.method = "GET"; |
| 3488 request.url = GURL("http://www.example.org/"); | 3489 request.url = GURL("http://www.example.org/"); |
| 3489 request.load_flags = 0; | 3490 request.load_flags = 0; |
| 3490 | 3491 |
| 3491 // Configure against https proxy server "proxy:70". | 3492 // Configure against https proxy server "proxy:70". |
| 3492 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); | 3493 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3493 BoundTestNetLog log; | 3494 BoundTestNetLog log; |
| 3494 session_deps_.net_log = log.bound().net_log(); | 3495 session_deps_.net_log = log.bound().net_log(); |
| 3495 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3496 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3496 | 3497 |
| 3497 // fetch http://www.example.org/ via SPDY | 3498 // fetch http://www.example.org/ via SPDY |
| 3498 scoped_ptr<SpdyFrame> req( | 3499 scoped_ptr<SpdyFrame> req( |
| 3499 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3500 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 3500 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; | 3501 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; |
| 3501 | 3502 |
| 3502 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 3503 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 3503 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); | 3504 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 3504 MockRead spdy_reads[] = { | 3505 MockRead spdy_reads[] = { |
| 3505 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), | 3506 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3545 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithSessionRace) { | 3546 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithSessionRace) { |
| 3546 HttpRequestInfo request; | 3547 HttpRequestInfo request; |
| 3547 request.method = "GET"; | 3548 request.method = "GET"; |
| 3548 request.url = GURL("http://www.example.org/"); | 3549 request.url = GURL("http://www.example.org/"); |
| 3549 request.load_flags = 0; | 3550 request.load_flags = 0; |
| 3550 | 3551 |
| 3551 // Configure SPDY proxy server "proxy:70". | 3552 // Configure SPDY proxy server "proxy:70". |
| 3552 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); | 3553 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3553 BoundTestNetLog log; | 3554 BoundTestNetLog log; |
| 3554 session_deps_.net_log = log.bound().net_log(); | 3555 session_deps_.net_log = log.bound().net_log(); |
| 3555 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3556 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3556 | 3557 |
| 3557 // Fetch http://www.example.org/ through the SPDY proxy. | 3558 // Fetch http://www.example.org/ through the SPDY proxy. |
| 3558 scoped_ptr<SpdyFrame> req( | 3559 scoped_ptr<SpdyFrame> req( |
| 3559 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3560 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 3560 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; | 3561 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; |
| 3561 | 3562 |
| 3562 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 3563 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 3563 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); | 3564 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 3564 MockRead spdy_reads[] = { | 3565 MockRead spdy_reads[] = { |
| 3565 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), | 3566 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3583 session_deps_.host_resolver->set_ondemand_mode(true); | 3584 session_deps_.host_resolver->set_ondemand_mode(true); |
| 3584 | 3585 |
| 3585 int rv = trans->Start(&request, callback1.callback(), log.bound()); | 3586 int rv = trans->Start(&request, callback1.callback(), log.bound()); |
| 3586 EXPECT_EQ(ERR_IO_PENDING, rv); | 3587 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 3587 | 3588 |
| 3588 // Race a session to the proxy, which completes first. | 3589 // Race a session to the proxy, which completes first. |
| 3589 session_deps_.host_resolver->set_ondemand_mode(false); | 3590 session_deps_.host_resolver->set_ondemand_mode(false); |
| 3590 SpdySessionKey key( | 3591 SpdySessionKey key( |
| 3591 HostPortPair("proxy", 70), ProxyServer::Direct(), PRIVACY_MODE_DISABLED); | 3592 HostPortPair("proxy", 70), ProxyServer::Direct(), PRIVACY_MODE_DISABLED); |
| 3592 base::WeakPtr<SpdySession> spdy_session = | 3593 base::WeakPtr<SpdySession> spdy_session = |
| 3593 CreateSecureSpdySession(session, key, log.bound()); | 3594 CreateSecureSpdySession(session.get(), key, log.bound()); |
| 3594 | 3595 |
| 3595 // Unstall the resolution begun by the transaction. | 3596 // Unstall the resolution begun by the transaction. |
| 3596 session_deps_.host_resolver->set_ondemand_mode(true); | 3597 session_deps_.host_resolver->set_ondemand_mode(true); |
| 3597 session_deps_.host_resolver->ResolveAllPending(); | 3598 session_deps_.host_resolver->ResolveAllPending(); |
| 3598 | 3599 |
| 3599 EXPECT_FALSE(callback1.have_result()); | 3600 EXPECT_FALSE(callback1.have_result()); |
| 3600 rv = callback1.WaitForResult(); | 3601 rv = callback1.WaitForResult(); |
| 3601 EXPECT_EQ(OK, rv); | 3602 EXPECT_EQ(OK, rv); |
| 3602 | 3603 |
| 3603 const HttpResponseInfo* response = trans->GetResponseInfo(); | 3604 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3614 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) { | 3615 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyGetWithProxyAuth) { |
| 3615 HttpRequestInfo request; | 3616 HttpRequestInfo request; |
| 3616 request.method = "GET"; | 3617 request.method = "GET"; |
| 3617 request.url = GURL("http://www.example.org/"); | 3618 request.url = GURL("http://www.example.org/"); |
| 3618 request.load_flags = 0; | 3619 request.load_flags = 0; |
| 3619 | 3620 |
| 3620 // Configure against https proxy server "myproxy:70". | 3621 // Configure against https proxy server "myproxy:70". |
| 3621 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); | 3622 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); |
| 3622 BoundTestNetLog log; | 3623 BoundTestNetLog log; |
| 3623 session_deps_.net_log = log.bound().net_log(); | 3624 session_deps_.net_log = log.bound().net_log(); |
| 3624 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3625 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3625 | 3626 |
| 3626 // The first request will be a bare GET, the second request will be a | 3627 // The first request will be a bare GET, the second request will be a |
| 3627 // GET with a Proxy-Authorization header. | 3628 // GET with a Proxy-Authorization header. |
| 3628 scoped_ptr<SpdyFrame> req_get( | 3629 scoped_ptr<SpdyFrame> req_get( |
| 3629 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3630 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 3630 const char* const kExtraAuthorizationHeaders[] = { | 3631 const char* const kExtraAuthorizationHeaders[] = { |
| 3631 "proxy-authorization", "Basic Zm9vOmJhcg==" | 3632 "proxy-authorization", "Basic Zm9vOmJhcg==" |
| 3632 }; | 3633 }; |
| 3633 scoped_ptr<SpdyFrame> req_get_authorization( | 3634 scoped_ptr<SpdyFrame> req_get_authorization( |
| 3634 spdy_util_.ConstructSpdyGet(kExtraAuthorizationHeaders, | 3635 spdy_util_.ConstructSpdyGet(kExtraAuthorizationHeaders, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3714 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) { | 3715 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectHttps) { |
| 3715 HttpRequestInfo request; | 3716 HttpRequestInfo request; |
| 3716 request.method = "GET"; | 3717 request.method = "GET"; |
| 3717 request.url = GURL("https://www.example.org/"); | 3718 request.url = GURL("https://www.example.org/"); |
| 3718 request.load_flags = 0; | 3719 request.load_flags = 0; |
| 3719 | 3720 |
| 3720 // Configure against https proxy server "proxy:70". | 3721 // Configure against https proxy server "proxy:70". |
| 3721 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); | 3722 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3722 BoundTestNetLog log; | 3723 BoundTestNetLog log; |
| 3723 session_deps_.net_log = log.bound().net_log(); | 3724 session_deps_.net_log = log.bound().net_log(); |
| 3724 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3725 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3725 | 3726 |
| 3726 scoped_ptr<HttpTransaction> trans( | 3727 scoped_ptr<HttpTransaction> trans( |
| 3727 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3728 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3728 | 3729 |
| 3729 // CONNECT to www.example.org:443 via SPDY | 3730 // CONNECT to www.example.org:443 via SPDY |
| 3730 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3731 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
| 3731 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3732 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| 3732 // fetch https://www.example.org/ via HTTP | 3733 // fetch https://www.example.org/ via HTTP |
| 3733 | 3734 |
| 3734 const char get[] = | 3735 const char get[] = |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3798 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) { | 3799 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectSpdy) { |
| 3799 HttpRequestInfo request; | 3800 HttpRequestInfo request; |
| 3800 request.method = "GET"; | 3801 request.method = "GET"; |
| 3801 request.url = GURL("https://www.example.org/"); | 3802 request.url = GURL("https://www.example.org/"); |
| 3802 request.load_flags = 0; | 3803 request.load_flags = 0; |
| 3803 | 3804 |
| 3804 // Configure against https proxy server "proxy:70". | 3805 // Configure against https proxy server "proxy:70". |
| 3805 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); | 3806 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3806 BoundTestNetLog log; | 3807 BoundTestNetLog log; |
| 3807 session_deps_.net_log = log.bound().net_log(); | 3808 session_deps_.net_log = log.bound().net_log(); |
| 3808 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3809 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3809 | 3810 |
| 3810 scoped_ptr<HttpTransaction> trans( | 3811 scoped_ptr<HttpTransaction> trans( |
| 3811 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3812 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3812 | 3813 |
| 3813 // CONNECT to www.example.org:443 via SPDY | 3814 // CONNECT to www.example.org:443 via SPDY |
| 3814 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3815 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
| 3815 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3816 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| 3816 // fetch https://www.example.org/ via SPDY | 3817 // fetch https://www.example.org/ via SPDY |
| 3817 const char kMyUrl[] = "https://www.example.org/"; | 3818 const char kMyUrl[] = "https://www.example.org/"; |
| 3818 scoped_ptr<SpdyFrame> get( | 3819 scoped_ptr<SpdyFrame> get( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3889 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) { | 3890 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyConnectFailure) { |
| 3890 HttpRequestInfo request; | 3891 HttpRequestInfo request; |
| 3891 request.method = "GET"; | 3892 request.method = "GET"; |
| 3892 request.url = GURL("https://www.example.org/"); | 3893 request.url = GURL("https://www.example.org/"); |
| 3893 request.load_flags = 0; | 3894 request.load_flags = 0; |
| 3894 | 3895 |
| 3895 // Configure against https proxy server "proxy:70". | 3896 // Configure against https proxy server "proxy:70". |
| 3896 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); | 3897 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3897 BoundTestNetLog log; | 3898 BoundTestNetLog log; |
| 3898 session_deps_.net_log = log.bound().net_log(); | 3899 session_deps_.net_log = log.bound().net_log(); |
| 3899 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3900 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3900 | 3901 |
| 3901 scoped_ptr<HttpTransaction> trans( | 3902 scoped_ptr<HttpTransaction> trans( |
| 3902 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3903 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3903 | 3904 |
| 3904 // CONNECT to www.example.org:443 via SPDY | 3905 // CONNECT to www.example.org:443 via SPDY |
| 3905 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3906 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
| 3906 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3907 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| 3907 scoped_ptr<SpdyFrame> get( | 3908 scoped_ptr<SpdyFrame> get( |
| 3908 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); | 3909 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); |
| 3909 | 3910 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3940 } | 3941 } |
| 3941 | 3942 |
| 3942 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY | 3943 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY |
| 3943 // HTTPS Proxy to different servers. | 3944 // HTTPS Proxy to different servers. |
| 3944 TEST_P(HttpNetworkTransactionTest, | 3945 TEST_P(HttpNetworkTransactionTest, |
| 3945 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) { | 3946 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) { |
| 3946 // Configure against https proxy server "proxy:70". | 3947 // Configure against https proxy server "proxy:70". |
| 3947 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); | 3948 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 3948 BoundTestNetLog log; | 3949 BoundTestNetLog log; |
| 3949 session_deps_.net_log = log.bound().net_log(); | 3950 session_deps_.net_log = log.bound().net_log(); |
| 3950 scoped_refptr<HttpNetworkSession> session( | 3951 scoped_ptr<HttpNetworkSession> session( |
| 3951 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 3952 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
| 3952 | 3953 |
| 3953 HttpRequestInfo request1; | 3954 HttpRequestInfo request1; |
| 3954 request1.method = "GET"; | 3955 request1.method = "GET"; |
| 3955 request1.url = GURL("https://www.example.org/"); | 3956 request1.url = GURL("https://www.example.org/"); |
| 3956 request1.load_flags = 0; | 3957 request1.load_flags = 0; |
| 3957 | 3958 |
| 3958 HttpRequestInfo request2; | 3959 HttpRequestInfo request2; |
| 3959 request2.method = "GET"; | 3960 request2.method = "GET"; |
| 3960 request2.url = GURL("https://mail.example.org/"); | 3961 request2.url = GURL("https://mail.example.org/"); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4082 } | 4083 } |
| 4083 | 4084 |
| 4084 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY | 4085 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY |
| 4085 // HTTPS Proxy to the same server. | 4086 // HTTPS Proxy to the same server. |
| 4086 TEST_P(HttpNetworkTransactionTest, | 4087 TEST_P(HttpNetworkTransactionTest, |
| 4087 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) { | 4088 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) { |
| 4088 // Configure against https proxy server "proxy:70". | 4089 // Configure against https proxy server "proxy:70". |
| 4089 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); | 4090 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 4090 BoundTestNetLog log; | 4091 BoundTestNetLog log; |
| 4091 session_deps_.net_log = log.bound().net_log(); | 4092 session_deps_.net_log = log.bound().net_log(); |
| 4092 scoped_refptr<HttpNetworkSession> session( | 4093 scoped_ptr<HttpNetworkSession> session( |
| 4093 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 4094 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
| 4094 | 4095 |
| 4095 HttpRequestInfo request1; | 4096 HttpRequestInfo request1; |
| 4096 request1.method = "GET"; | 4097 request1.method = "GET"; |
| 4097 request1.url = GURL("https://www.example.org/"); | 4098 request1.url = GURL("https://www.example.org/"); |
| 4098 request1.load_flags = 0; | 4099 request1.load_flags = 0; |
| 4099 | 4100 |
| 4100 HttpRequestInfo request2; | 4101 HttpRequestInfo request2; |
| 4101 request2.method = "GET"; | 4102 request2.method = "GET"; |
| 4102 request2.url = GURL("https://www.example.org/2"); | 4103 request2.url = GURL("https://www.example.org/2"); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4205 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); | 4206 EXPECT_EQ(2, trans2->Read(buf.get(), 256, callback.callback())); |
| 4206 } | 4207 } |
| 4207 | 4208 |
| 4208 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS | 4209 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS |
| 4209 // Proxy to different servers. | 4210 // Proxy to different servers. |
| 4210 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyLoadTimingTwoHttpRequests) { | 4211 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyLoadTimingTwoHttpRequests) { |
| 4211 // Configure against https proxy server "proxy:70". | 4212 // Configure against https proxy server "proxy:70". |
| 4212 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); | 4213 session_deps_.proxy_service = ProxyService::CreateFixed("https://proxy:70"); |
| 4213 BoundTestNetLog log; | 4214 BoundTestNetLog log; |
| 4214 session_deps_.net_log = log.bound().net_log(); | 4215 session_deps_.net_log = log.bound().net_log(); |
| 4215 scoped_refptr<HttpNetworkSession> session( | 4216 scoped_ptr<HttpNetworkSession> session( |
| 4216 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 4217 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
| 4217 | 4218 |
| 4218 HttpRequestInfo request1; | 4219 HttpRequestInfo request1; |
| 4219 request1.method = "GET"; | 4220 request1.method = "GET"; |
| 4220 request1.url = GURL("http://www.example.org/"); | 4221 request1.url = GURL("http://www.example.org/"); |
| 4221 request1.load_flags = 0; | 4222 request1.load_flags = 0; |
| 4222 | 4223 |
| 4223 HttpRequestInfo request2; | 4224 HttpRequestInfo request2; |
| 4224 request2.method = "GET"; | 4225 request2.method = "GET"; |
| 4225 request2.url = GURL("http://mail.example.org/"); | 4226 request2.url = GURL("http://mail.example.org/"); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4311 HttpRequestInfo request; | 4312 HttpRequestInfo request; |
| 4312 request.method = "GET"; | 4313 request.method = "GET"; |
| 4313 request.url = GURL("http://www.example.org/"); | 4314 request.url = GURL("http://www.example.org/"); |
| 4314 // when the no authentication data flag is set. | 4315 // when the no authentication data flag is set. |
| 4315 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 4316 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 4316 | 4317 |
| 4317 // Configure against https proxy server "myproxy:70". | 4318 // Configure against https proxy server "myproxy:70". |
| 4318 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); | 4319 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); |
| 4319 BoundTestNetLog log; | 4320 BoundTestNetLog log; |
| 4320 session_deps_.net_log = log.bound().net_log(); | 4321 session_deps_.net_log = log.bound().net_log(); |
| 4321 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4322 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4322 | 4323 |
| 4323 // Since we have proxy, should use full url | 4324 // Since we have proxy, should use full url |
| 4324 MockWrite data_writes1[] = { | 4325 MockWrite data_writes1[] = { |
| 4325 MockWrite( | 4326 MockWrite( |
| 4326 "GET http://www.example.org/ HTTP/1.1\r\n" | 4327 "GET http://www.example.org/ HTTP/1.1\r\n" |
| 4327 "Host: www.example.org\r\n" | 4328 "Host: www.example.org\r\n" |
| 4328 "Proxy-Connection: keep-alive\r\n\r\n"), | 4329 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 4329 | 4330 |
| 4330 // After calling trans->RestartWithAuth(), this is the request we should | 4331 // After calling trans->RestartWithAuth(), this is the request we should |
| 4331 // be issuing -- the final header line contains the credentials. | 4332 // be issuing -- the final header line contains the credentials. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4408 | 4409 |
| 4409 void HttpNetworkTransactionTest::ConnectStatusHelperWithExpectedStatus( | 4410 void HttpNetworkTransactionTest::ConnectStatusHelperWithExpectedStatus( |
| 4410 const MockRead& status, int expected_status) { | 4411 const MockRead& status, int expected_status) { |
| 4411 HttpRequestInfo request; | 4412 HttpRequestInfo request; |
| 4412 request.method = "GET"; | 4413 request.method = "GET"; |
| 4413 request.url = GURL("https://www.example.org/"); | 4414 request.url = GURL("https://www.example.org/"); |
| 4414 request.load_flags = 0; | 4415 request.load_flags = 0; |
| 4415 | 4416 |
| 4416 // Configure against proxy server "myproxy:70". | 4417 // Configure against proxy server "myproxy:70". |
| 4417 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); | 4418 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 4418 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4419 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4419 | 4420 |
| 4420 // Since we have proxy, should try to establish tunnel. | 4421 // Since we have proxy, should try to establish tunnel. |
| 4421 MockWrite data_writes[] = { | 4422 MockWrite data_writes[] = { |
| 4422 MockWrite( | 4423 MockWrite( |
| 4423 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 4424 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 4424 "Host: www.example.org\r\n" | 4425 "Host: www.example.org\r\n" |
| 4425 "Proxy-Connection: keep-alive\r\n\r\n"), | 4426 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 4426 }; | 4427 }; |
| 4427 | 4428 |
| 4428 MockRead data_reads[] = { | 4429 MockRead data_reads[] = { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4626 // authentication. Again, this uses basic auth for both since that is | 4627 // authentication. Again, this uses basic auth for both since that is |
| 4627 // the simplest to mock. | 4628 // the simplest to mock. |
| 4628 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyThenServer) { | 4629 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyThenServer) { |
| 4629 HttpRequestInfo request; | 4630 HttpRequestInfo request; |
| 4630 request.method = "GET"; | 4631 request.method = "GET"; |
| 4631 request.url = GURL("http://www.example.org/"); | 4632 request.url = GURL("http://www.example.org/"); |
| 4632 request.load_flags = 0; | 4633 request.load_flags = 0; |
| 4633 | 4634 |
| 4634 // Configure against proxy server "myproxy:70". | 4635 // Configure against proxy server "myproxy:70". |
| 4635 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); | 4636 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 4636 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4637 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4637 | 4638 |
| 4638 scoped_ptr<HttpTransaction> trans( | 4639 scoped_ptr<HttpTransaction> trans( |
| 4639 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 4640 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 4640 | 4641 |
| 4641 MockWrite data_writes1[] = { | 4642 MockWrite data_writes1[] = { |
| 4642 MockWrite( | 4643 MockWrite( |
| 4643 "GET http://www.example.org/ HTTP/1.1\r\n" | 4644 "GET http://www.example.org/ HTTP/1.1\r\n" |
| 4644 "Host: www.example.org\r\n" | 4645 "Host: www.example.org\r\n" |
| 4645 "Proxy-Connection: keep-alive\r\n\r\n"), | 4646 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 4646 }; | 4647 }; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4762 HttpRequestInfo request; | 4763 HttpRequestInfo request; |
| 4763 request.method = "GET"; | 4764 request.method = "GET"; |
| 4764 request.url = GURL("http://172.22.68.17/kids/login.aspx"); | 4765 request.url = GURL("http://172.22.68.17/kids/login.aspx"); |
| 4765 | 4766 |
| 4766 // Ensure load is not disrupted by flags which suppress behaviour specific | 4767 // Ensure load is not disrupted by flags which suppress behaviour specific |
| 4767 // to other auth schemes. | 4768 // to other auth schemes. |
| 4768 request.load_flags = LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; | 4769 request.load_flags = LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; |
| 4769 | 4770 |
| 4770 HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom1, | 4771 HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom1, |
| 4771 MockGetHostName); | 4772 MockGetHostName); |
| 4772 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4773 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4773 | 4774 |
| 4774 MockWrite data_writes1[] = { | 4775 MockWrite data_writes1[] = { |
| 4775 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" | 4776 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" |
| 4776 "Host: 172.22.68.17\r\n" | 4777 "Host: 172.22.68.17\r\n" |
| 4777 "Connection: keep-alive\r\n\r\n"), | 4778 "Connection: keep-alive\r\n\r\n"), |
| 4778 }; | 4779 }; |
| 4779 | 4780 |
| 4780 MockRead data_reads1[] = { | 4781 MockRead data_reads1[] = { |
| 4781 MockRead("HTTP/1.1 401 Access Denied\r\n"), | 4782 MockRead("HTTP/1.1 401 Access Denied\r\n"), |
| 4782 // Negotiate and NTLM are often requested together. However, we only want | 4783 // Negotiate and NTLM are often requested together. However, we only want |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4891 | 4892 |
| 4892 // Enter a wrong password, and then the correct one. | 4893 // Enter a wrong password, and then the correct one. |
| 4893 TEST_P(HttpNetworkTransactionTest, NTLMAuth2) { | 4894 TEST_P(HttpNetworkTransactionTest, NTLMAuth2) { |
| 4894 HttpRequestInfo request; | 4895 HttpRequestInfo request; |
| 4895 request.method = "GET"; | 4896 request.method = "GET"; |
| 4896 request.url = GURL("http://172.22.68.17/kids/login.aspx"); | 4897 request.url = GURL("http://172.22.68.17/kids/login.aspx"); |
| 4897 request.load_flags = 0; | 4898 request.load_flags = 0; |
| 4898 | 4899 |
| 4899 HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom2, | 4900 HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom2, |
| 4900 MockGetHostName); | 4901 MockGetHostName); |
| 4901 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4902 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4902 | 4903 |
| 4903 MockWrite data_writes1[] = { | 4904 MockWrite data_writes1[] = { |
| 4904 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" | 4905 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" |
| 4905 "Host: 172.22.68.17\r\n" | 4906 "Host: 172.22.68.17\r\n" |
| 4906 "Connection: keep-alive\r\n\r\n"), | 4907 "Connection: keep-alive\r\n\r\n"), |
| 4907 }; | 4908 }; |
| 4908 | 4909 |
| 4909 MockRead data_reads1[] = { | 4910 MockRead data_reads1[] = { |
| 4910 MockRead("HTTP/1.1 401 Access Denied\r\n"), | 4911 MockRead("HTTP/1.1 401 Access Denied\r\n"), |
| 4911 // Negotiate and NTLM are often requested together. However, we only want | 4912 // Negotiate and NTLM are often requested together. However, we only want |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5091 | 5092 |
| 5092 // Test reading a server response which has only headers, and no body. | 5093 // Test reading a server response which has only headers, and no body. |
| 5093 // After some maximum number of bytes is consumed, the transaction should | 5094 // After some maximum number of bytes is consumed, the transaction should |
| 5094 // fail with ERR_RESPONSE_HEADERS_TOO_BIG. | 5095 // fail with ERR_RESPONSE_HEADERS_TOO_BIG. |
| 5095 TEST_P(HttpNetworkTransactionTest, LargeHeadersNoBody) { | 5096 TEST_P(HttpNetworkTransactionTest, LargeHeadersNoBody) { |
| 5096 HttpRequestInfo request; | 5097 HttpRequestInfo request; |
| 5097 request.method = "GET"; | 5098 request.method = "GET"; |
| 5098 request.url = GURL("http://www.example.org/"); | 5099 request.url = GURL("http://www.example.org/"); |
| 5099 request.load_flags = 0; | 5100 request.load_flags = 0; |
| 5100 | 5101 |
| 5101 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5102 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5102 scoped_ptr<HttpTransaction> trans( | 5103 scoped_ptr<HttpTransaction> trans( |
| 5103 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5104 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5104 | 5105 |
| 5105 // Respond with 300 kb of headers (we should fail after 256 kb). | 5106 // Respond with 300 kb of headers (we should fail after 256 kb). |
| 5106 std::string large_headers_string; | 5107 std::string large_headers_string; |
| 5107 FillLargeHeadersString(&large_headers_string, 300 * 1024); | 5108 FillLargeHeadersString(&large_headers_string, 300 * 1024); |
| 5108 | 5109 |
| 5109 MockRead data_reads[] = { | 5110 MockRead data_reads[] = { |
| 5110 MockRead("HTTP/1.0 200 OK\r\n"), | 5111 MockRead("HTTP/1.0 200 OK\r\n"), |
| 5111 MockRead(ASYNC, large_headers_string.data(), large_headers_string.size()), | 5112 MockRead(ASYNC, large_headers_string.data(), large_headers_string.size()), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 5130 TEST_P(HttpNetworkTransactionTest, | 5131 TEST_P(HttpNetworkTransactionTest, |
| 5131 DontRecycleTransportSocketForSSLTunnel) { | 5132 DontRecycleTransportSocketForSSLTunnel) { |
| 5132 HttpRequestInfo request; | 5133 HttpRequestInfo request; |
| 5133 request.method = "GET"; | 5134 request.method = "GET"; |
| 5134 request.url = GURL("https://www.example.org/"); | 5135 request.url = GURL("https://www.example.org/"); |
| 5135 request.load_flags = 0; | 5136 request.load_flags = 0; |
| 5136 | 5137 |
| 5137 // Configure against proxy server "myproxy:70". | 5138 // Configure against proxy server "myproxy:70". |
| 5138 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); | 5139 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 5139 | 5140 |
| 5140 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5141 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5141 | 5142 |
| 5142 scoped_ptr<HttpTransaction> trans( | 5143 scoped_ptr<HttpTransaction> trans( |
| 5143 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5144 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5144 | 5145 |
| 5145 // Since we have proxy, should try to establish tunnel. | 5146 // Since we have proxy, should try to establish tunnel. |
| 5146 MockWrite data_writes1[] = { | 5147 MockWrite data_writes1[] = { |
| 5147 MockWrite( | 5148 MockWrite( |
| 5148 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 5149 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 5149 "Host: www.example.org\r\n" | 5150 "Host: www.example.org\r\n" |
| 5150 "Proxy-Connection: keep-alive\r\n\r\n"), | 5151 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5184 EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); | 5185 EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); |
| 5185 } | 5186 } |
| 5186 | 5187 |
| 5187 // Make sure that we recycle a socket after reading all of the response body. | 5188 // Make sure that we recycle a socket after reading all of the response body. |
| 5188 TEST_P(HttpNetworkTransactionTest, RecycleSocket) { | 5189 TEST_P(HttpNetworkTransactionTest, RecycleSocket) { |
| 5189 HttpRequestInfo request; | 5190 HttpRequestInfo request; |
| 5190 request.method = "GET"; | 5191 request.method = "GET"; |
| 5191 request.url = GURL("http://www.example.org/"); | 5192 request.url = GURL("http://www.example.org/"); |
| 5192 request.load_flags = 0; | 5193 request.load_flags = 0; |
| 5193 | 5194 |
| 5194 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5195 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5195 | 5196 |
| 5196 scoped_ptr<HttpTransaction> trans( | 5197 scoped_ptr<HttpTransaction> trans( |
| 5197 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5198 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5198 | 5199 |
| 5199 MockRead data_reads[] = { | 5200 MockRead data_reads[] = { |
| 5200 // A part of the response body is received with the response headers. | 5201 // A part of the response body is received with the response headers. |
| 5201 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\nhel"), | 5202 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\nhel"), |
| 5202 // The rest of the response body is received in two parts. | 5203 // The rest of the response body is received in two parts. |
| 5203 MockRead("lo"), | 5204 MockRead("lo"), |
| 5204 MockRead(" world"), | 5205 MockRead(" world"), |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5263 | 5264 |
| 5264 SSLSocketDataProvider ssl(ASYNC, OK); | 5265 SSLSocketDataProvider ssl(ASYNC, OK); |
| 5265 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 5266 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 5266 | 5267 |
| 5267 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 5268 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 5268 data_writes, arraysize(data_writes)); | 5269 data_writes, arraysize(data_writes)); |
| 5269 session_deps_.socket_factory->AddSocketDataProvider(&data); | 5270 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 5270 | 5271 |
| 5271 TestCompletionCallback callback; | 5272 TestCompletionCallback callback; |
| 5272 | 5273 |
| 5273 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5274 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5274 scoped_ptr<HttpTransaction> trans( | 5275 scoped_ptr<HttpTransaction> trans( |
| 5275 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5276 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5276 | 5277 |
| 5277 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 5278 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 5278 | 5279 |
| 5279 EXPECT_EQ(ERR_IO_PENDING, rv); | 5280 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5280 EXPECT_EQ(OK, callback.WaitForResult()); | 5281 EXPECT_EQ(OK, callback.WaitForResult()); |
| 5281 | 5282 |
| 5282 const HttpResponseInfo* response = trans->GetResponseInfo(); | 5283 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 5283 ASSERT_TRUE(response != NULL); | 5284 ASSERT_TRUE(response != NULL); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5333 | 5334 |
| 5334 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 5335 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 5335 data_writes, arraysize(data_writes)); | 5336 data_writes, arraysize(data_writes)); |
| 5336 StaticSocketDataProvider data2(data_reads, arraysize(data_reads), | 5337 StaticSocketDataProvider data2(data_reads, arraysize(data_reads), |
| 5337 data_writes, arraysize(data_writes)); | 5338 data_writes, arraysize(data_writes)); |
| 5338 session_deps_.socket_factory->AddSocketDataProvider(&data); | 5339 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 5339 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 5340 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
| 5340 | 5341 |
| 5341 TestCompletionCallback callback; | 5342 TestCompletionCallback callback; |
| 5342 | 5343 |
| 5343 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5344 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5344 scoped_ptr<HttpTransaction> trans( | 5345 scoped_ptr<HttpTransaction> trans( |
| 5345 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5346 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5346 | 5347 |
| 5347 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 5348 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 5348 | 5349 |
| 5349 EXPECT_EQ(ERR_IO_PENDING, rv); | 5350 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5350 EXPECT_EQ(OK, callback.WaitForResult()); | 5351 EXPECT_EQ(OK, callback.WaitForResult()); |
| 5351 | 5352 |
| 5352 const HttpResponseInfo* response = trans->GetResponseInfo(); | 5353 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 5353 ASSERT_TRUE(response != NULL); | 5354 ASSERT_TRUE(response != NULL); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5401 TEST_P(HttpNetworkTransactionTest, RecycleSocketAfterZeroContentLength) { | 5402 TEST_P(HttpNetworkTransactionTest, RecycleSocketAfterZeroContentLength) { |
| 5402 HttpRequestInfo request; | 5403 HttpRequestInfo request; |
| 5403 request.method = "GET"; | 5404 request.method = "GET"; |
| 5404 request.url = GURL( | 5405 request.url = GURL( |
| 5405 "http://www.example.org/csi?v=3&s=web&action=&" | 5406 "http://www.example.org/csi?v=3&s=web&action=&" |
| 5406 "tran=undefined&ei=mAXcSeegAo-SMurloeUN&" | 5407 "tran=undefined&ei=mAXcSeegAo-SMurloeUN&" |
| 5407 "e=17259,18167,19592,19773,19981,20133,20173,20233&" | 5408 "e=17259,18167,19592,19773,19981,20133,20173,20233&" |
| 5408 "rt=prt.2642,ol.2649,xjs.2951"); | 5409 "rt=prt.2642,ol.2649,xjs.2951"); |
| 5409 request.load_flags = 0; | 5410 request.load_flags = 0; |
| 5410 | 5411 |
| 5411 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5412 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5412 | 5413 |
| 5413 scoped_ptr<HttpTransaction> trans( | 5414 scoped_ptr<HttpTransaction> trans( |
| 5414 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5415 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5415 | 5416 |
| 5416 MockRead data_reads[] = { | 5417 MockRead data_reads[] = { |
| 5417 MockRead("HTTP/1.1 204 No Content\r\n" | 5418 MockRead("HTTP/1.1 204 No Content\r\n" |
| 5418 "Content-Length: 0\r\n" | 5419 "Content-Length: 0\r\n" |
| 5419 "Content-Type: text/html\r\n\r\n"), | 5420 "Content-Type: text/html\r\n\r\n"), |
| 5420 MockRead("junk"), // Should not be read!! | 5421 MockRead("junk"), // Should not be read!! |
| 5421 MockRead(SYNCHRONOUS, OK), | 5422 MockRead(SYNCHRONOUS, OK), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5467 request[0].load_flags = 0; | 5468 request[0].load_flags = 0; |
| 5468 // Transaction 2: a POST request. Reuses the socket kept alive from | 5469 // Transaction 2: a POST request. Reuses the socket kept alive from |
| 5469 // transaction 1. The first attempts fails when writing the POST data. | 5470 // transaction 1. The first attempts fails when writing the POST data. |
| 5470 // This causes the transaction to retry with a new socket. The second | 5471 // This causes the transaction to retry with a new socket. The second |
| 5471 // attempt succeeds. | 5472 // attempt succeeds. |
| 5472 request[1].method = "POST"; | 5473 request[1].method = "POST"; |
| 5473 request[1].url = GURL("http://www.google.com/login.cgi"); | 5474 request[1].url = GURL("http://www.google.com/login.cgi"); |
| 5474 request[1].upload_data_stream = &upload_data_stream; | 5475 request[1].upload_data_stream = &upload_data_stream; |
| 5475 request[1].load_flags = 0; | 5476 request[1].load_flags = 0; |
| 5476 | 5477 |
| 5477 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5478 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5478 | 5479 |
| 5479 // The first socket is used for transaction 1 and the first attempt of | 5480 // The first socket is used for transaction 1 and the first attempt of |
| 5480 // transaction 2. | 5481 // transaction 2. |
| 5481 | 5482 |
| 5482 // The response of transaction 1. | 5483 // The response of transaction 1. |
| 5483 MockRead data_reads1[] = { | 5484 MockRead data_reads1[] = { |
| 5484 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\n"), | 5485 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\n"), |
| 5485 MockRead("hello world"), | 5486 MockRead("hello world"), |
| 5486 MockRead(SYNCHRONOUS, OK), | 5487 MockRead(SYNCHRONOUS, OK), |
| 5487 }; | 5488 }; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5545 | 5546 |
| 5546 // Test the request-challenge-retry sequence for basic auth when there is | 5547 // Test the request-challenge-retry sequence for basic auth when there is |
| 5547 // an identity in the URL. The request should be sent as normal, but when | 5548 // an identity in the URL. The request should be sent as normal, but when |
| 5548 // it fails the identity from the URL is used to answer the challenge. | 5549 // it fails the identity from the URL is used to answer the challenge. |
| 5549 TEST_P(HttpNetworkTransactionTest, AuthIdentityInURL) { | 5550 TEST_P(HttpNetworkTransactionTest, AuthIdentityInURL) { |
| 5550 HttpRequestInfo request; | 5551 HttpRequestInfo request; |
| 5551 request.method = "GET"; | 5552 request.method = "GET"; |
| 5552 request.url = GURL("http://foo:b@r@www.example.org/"); | 5553 request.url = GURL("http://foo:b@r@www.example.org/"); |
| 5553 request.load_flags = LOAD_NORMAL; | 5554 request.load_flags = LOAD_NORMAL; |
| 5554 | 5555 |
| 5555 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5556 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5556 scoped_ptr<HttpTransaction> trans( | 5557 scoped_ptr<HttpTransaction> trans( |
| 5557 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5558 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5558 | 5559 |
| 5559 // The password contains an escaped character -- for this test to pass it | 5560 // The password contains an escaped character -- for this test to pass it |
| 5560 // will need to be unescaped by HttpNetworkTransaction. | 5561 // will need to be unescaped by HttpNetworkTransaction. |
| 5561 EXPECT_EQ("b%40r", request.url.password()); | 5562 EXPECT_EQ("b%40r", request.url.password()); |
| 5562 | 5563 |
| 5563 MockWrite data_writes1[] = { | 5564 MockWrite data_writes1[] = { |
| 5564 MockWrite( | 5565 MockWrite( |
| 5565 "GET / HTTP/1.1\r\n" | 5566 "GET / HTTP/1.1\r\n" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5628 // once. | 5629 // once. |
| 5629 TEST_P(HttpNetworkTransactionTest, WrongAuthIdentityInURL) { | 5630 TEST_P(HttpNetworkTransactionTest, WrongAuthIdentityInURL) { |
| 5630 HttpRequestInfo request; | 5631 HttpRequestInfo request; |
| 5631 request.method = "GET"; | 5632 request.method = "GET"; |
| 5632 // Note: the URL has a username:password in it. The password "baz" is | 5633 // Note: the URL has a username:password in it. The password "baz" is |
| 5633 // wrong (should be "bar"). | 5634 // wrong (should be "bar"). |
| 5634 request.url = GURL("http://foo:baz@www.example.org/"); | 5635 request.url = GURL("http://foo:baz@www.example.org/"); |
| 5635 | 5636 |
| 5636 request.load_flags = LOAD_NORMAL; | 5637 request.load_flags = LOAD_NORMAL; |
| 5637 | 5638 |
| 5638 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5639 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5639 scoped_ptr<HttpTransaction> trans( | 5640 scoped_ptr<HttpTransaction> trans( |
| 5640 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5641 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5641 | 5642 |
| 5642 MockWrite data_writes1[] = { | 5643 MockWrite data_writes1[] = { |
| 5643 MockWrite( | 5644 MockWrite( |
| 5644 "GET / HTTP/1.1\r\n" | 5645 "GET / HTTP/1.1\r\n" |
| 5645 "Host: www.example.org\r\n" | 5646 "Host: www.example.org\r\n" |
| 5646 "Connection: keep-alive\r\n\r\n"), | 5647 "Connection: keep-alive\r\n\r\n"), |
| 5647 }; | 5648 }; |
| 5648 | 5649 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5739 | 5740 |
| 5740 // Test the request-challenge-retry sequence for basic auth when there is a | 5741 // Test the request-challenge-retry sequence for basic auth when there is a |
| 5741 // correct identity in the URL, but its use is being suppressed. The identity | 5742 // correct identity in the URL, but its use is being suppressed. The identity |
| 5742 // from the URL should never be used. | 5743 // from the URL should never be used. |
| 5743 TEST_P(HttpNetworkTransactionTest, AuthIdentityInURLSuppressed) { | 5744 TEST_P(HttpNetworkTransactionTest, AuthIdentityInURLSuppressed) { |
| 5744 HttpRequestInfo request; | 5745 HttpRequestInfo request; |
| 5745 request.method = "GET"; | 5746 request.method = "GET"; |
| 5746 request.url = GURL("http://foo:bar@www.example.org/"); | 5747 request.url = GURL("http://foo:bar@www.example.org/"); |
| 5747 request.load_flags = LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; | 5748 request.load_flags = LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; |
| 5748 | 5749 |
| 5749 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5750 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5750 scoped_ptr<HttpTransaction> trans( | 5751 scoped_ptr<HttpTransaction> trans( |
| 5751 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5752 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5752 | 5753 |
| 5753 MockWrite data_writes1[] = { | 5754 MockWrite data_writes1[] = { |
| 5754 MockWrite( | 5755 MockWrite( |
| 5755 "GET / HTTP/1.1\r\n" | 5756 "GET / HTTP/1.1\r\n" |
| 5756 "Host: www.example.org\r\n" | 5757 "Host: www.example.org\r\n" |
| 5757 "Connection: keep-alive\r\n\r\n"), | 5758 "Connection: keep-alive\r\n\r\n"), |
| 5758 }; | 5759 }; |
| 5759 | 5760 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5813 // There is no challenge info, since the identity worked. | 5814 // There is no challenge info, since the identity worked. |
| 5814 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 5815 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 5815 EXPECT_EQ(100, response->headers->GetContentLength()); | 5816 EXPECT_EQ(100, response->headers->GetContentLength()); |
| 5816 | 5817 |
| 5817 // Empty the current queue. | 5818 // Empty the current queue. |
| 5818 base::MessageLoop::current()->RunUntilIdle(); | 5819 base::MessageLoop::current()->RunUntilIdle(); |
| 5819 } | 5820 } |
| 5820 | 5821 |
| 5821 // Test that previously tried username/passwords for a realm get re-used. | 5822 // Test that previously tried username/passwords for a realm get re-used. |
| 5822 TEST_P(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) { | 5823 TEST_P(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) { |
| 5823 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5824 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5824 | 5825 |
| 5825 // Transaction 1: authenticate (foo, bar) on MyRealm1 | 5826 // Transaction 1: authenticate (foo, bar) on MyRealm1 |
| 5826 { | 5827 { |
| 5827 HttpRequestInfo request; | 5828 HttpRequestInfo request; |
| 5828 request.method = "GET"; | 5829 request.method = "GET"; |
| 5829 request.url = GURL("http://www.example.org/x/y/z"); | 5830 request.url = GURL("http://www.example.org/x/y/z"); |
| 5830 request.load_flags = 0; | 5831 request.load_flags = 0; |
| 5831 | 5832 |
| 5832 scoped_ptr<HttpTransaction> trans( | 5833 scoped_ptr<HttpTransaction> trans( |
| 5833 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5834 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6213 | 6214 |
| 6214 // Tests that nonce count increments when multiple auth attempts | 6215 // Tests that nonce count increments when multiple auth attempts |
| 6215 // are started with the same nonce. | 6216 // are started with the same nonce. |
| 6216 TEST_P(HttpNetworkTransactionTest, DigestPreAuthNonceCount) { | 6217 TEST_P(HttpNetworkTransactionTest, DigestPreAuthNonceCount) { |
| 6217 HttpAuthHandlerDigest::Factory* digest_factory = | 6218 HttpAuthHandlerDigest::Factory* digest_factory = |
| 6218 new HttpAuthHandlerDigest::Factory(); | 6219 new HttpAuthHandlerDigest::Factory(); |
| 6219 HttpAuthHandlerDigest::FixedNonceGenerator* nonce_generator = | 6220 HttpAuthHandlerDigest::FixedNonceGenerator* nonce_generator = |
| 6220 new HttpAuthHandlerDigest::FixedNonceGenerator("0123456789abcdef"); | 6221 new HttpAuthHandlerDigest::FixedNonceGenerator("0123456789abcdef"); |
| 6221 digest_factory->set_nonce_generator(nonce_generator); | 6222 digest_factory->set_nonce_generator(nonce_generator); |
| 6222 session_deps_.http_auth_handler_factory.reset(digest_factory); | 6223 session_deps_.http_auth_handler_factory.reset(digest_factory); |
| 6223 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6224 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6224 | 6225 |
| 6225 // Transaction 1: authenticate (foo, bar) on MyRealm1 | 6226 // Transaction 1: authenticate (foo, bar) on MyRealm1 |
| 6226 { | 6227 { |
| 6227 HttpRequestInfo request; | 6228 HttpRequestInfo request; |
| 6228 request.method = "GET"; | 6229 request.method = "GET"; |
| 6229 request.url = GURL("http://www.example.org/x/y/z"); | 6230 request.url = GURL("http://www.example.org/x/y/z"); |
| 6230 request.load_flags = 0; | 6231 request.load_flags = 0; |
| 6231 | 6232 |
| 6232 scoped_ptr<HttpTransaction> trans( | 6233 scoped_ptr<HttpTransaction> trans( |
| 6233 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6234 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6345 | 6346 |
| 6346 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6347 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6347 ASSERT_TRUE(response != NULL); | 6348 ASSERT_TRUE(response != NULL); |
| 6348 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 6349 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 6349 } | 6350 } |
| 6350 } | 6351 } |
| 6351 | 6352 |
| 6352 // Test the ResetStateForRestart() private method. | 6353 // Test the ResetStateForRestart() private method. |
| 6353 TEST_P(HttpNetworkTransactionTest, ResetStateForRestart) { | 6354 TEST_P(HttpNetworkTransactionTest, ResetStateForRestart) { |
| 6354 // Create a transaction (the dependencies aren't important). | 6355 // Create a transaction (the dependencies aren't important). |
| 6355 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6356 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6356 scoped_ptr<HttpNetworkTransaction> trans( | 6357 scoped_ptr<HttpNetworkTransaction> trans( |
| 6357 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6358 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6358 | 6359 |
| 6359 // Setup some state (which we expect ResetStateForRestart() will clear). | 6360 // Setup some state (which we expect ResetStateForRestart() will clear). |
| 6360 trans->read_buf_ = new IOBuffer(15); | 6361 trans->read_buf_ = new IOBuffer(15); |
| 6361 trans->read_buf_len_ = 15; | 6362 trans->read_buf_len_ = 15; |
| 6362 trans->request_headers_.SetHeader("Authorization", "NTLM"); | 6363 trans->request_headers_.SetHeader("Authorization", "NTLM"); |
| 6363 | 6364 |
| 6364 // Setup state in response_ | 6365 // Setup state in response_ |
| 6365 HttpResponseInfo* response = &trans->response_; | 6366 HttpResponseInfo* response = &trans->response_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 6392 EXPECT_FALSE(response->vary_data.is_valid()); | 6393 EXPECT_FALSE(response->vary_data.is_valid()); |
| 6393 } | 6394 } |
| 6394 | 6395 |
| 6395 // Test HTTPS connections to a site with a bad certificate | 6396 // Test HTTPS connections to a site with a bad certificate |
| 6396 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificate) { | 6397 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificate) { |
| 6397 HttpRequestInfo request; | 6398 HttpRequestInfo request; |
| 6398 request.method = "GET"; | 6399 request.method = "GET"; |
| 6399 request.url = GURL("https://www.example.org/"); | 6400 request.url = GURL("https://www.example.org/"); |
| 6400 request.load_flags = 0; | 6401 request.load_flags = 0; |
| 6401 | 6402 |
| 6402 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6403 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6403 scoped_ptr<HttpTransaction> trans( | 6404 scoped_ptr<HttpTransaction> trans( |
| 6404 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6405 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6405 | 6406 |
| 6406 MockWrite data_writes[] = { | 6407 MockWrite data_writes[] = { |
| 6407 MockWrite( | 6408 MockWrite( |
| 6408 "GET / HTTP/1.1\r\n" | 6409 "GET / HTTP/1.1\r\n" |
| 6409 "Host: www.example.org\r\n" | 6410 "Host: www.example.org\r\n" |
| 6410 "Connection: keep-alive\r\n\r\n"), | 6411 "Connection: keep-alive\r\n\r\n"), |
| 6411 }; | 6412 }; |
| 6412 | 6413 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6500 session_deps_.socket_factory->AddSocketDataProvider(&ssl_bad_certificate); | 6501 session_deps_.socket_factory->AddSocketDataProvider(&ssl_bad_certificate); |
| 6501 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6502 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6502 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_bad); | 6503 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_bad); |
| 6503 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 6504 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 6504 | 6505 |
| 6505 TestCompletionCallback callback; | 6506 TestCompletionCallback callback; |
| 6506 | 6507 |
| 6507 for (int i = 0; i < 2; i++) { | 6508 for (int i = 0; i < 2; i++) { |
| 6508 session_deps_.socket_factory->ResetNextMockIndexes(); | 6509 session_deps_.socket_factory->ResetNextMockIndexes(); |
| 6509 | 6510 |
| 6510 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6511 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6511 scoped_ptr<HttpTransaction> trans( | 6512 scoped_ptr<HttpTransaction> trans( |
| 6512 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6513 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6513 | 6514 |
| 6514 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6515 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6515 EXPECT_EQ(ERR_IO_PENDING, rv); | 6516 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6516 | 6517 |
| 6517 rv = callback.WaitForResult(); | 6518 rv = callback.WaitForResult(); |
| 6518 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); | 6519 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); |
| 6519 | 6520 |
| 6520 rv = trans->RestartIgnoringLastError(callback.callback()); | 6521 rv = trans->RestartIgnoringLastError(callback.callback()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6566 data_writes, arraysize(data_writes)); | 6567 data_writes, arraysize(data_writes)); |
| 6567 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 6568 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 6568 SSLSocketDataProvider tunnel_ssl(ASYNC, OK); // SSL through the tunnel | 6569 SSLSocketDataProvider tunnel_ssl(ASYNC, OK); // SSL through the tunnel |
| 6569 | 6570 |
| 6570 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6571 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6571 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); | 6572 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); |
| 6572 session_deps_.socket_factory->AddSSLSocketDataProvider(&tunnel_ssl); | 6573 session_deps_.socket_factory->AddSSLSocketDataProvider(&tunnel_ssl); |
| 6573 | 6574 |
| 6574 TestCompletionCallback callback; | 6575 TestCompletionCallback callback; |
| 6575 | 6576 |
| 6576 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6577 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6577 scoped_ptr<HttpTransaction> trans( | 6578 scoped_ptr<HttpTransaction> trans( |
| 6578 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6579 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6579 | 6580 |
| 6580 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6581 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6581 EXPECT_EQ(ERR_IO_PENDING, rv); | 6582 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6582 | 6583 |
| 6583 rv = callback.WaitForResult(); | 6584 rv = callback.WaitForResult(); |
| 6584 EXPECT_EQ(OK, rv); | 6585 EXPECT_EQ(OK, rv); |
| 6585 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6586 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6586 | 6587 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6625 | 6626 |
| 6626 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 6627 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 6627 data_writes, arraysize(data_writes)); | 6628 data_writes, arraysize(data_writes)); |
| 6628 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 6629 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 6629 | 6630 |
| 6630 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6631 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6631 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); | 6632 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); |
| 6632 | 6633 |
| 6633 TestCompletionCallback callback; | 6634 TestCompletionCallback callback; |
| 6634 | 6635 |
| 6635 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6636 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6636 scoped_ptr<HttpTransaction> trans( | 6637 scoped_ptr<HttpTransaction> trans( |
| 6637 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6638 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6638 | 6639 |
| 6639 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6640 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6640 EXPECT_EQ(ERR_IO_PENDING, rv); | 6641 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6641 | 6642 |
| 6642 rv = callback.WaitForResult(); | 6643 rv = callback.WaitForResult(); |
| 6643 EXPECT_EQ(OK, rv); | 6644 EXPECT_EQ(OK, rv); |
| 6644 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6645 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6645 | 6646 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6706 SequencedSocketData data(data_reads, arraysize(data_reads), data_writes, | 6707 SequencedSocketData data(data_reads, arraysize(data_reads), data_writes, |
| 6707 arraysize(data_writes)); | 6708 arraysize(data_writes)); |
| 6708 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 6709 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 6709 proxy_ssl.SetNextProto(GetParam()); | 6710 proxy_ssl.SetNextProto(GetParam()); |
| 6710 | 6711 |
| 6711 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6712 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6712 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); | 6713 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); |
| 6713 | 6714 |
| 6714 TestCompletionCallback callback; | 6715 TestCompletionCallback callback; |
| 6715 | 6716 |
| 6716 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6717 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6717 scoped_ptr<HttpTransaction> trans( | 6718 scoped_ptr<HttpTransaction> trans( |
| 6718 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6719 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6719 | 6720 |
| 6720 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6721 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6721 EXPECT_EQ(ERR_IO_PENDING, rv); | 6722 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6722 | 6723 |
| 6723 rv = callback.WaitForResult(); | 6724 rv = callback.WaitForResult(); |
| 6724 EXPECT_EQ(OK, rv); | 6725 EXPECT_EQ(OK, rv); |
| 6725 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6726 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6726 | 6727 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6758 | 6759 |
| 6759 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 6760 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 6760 data_writes, arraysize(data_writes)); | 6761 data_writes, arraysize(data_writes)); |
| 6761 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 6762 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 6762 | 6763 |
| 6763 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6764 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6764 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); | 6765 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); |
| 6765 | 6766 |
| 6766 TestCompletionCallback callback; | 6767 TestCompletionCallback callback; |
| 6767 | 6768 |
| 6768 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6769 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6769 scoped_ptr<HttpTransaction> trans( | 6770 scoped_ptr<HttpTransaction> trans( |
| 6770 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6771 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6771 | 6772 |
| 6772 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6773 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6773 EXPECT_EQ(ERR_IO_PENDING, rv); | 6774 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6774 | 6775 |
| 6775 rv = callback.WaitForResult(); | 6776 rv = callback.WaitForResult(); |
| 6776 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 6777 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 6777 | 6778 |
| 6778 // TODO(ttuttle): Anything else to check here? | 6779 // TODO(ttuttle): Anything else to check here? |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6815 SequencedSocketData data(data_reads, arraysize(data_reads), data_writes, | 6816 SequencedSocketData data(data_reads, arraysize(data_reads), data_writes, |
| 6816 arraysize(data_writes)); | 6817 arraysize(data_writes)); |
| 6817 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 6818 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 6818 proxy_ssl.SetNextProto(GetParam()); | 6819 proxy_ssl.SetNextProto(GetParam()); |
| 6819 | 6820 |
| 6820 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6821 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6821 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); | 6822 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); |
| 6822 | 6823 |
| 6823 TestCompletionCallback callback; | 6824 TestCompletionCallback callback; |
| 6824 | 6825 |
| 6825 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6826 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6826 scoped_ptr<HttpTransaction> trans( | 6827 scoped_ptr<HttpTransaction> trans( |
| 6827 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6828 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6828 | 6829 |
| 6829 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6830 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6830 EXPECT_EQ(ERR_IO_PENDING, rv); | 6831 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6831 | 6832 |
| 6832 rv = callback.WaitForResult(); | 6833 rv = callback.WaitForResult(); |
| 6833 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 6834 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 6834 | 6835 |
| 6835 // TODO(ttuttle): Anything else to check here? | 6836 // TODO(ttuttle): Anything else to check here? |
| 6836 } | 6837 } |
| 6837 | 6838 |
| 6838 // Test the request-challenge-retry sequence for basic auth, through | 6839 // Test the request-challenge-retry sequence for basic auth, through |
| 6839 // a SPDY proxy over a single SPDY session. | 6840 // a SPDY proxy over a single SPDY session. |
| 6840 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { | 6841 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { |
| 6841 HttpRequestInfo request; | 6842 HttpRequestInfo request; |
| 6842 request.method = "GET"; | 6843 request.method = "GET"; |
| 6843 request.url = GURL("https://www.example.org/"); | 6844 request.url = GURL("https://www.example.org/"); |
| 6844 // when the no authentication data flag is set. | 6845 // when the no authentication data flag is set. |
| 6845 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 6846 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 6846 | 6847 |
| 6847 // Configure against https proxy server "myproxy:70". | 6848 // Configure against https proxy server "myproxy:70". |
| 6848 session_deps_.proxy_service = | 6849 session_deps_.proxy_service = |
| 6849 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"); | 6850 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"); |
| 6850 BoundTestNetLog log; | 6851 BoundTestNetLog log; |
| 6851 session_deps_.net_log = log.bound().net_log(); | 6852 session_deps_.net_log = log.bound().net_log(); |
| 6852 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6853 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6853 | 6854 |
| 6854 // Since we have proxy, should try to establish tunnel. | 6855 // Since we have proxy, should try to establish tunnel. |
| 6855 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect( | 6856 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect( |
| 6856 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 6857 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| 6857 scoped_ptr<SpdyFrame> rst( | 6858 scoped_ptr<SpdyFrame> rst( |
| 6858 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); | 6859 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); |
| 6859 | 6860 |
| 6860 // After calling trans->RestartWithAuth(), this is the request we should | 6861 // After calling trans->RestartWithAuth(), this is the request we should |
| 6861 // be issuing -- the final header line contains the credentials. | 6862 // be issuing -- the final header line contains the credentials. |
| 6862 const char* const kAuthCredentials[] = { | 6863 const char* const kAuthCredentials[] = { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6987 | 6988 |
| 6988 // Configure against https proxy server "myproxy:70". | 6989 // Configure against https proxy server "myproxy:70". |
| 6989 session_deps_.proxy_service = | 6990 session_deps_.proxy_service = |
| 6990 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"); | 6991 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70"); |
| 6991 BoundTestNetLog log; | 6992 BoundTestNetLog log; |
| 6992 session_deps_.net_log = log.bound().net_log(); | 6993 session_deps_.net_log = log.bound().net_log(); |
| 6993 | 6994 |
| 6994 // Enable cross-origin push. | 6995 // Enable cross-origin push. |
| 6995 session_deps_.trusted_spdy_proxy = "myproxy:70"; | 6996 session_deps_.trusted_spdy_proxy = "myproxy:70"; |
| 6996 | 6997 |
| 6997 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6998 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6998 | 6999 |
| 6999 scoped_ptr<SpdyFrame> stream1_syn( | 7000 scoped_ptr<SpdyFrame> stream1_syn( |
| 7000 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 7001 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 7001 | 7002 |
| 7002 MockWrite spdy_writes[] = { | 7003 MockWrite spdy_writes[] = { |
| 7003 CreateMockWrite(*stream1_syn, 0, ASYNC), | 7004 CreateMockWrite(*stream1_syn, 0, ASYNC), |
| 7004 }; | 7005 }; |
| 7005 | 7006 |
| 7006 scoped_ptr<SpdyFrame> | 7007 scoped_ptr<SpdyFrame> |
| 7007 stream1_reply(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 7008 stream1_reply(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7100 request.url = GURL("http://www.example.org/"); | 7101 request.url = GURL("http://www.example.org/"); |
| 7101 | 7102 |
| 7102 // Configure against https proxy server "myproxy:70". | 7103 // Configure against https proxy server "myproxy:70". |
| 7103 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); | 7104 session_deps_.proxy_service = ProxyService::CreateFixed("https://myproxy:70"); |
| 7104 BoundTestNetLog log; | 7105 BoundTestNetLog log; |
| 7105 session_deps_.net_log = log.bound().net_log(); | 7106 session_deps_.net_log = log.bound().net_log(); |
| 7106 | 7107 |
| 7107 // Enable cross-origin push. | 7108 // Enable cross-origin push. |
| 7108 session_deps_.trusted_spdy_proxy = "myproxy:70"; | 7109 session_deps_.trusted_spdy_proxy = "myproxy:70"; |
| 7109 | 7110 |
| 7110 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7111 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7111 | 7112 |
| 7112 scoped_ptr<SpdyFrame> stream1_syn( | 7113 scoped_ptr<SpdyFrame> stream1_syn( |
| 7113 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 7114 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 7114 | 7115 |
| 7115 scoped_ptr<SpdyFrame> push_rst( | 7116 scoped_ptr<SpdyFrame> push_rst( |
| 7116 spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); | 7117 spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); |
| 7117 | 7118 |
| 7118 MockWrite spdy_writes[] = { | 7119 MockWrite spdy_writes[] = { |
| 7119 CreateMockWrite(*stream1_syn, 0, ASYNC), CreateMockWrite(*push_rst, 3), | 7120 CreateMockWrite(*stream1_syn, 0, ASYNC), CreateMockWrite(*push_rst, 3), |
| 7120 }; | 7121 }; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7228 session_deps_.socket_factory->AddSocketDataProvider(&ssl_bad_certificate); | 7229 session_deps_.socket_factory->AddSocketDataProvider(&ssl_bad_certificate); |
| 7229 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_bad); | 7230 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_bad); |
| 7230 | 7231 |
| 7231 // SSL to the proxy, then CONNECT request, then valid SSL certificate | 7232 // SSL to the proxy, then CONNECT request, then valid SSL certificate |
| 7232 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 7233 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 7233 session_deps_.socket_factory->AddSocketDataProvider(&data); | 7234 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 7234 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 7235 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 7235 | 7236 |
| 7236 TestCompletionCallback callback; | 7237 TestCompletionCallback callback; |
| 7237 | 7238 |
| 7238 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7239 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7239 scoped_ptr<HttpTransaction> trans( | 7240 scoped_ptr<HttpTransaction> trans( |
| 7240 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7241 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7241 | 7242 |
| 7242 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 7243 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 7243 EXPECT_EQ(ERR_IO_PENDING, rv); | 7244 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 7244 | 7245 |
| 7245 rv = callback.WaitForResult(); | 7246 rv = callback.WaitForResult(); |
| 7246 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); | 7247 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); |
| 7247 | 7248 |
| 7248 rv = trans->RestartIgnoringLastError(callback.callback()); | 7249 rv = trans->RestartIgnoringLastError(callback.callback()); |
| 7249 EXPECT_EQ(ERR_IO_PENDING, rv); | 7250 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 7250 | 7251 |
| 7251 rv = callback.WaitForResult(); | 7252 rv = callback.WaitForResult(); |
| 7252 EXPECT_EQ(OK, rv); | 7253 EXPECT_EQ(OK, rv); |
| 7253 | 7254 |
| 7254 const HttpResponseInfo* response = trans->GetResponseInfo(); | 7255 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 7255 | 7256 |
| 7256 ASSERT_TRUE(response != NULL); | 7257 ASSERT_TRUE(response != NULL); |
| 7257 EXPECT_EQ(100, response->headers->GetContentLength()); | 7258 EXPECT_EQ(100, response->headers->GetContentLength()); |
| 7258 } | 7259 } |
| 7259 | 7260 |
| 7260 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgent) { | 7261 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgent) { |
| 7261 HttpRequestInfo request; | 7262 HttpRequestInfo request; |
| 7262 request.method = "GET"; | 7263 request.method = "GET"; |
| 7263 request.url = GURL("http://www.example.org/"); | 7264 request.url = GURL("http://www.example.org/"); |
| 7264 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, | 7265 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, |
| 7265 "Chromium Ultra Awesome X Edition"); | 7266 "Chromium Ultra Awesome X Edition"); |
| 7266 | 7267 |
| 7267 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7268 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7268 scoped_ptr<HttpTransaction> trans( | 7269 scoped_ptr<HttpTransaction> trans( |
| 7269 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7270 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7270 | 7271 |
| 7271 MockWrite data_writes[] = { | 7272 MockWrite data_writes[] = { |
| 7272 MockWrite( | 7273 MockWrite( |
| 7273 "GET / HTTP/1.1\r\n" | 7274 "GET / HTTP/1.1\r\n" |
| 7274 "Host: www.example.org\r\n" | 7275 "Host: www.example.org\r\n" |
| 7275 "Connection: keep-alive\r\n" | 7276 "Connection: keep-alive\r\n" |
| 7276 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), | 7277 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), |
| 7277 }; | 7278 }; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 7298 } | 7299 } |
| 7299 | 7300 |
| 7300 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgentOverTunnel) { | 7301 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgentOverTunnel) { |
| 7301 HttpRequestInfo request; | 7302 HttpRequestInfo request; |
| 7302 request.method = "GET"; | 7303 request.method = "GET"; |
| 7303 request.url = GURL("https://www.example.org/"); | 7304 request.url = GURL("https://www.example.org/"); |
| 7304 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, | 7305 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, |
| 7305 "Chromium Ultra Awesome X Edition"); | 7306 "Chromium Ultra Awesome X Edition"); |
| 7306 | 7307 |
| 7307 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); | 7308 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 7308 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7309 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7309 scoped_ptr<HttpTransaction> trans( | 7310 scoped_ptr<HttpTransaction> trans( |
| 7310 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7311 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7311 | 7312 |
| 7312 MockWrite data_writes[] = { | 7313 MockWrite data_writes[] = { |
| 7313 MockWrite( | 7314 MockWrite( |
| 7314 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 7315 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 7315 "Host: www.example.org\r\n" | 7316 "Host: www.example.org\r\n" |
| 7316 "Proxy-Connection: keep-alive\r\n" | 7317 "Proxy-Connection: keep-alive\r\n" |
| 7317 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), | 7318 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), |
| 7318 }; | 7319 }; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 7338 } | 7339 } |
| 7339 | 7340 |
| 7340 TEST_P(HttpNetworkTransactionTest, BuildRequest_Referer) { | 7341 TEST_P(HttpNetworkTransactionTest, BuildRequest_Referer) { |
| 7341 HttpRequestInfo request; | 7342 HttpRequestInfo request; |
| 7342 request.method = "GET"; | 7343 request.method = "GET"; |
| 7343 request.url = GURL("http://www.example.org/"); | 7344 request.url = GURL("http://www.example.org/"); |
| 7344 request.load_flags = 0; | 7345 request.load_flags = 0; |
| 7345 request.extra_headers.SetHeader(HttpRequestHeaders::kReferer, | 7346 request.extra_headers.SetHeader(HttpRequestHeaders::kReferer, |
| 7346 "http://the.previous.site.com/"); | 7347 "http://the.previous.site.com/"); |
| 7347 | 7348 |
| 7348 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7349 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7349 scoped_ptr<HttpTransaction> trans( | 7350 scoped_ptr<HttpTransaction> trans( |
| 7350 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7351 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7351 | 7352 |
| 7352 MockWrite data_writes[] = { | 7353 MockWrite data_writes[] = { |
| 7353 MockWrite( | 7354 MockWrite( |
| 7354 "GET / HTTP/1.1\r\n" | 7355 "GET / HTTP/1.1\r\n" |
| 7355 "Host: www.example.org\r\n" | 7356 "Host: www.example.org\r\n" |
| 7356 "Connection: keep-alive\r\n" | 7357 "Connection: keep-alive\r\n" |
| 7357 "Referer: http://the.previous.site.com/\r\n\r\n"), | 7358 "Referer: http://the.previous.site.com/\r\n\r\n"), |
| 7358 }; | 7359 }; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 7376 | 7377 |
| 7377 rv = callback.WaitForResult(); | 7378 rv = callback.WaitForResult(); |
| 7378 EXPECT_EQ(OK, rv); | 7379 EXPECT_EQ(OK, rv); |
| 7379 } | 7380 } |
| 7380 | 7381 |
| 7381 TEST_P(HttpNetworkTransactionTest, BuildRequest_PostContentLengthZero) { | 7382 TEST_P(HttpNetworkTransactionTest, BuildRequest_PostContentLengthZero) { |
| 7382 HttpRequestInfo request; | 7383 HttpRequestInfo request; |
| 7383 request.method = "POST"; | 7384 request.method = "POST"; |
| 7384 request.url = GURL("http://www.example.org/"); | 7385 request.url = GURL("http://www.example.org/"); |
| 7385 | 7386 |
| 7386 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7387 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7387 scoped_ptr<HttpTransaction> trans( | 7388 scoped_ptr<HttpTransaction> trans( |
| 7388 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7389 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7389 | 7390 |
| 7390 MockWrite data_writes[] = { | 7391 MockWrite data_writes[] = { |
| 7391 MockWrite( | 7392 MockWrite( |
| 7392 "POST / HTTP/1.1\r\n" | 7393 "POST / HTTP/1.1\r\n" |
| 7393 "Host: www.example.org\r\n" | 7394 "Host: www.example.org\r\n" |
| 7394 "Connection: keep-alive\r\n" | 7395 "Connection: keep-alive\r\n" |
| 7395 "Content-Length: 0\r\n\r\n"), | 7396 "Content-Length: 0\r\n\r\n"), |
| 7396 }; | 7397 }; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 7414 | 7415 |
| 7415 rv = callback.WaitForResult(); | 7416 rv = callback.WaitForResult(); |
| 7416 EXPECT_EQ(OK, rv); | 7417 EXPECT_EQ(OK, rv); |
| 7417 } | 7418 } |
| 7418 | 7419 |
| 7419 TEST_P(HttpNetworkTransactionTest, BuildRequest_PutContentLengthZero) { | 7420 TEST_P(HttpNetworkTransactionTest, BuildRequest_PutContentLengthZero) { |
| 7420 HttpRequestInfo request; | 7421 HttpRequestInfo request; |
| 7421 request.method = "PUT"; | 7422 request.method = "PUT"; |
| 7422 request.url = GURL("http://www.example.org/"); | 7423 request.url = GURL("http://www.example.org/"); |
| 7423 | 7424 |
| 7424 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7425 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7425 scoped_ptr<HttpTransaction> trans( | 7426 scoped_ptr<HttpTransaction> trans( |
| 7426 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7427 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7427 | 7428 |
| 7428 MockWrite data_writes[] = { | 7429 MockWrite data_writes[] = { |
| 7429 MockWrite( | 7430 MockWrite( |
| 7430 "PUT / HTTP/1.1\r\n" | 7431 "PUT / HTTP/1.1\r\n" |
| 7431 "Host: www.example.org\r\n" | 7432 "Host: www.example.org\r\n" |
| 7432 "Connection: keep-alive\r\n" | 7433 "Connection: keep-alive\r\n" |
| 7433 "Content-Length: 0\r\n\r\n"), | 7434 "Content-Length: 0\r\n\r\n"), |
| 7434 }; | 7435 }; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 7452 | 7453 |
| 7453 rv = callback.WaitForResult(); | 7454 rv = callback.WaitForResult(); |
| 7454 EXPECT_EQ(OK, rv); | 7455 EXPECT_EQ(OK, rv); |
| 7455 } | 7456 } |
| 7456 | 7457 |
| 7457 TEST_P(HttpNetworkTransactionTest, BuildRequest_HeadContentLengthZero) { | 7458 TEST_P(HttpNetworkTransactionTest, BuildRequest_HeadContentLengthZero) { |
| 7458 HttpRequestInfo request; | 7459 HttpRequestInfo request; |
| 7459 request.method = "HEAD"; | 7460 request.method = "HEAD"; |
| 7460 request.url = GURL("http://www.example.org/"); | 7461 request.url = GURL("http://www.example.org/"); |
| 7461 | 7462 |
| 7462 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7463 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7463 scoped_ptr<HttpTransaction> trans( | 7464 scoped_ptr<HttpTransaction> trans( |
| 7464 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7465 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7465 | 7466 |
| 7466 MockWrite data_writes[] = { | 7467 MockWrite data_writes[] = { |
| 7467 MockWrite("HEAD / HTTP/1.1\r\n" | 7468 MockWrite("HEAD / HTTP/1.1\r\n" |
| 7468 "Host: www.example.org\r\n" | 7469 "Host: www.example.org\r\n" |
| 7469 "Connection: keep-alive\r\n\r\n"), | 7470 "Connection: keep-alive\r\n\r\n"), |
| 7470 }; | 7471 }; |
| 7471 | 7472 |
| 7472 // Lastly, the server responds with the actual content. | 7473 // Lastly, the server responds with the actual content. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 7489 rv = callback.WaitForResult(); | 7490 rv = callback.WaitForResult(); |
| 7490 EXPECT_EQ(OK, rv); | 7491 EXPECT_EQ(OK, rv); |
| 7491 } | 7492 } |
| 7492 | 7493 |
| 7493 TEST_P(HttpNetworkTransactionTest, BuildRequest_CacheControlNoCache) { | 7494 TEST_P(HttpNetworkTransactionTest, BuildRequest_CacheControlNoCache) { |
| 7494 HttpRequestInfo request; | 7495 HttpRequestInfo request; |
| 7495 request.method = "GET"; | 7496 request.method = "GET"; |
| 7496 request.url = GURL("http://www.example.org/"); | 7497 request.url = GURL("http://www.example.org/"); |
| 7497 request.load_flags = LOAD_BYPASS_CACHE; | 7498 request.load_flags = LOAD_BYPASS_CACHE; |
| 7498 | 7499 |
| 7499 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7500 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7500 scoped_ptr<HttpTransaction> trans( | 7501 scoped_ptr<HttpTransaction> trans( |
| 7501 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7502 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7502 | 7503 |
| 7503 MockWrite data_writes[] = { | 7504 MockWrite data_writes[] = { |
| 7504 MockWrite( | 7505 MockWrite( |
| 7505 "GET / HTTP/1.1\r\n" | 7506 "GET / HTTP/1.1\r\n" |
| 7506 "Host: www.example.org\r\n" | 7507 "Host: www.example.org\r\n" |
| 7507 "Connection: keep-alive\r\n" | 7508 "Connection: keep-alive\r\n" |
| 7508 "Pragma: no-cache\r\n" | 7509 "Pragma: no-cache\r\n" |
| 7509 "Cache-Control: no-cache\r\n\r\n"), | 7510 "Cache-Control: no-cache\r\n\r\n"), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 7530 EXPECT_EQ(OK, rv); | 7531 EXPECT_EQ(OK, rv); |
| 7531 } | 7532 } |
| 7532 | 7533 |
| 7533 TEST_P(HttpNetworkTransactionTest, | 7534 TEST_P(HttpNetworkTransactionTest, |
| 7534 BuildRequest_CacheControlValidateCache) { | 7535 BuildRequest_CacheControlValidateCache) { |
| 7535 HttpRequestInfo request; | 7536 HttpRequestInfo request; |
| 7536 request.method = "GET"; | 7537 request.method = "GET"; |
| 7537 request.url = GURL("http://www.example.org/"); | 7538 request.url = GURL("http://www.example.org/"); |
| 7538 request.load_flags = LOAD_VALIDATE_CACHE; | 7539 request.load_flags = LOAD_VALIDATE_CACHE; |
| 7539 | 7540 |
| 7540 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7541 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7541 scoped_ptr<HttpTransaction> trans( | 7542 scoped_ptr<HttpTransaction> trans( |
| 7542 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7543 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7543 | 7544 |
| 7544 MockWrite data_writes[] = { | 7545 MockWrite data_writes[] = { |
| 7545 MockWrite( | 7546 MockWrite( |
| 7546 "GET / HTTP/1.1\r\n" | 7547 "GET / HTTP/1.1\r\n" |
| 7547 "Host: www.example.org\r\n" | 7548 "Host: www.example.org\r\n" |
| 7548 "Connection: keep-alive\r\n" | 7549 "Connection: keep-alive\r\n" |
| 7549 "Cache-Control: max-age=0\r\n\r\n"), | 7550 "Cache-Control: max-age=0\r\n\r\n"), |
| 7550 }; | 7551 }; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 7569 rv = callback.WaitForResult(); | 7570 rv = callback.WaitForResult(); |
| 7570 EXPECT_EQ(OK, rv); | 7571 EXPECT_EQ(OK, rv); |
| 7571 } | 7572 } |
| 7572 | 7573 |
| 7573 TEST_P(HttpNetworkTransactionTest, BuildRequest_ExtraHeaders) { | 7574 TEST_P(HttpNetworkTransactionTest, BuildRequest_ExtraHeaders) { |
| 7574 HttpRequestInfo request; | 7575 HttpRequestInfo request; |
| 7575 request.method = "GET"; | 7576 request.method = "GET"; |
| 7576 request.url = GURL("http://www.example.org/"); | 7577 request.url = GURL("http://www.example.org/"); |
| 7577 request.extra_headers.SetHeader("FooHeader", "Bar"); | 7578 request.extra_headers.SetHeader("FooHeader", "Bar"); |
| 7578 | 7579 |
| 7579 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7580 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7580 scoped_ptr<HttpTransaction> trans( | 7581 scoped_ptr<HttpTransaction> trans( |
| 7581 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7582 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7582 | 7583 |
| 7583 MockWrite data_writes[] = { | 7584 MockWrite data_writes[] = { |
| 7584 MockWrite( | 7585 MockWrite( |
| 7585 "GET / HTTP/1.1\r\n" | 7586 "GET / HTTP/1.1\r\n" |
| 7586 "Host: www.example.org\r\n" | 7587 "Host: www.example.org\r\n" |
| 7587 "Connection: keep-alive\r\n" | 7588 "Connection: keep-alive\r\n" |
| 7588 "FooHeader: Bar\r\n\r\n"), | 7589 "FooHeader: Bar\r\n\r\n"), |
| 7589 }; | 7590 }; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 7610 } | 7611 } |
| 7611 | 7612 |
| 7612 TEST_P(HttpNetworkTransactionTest, BuildRequest_ExtraHeadersStripped) { | 7613 TEST_P(HttpNetworkTransactionTest, BuildRequest_ExtraHeadersStripped) { |
| 7613 HttpRequestInfo request; | 7614 HttpRequestInfo request; |
| 7614 request.method = "GET"; | 7615 request.method = "GET"; |
| 7615 request.url = GURL("http://www.example.org/"); | 7616 request.url = GURL("http://www.example.org/"); |
| 7616 request.extra_headers.SetHeader("referer", "www.foo.com"); | 7617 request.extra_headers.SetHeader("referer", "www.foo.com"); |
| 7617 request.extra_headers.SetHeader("hEllo", "Kitty"); | 7618 request.extra_headers.SetHeader("hEllo", "Kitty"); |
| 7618 request.extra_headers.SetHeader("FoO", "bar"); | 7619 request.extra_headers.SetHeader("FoO", "bar"); |
| 7619 | 7620 |
| 7620 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7621 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7621 scoped_ptr<HttpTransaction> trans( | 7622 scoped_ptr<HttpTransaction> trans( |
| 7622 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7623 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7623 | 7624 |
| 7624 MockWrite data_writes[] = { | 7625 MockWrite data_writes[] = { |
| 7625 MockWrite( | 7626 MockWrite( |
| 7626 "GET / HTTP/1.1\r\n" | 7627 "GET / HTTP/1.1\r\n" |
| 7627 "Host: www.example.org\r\n" | 7628 "Host: www.example.org\r\n" |
| 7628 "Connection: keep-alive\r\n" | 7629 "Connection: keep-alive\r\n" |
| 7629 "referer: www.foo.com\r\n" | 7630 "referer: www.foo.com\r\n" |
| 7630 "hEllo: Kitty\r\n" | 7631 "hEllo: Kitty\r\n" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 7656 HttpRequestInfo request; | 7657 HttpRequestInfo request; |
| 7657 request.method = "GET"; | 7658 request.method = "GET"; |
| 7658 request.url = GURL("http://www.example.org/"); | 7659 request.url = GURL("http://www.example.org/"); |
| 7659 request.load_flags = 0; | 7660 request.load_flags = 0; |
| 7660 | 7661 |
| 7661 session_deps_.proxy_service = | 7662 session_deps_.proxy_service = |
| 7662 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"); | 7663 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"); |
| 7663 TestNetLog net_log; | 7664 TestNetLog net_log; |
| 7664 session_deps_.net_log = &net_log; | 7665 session_deps_.net_log = &net_log; |
| 7665 | 7666 |
| 7666 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7667 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7667 scoped_ptr<HttpTransaction> trans( | 7668 scoped_ptr<HttpTransaction> trans( |
| 7668 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7669 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7669 | 7670 |
| 7670 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; | 7671 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
| 7671 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7672 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7672 | 7673 |
| 7673 MockWrite data_writes[] = { | 7674 MockWrite data_writes[] = { |
| 7674 MockWrite(ASYNC, write_buffer, arraysize(write_buffer)), | 7675 MockWrite(ASYNC, write_buffer, arraysize(write_buffer)), |
| 7675 MockWrite( | 7676 MockWrite( |
| 7676 "GET / HTTP/1.1\r\n" | 7677 "GET / HTTP/1.1\r\n" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7715 HttpRequestInfo request; | 7716 HttpRequestInfo request; |
| 7716 request.method = "GET"; | 7717 request.method = "GET"; |
| 7717 request.url = GURL("https://www.example.org/"); | 7718 request.url = GURL("https://www.example.org/"); |
| 7718 request.load_flags = 0; | 7719 request.load_flags = 0; |
| 7719 | 7720 |
| 7720 session_deps_.proxy_service = | 7721 session_deps_.proxy_service = |
| 7721 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"); | 7722 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080"); |
| 7722 TestNetLog net_log; | 7723 TestNetLog net_log; |
| 7723 session_deps_.net_log = &net_log; | 7724 session_deps_.net_log = &net_log; |
| 7724 | 7725 |
| 7725 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7726 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7726 scoped_ptr<HttpTransaction> trans( | 7727 scoped_ptr<HttpTransaction> trans( |
| 7727 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7728 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7728 | 7729 |
| 7729 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; | 7730 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; |
| 7730 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7731 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7731 | 7732 |
| 7732 MockWrite data_writes[] = { | 7733 MockWrite data_writes[] = { |
| 7733 MockWrite(ASYNC, reinterpret_cast<char*>(write_buffer), | 7734 MockWrite(ASYNC, reinterpret_cast<char*>(write_buffer), |
| 7734 arraysize(write_buffer)), | 7735 arraysize(write_buffer)), |
| 7735 MockWrite( | 7736 MockWrite( |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7779 HttpRequestInfo request; | 7780 HttpRequestInfo request; |
| 7780 request.method = "GET"; | 7781 request.method = "GET"; |
| 7781 request.url = GURL("http://www.example.org/"); | 7782 request.url = GURL("http://www.example.org/"); |
| 7782 request.load_flags = 0; | 7783 request.load_flags = 0; |
| 7783 | 7784 |
| 7784 session_deps_.proxy_service = | 7785 session_deps_.proxy_service = |
| 7785 ProxyService::CreateFixed("socks4://myproxy:1080"); | 7786 ProxyService::CreateFixed("socks4://myproxy:1080"); |
| 7786 TestNetLog net_log; | 7787 TestNetLog net_log; |
| 7787 session_deps_.net_log = &net_log; | 7788 session_deps_.net_log = &net_log; |
| 7788 | 7789 |
| 7789 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7790 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7790 scoped_ptr<HttpTransaction> trans( | 7791 scoped_ptr<HttpTransaction> trans( |
| 7791 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7792 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7792 | 7793 |
| 7793 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; | 7794 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
| 7794 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7795 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7795 | 7796 |
| 7796 MockWrite data_writes[] = { | 7797 MockWrite data_writes[] = { |
| 7797 MockWrite(ASYNC, write_buffer, arraysize(write_buffer)), | 7798 MockWrite(ASYNC, write_buffer, arraysize(write_buffer)), |
| 7798 MockWrite( | 7799 MockWrite( |
| 7799 "GET / HTTP/1.1\r\n" | 7800 "GET / HTTP/1.1\r\n" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7838 HttpRequestInfo request; | 7839 HttpRequestInfo request; |
| 7839 request.method = "GET"; | 7840 request.method = "GET"; |
| 7840 request.url = GURL("http://www.example.org/"); | 7841 request.url = GURL("http://www.example.org/"); |
| 7841 request.load_flags = 0; | 7842 request.load_flags = 0; |
| 7842 | 7843 |
| 7843 session_deps_.proxy_service = | 7844 session_deps_.proxy_service = |
| 7844 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"); | 7845 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"); |
| 7845 TestNetLog net_log; | 7846 TestNetLog net_log; |
| 7846 session_deps_.net_log = &net_log; | 7847 session_deps_.net_log = &net_log; |
| 7847 | 7848 |
| 7848 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7849 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7849 scoped_ptr<HttpTransaction> trans( | 7850 scoped_ptr<HttpTransaction> trans( |
| 7850 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7851 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7851 | 7852 |
| 7852 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; | 7853 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
| 7853 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; | 7854 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
| 7854 const char kSOCKS5OkRequest[] = { | 7855 const char kSOCKS5OkRequest[] = { |
| 7855 0x05, // Version | 7856 0x05, // Version |
| 7856 0x01, // Command (CONNECT) | 7857 0x01, // Command (CONNECT) |
| 7857 0x00, // Reserved. | 7858 0x00, // Reserved. |
| 7858 0x03, // Address type (DOMAINNAME). | 7859 0x03, // Address type (DOMAINNAME). |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7910 HttpRequestInfo request; | 7911 HttpRequestInfo request; |
| 7911 request.method = "GET"; | 7912 request.method = "GET"; |
| 7912 request.url = GURL("https://www.example.org/"); | 7913 request.url = GURL("https://www.example.org/"); |
| 7913 request.load_flags = 0; | 7914 request.load_flags = 0; |
| 7914 | 7915 |
| 7915 session_deps_.proxy_service = | 7916 session_deps_.proxy_service = |
| 7916 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"); | 7917 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080"); |
| 7917 TestNetLog net_log; | 7918 TestNetLog net_log; |
| 7918 session_deps_.net_log = &net_log; | 7919 session_deps_.net_log = &net_log; |
| 7919 | 7920 |
| 7920 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7921 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7921 scoped_ptr<HttpTransaction> trans( | 7922 scoped_ptr<HttpTransaction> trans( |
| 7922 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7923 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7923 | 7924 |
| 7924 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; | 7925 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
| 7925 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; | 7926 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
| 7926 const unsigned char kSOCKS5OkRequest[] = { | 7927 const unsigned char kSOCKS5OkRequest[] = { |
| 7927 0x05, // Version | 7928 0x05, // Version |
| 7928 0x01, // Command (CONNECT) | 7929 0x01, // Command (CONNECT) |
| 7929 0x00, // Reserved. | 7930 0x00, // Reserved. |
| 7930 0x03, // Address type (DOMAINNAME). | 7931 0x03, // Address type (DOMAINNAME). |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7987 | 7988 |
| 7988 // Tests that for connection endpoints the group names are correctly set. | 7989 // Tests that for connection endpoints the group names are correctly set. |
| 7989 | 7990 |
| 7990 struct GroupNameTest { | 7991 struct GroupNameTest { |
| 7991 std::string proxy_server; | 7992 std::string proxy_server; |
| 7992 std::string url; | 7993 std::string url; |
| 7993 std::string expected_group_name; | 7994 std::string expected_group_name; |
| 7994 bool ssl; | 7995 bool ssl; |
| 7995 }; | 7996 }; |
| 7996 | 7997 |
| 7997 scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests( | 7998 scoped_ptr<HttpNetworkSession> SetupSessionForGroupNameTests( |
| 7998 NextProto next_proto, | 7999 NextProto next_proto, |
| 7999 SpdySessionDependencies* session_deps_) { | 8000 SpdySessionDependencies* session_deps_) { |
| 8000 scoped_refptr<HttpNetworkSession> session(CreateSession(session_deps_)); | 8001 scoped_ptr<HttpNetworkSession> session(CreateSession(session_deps_)); |
| 8001 | 8002 |
| 8002 base::WeakPtr<HttpServerProperties> http_server_properties = | 8003 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 8003 session->http_server_properties(); | 8004 session->http_server_properties(); |
| 8004 AlternativeService alternative_service( | 8005 AlternativeService alternative_service( |
| 8005 AlternateProtocolFromNextProto(next_proto), "", 443); | 8006 AlternateProtocolFromNextProto(next_proto), "", 443); |
| 8006 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 8007 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 8007 http_server_properties->SetAlternativeService( | 8008 http_server_properties->SetAlternativeService( |
| 8008 HostPortPair("host.with.alternate", 80), alternative_service, 1.0, | 8009 HostPortPair("host.with.alternate", 80), alternative_service, 1.0, |
| 8009 expiration); | 8010 expiration); |
| 8010 | 8011 |
| 8011 return session; | 8012 return session; |
| 8012 } | 8013 } |
| 8013 | 8014 |
| 8014 int GroupNameTransactionHelper( | 8015 int GroupNameTransactionHelper(const std::string& url, |
| 8015 const std::string& url, | 8016 HttpNetworkSession* session) { |
| 8016 const scoped_refptr<HttpNetworkSession>& session) { | |
| 8017 HttpRequestInfo request; | 8017 HttpRequestInfo request; |
| 8018 request.method = "GET"; | 8018 request.method = "GET"; |
| 8019 request.url = GURL(url); | 8019 request.url = GURL(url); |
| 8020 request.load_flags = 0; | 8020 request.load_flags = 0; |
| 8021 | 8021 |
| 8022 scoped_ptr<HttpTransaction> trans( | 8022 scoped_ptr<HttpTransaction> trans( |
| 8023 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8023 new HttpNetworkTransaction(DEFAULT_PRIORITY, session)); |
| 8024 | 8024 |
| 8025 TestCompletionCallback callback; | 8025 TestCompletionCallback callback; |
| 8026 | 8026 |
| 8027 // We do not complete this request, the dtor will clean the transaction up. | 8027 // We do not complete this request, the dtor will clean the transaction up. |
| 8028 return trans->Start(&request, callback.callback(), BoundNetLog()); | 8028 return trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8029 } | 8029 } |
| 8030 | 8030 |
| 8031 } // namespace | 8031 } // namespace |
| 8032 | 8032 |
| 8033 TEST_P(HttpNetworkTransactionTest, GroupNameForDirectConnections) { | 8033 TEST_P(HttpNetworkTransactionTest, GroupNameForDirectConnections) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 8064 "ssl/host.with.alternate:443", | 8064 "ssl/host.with.alternate:443", |
| 8065 true, | 8065 true, |
| 8066 }, | 8066 }, |
| 8067 }; | 8067 }; |
| 8068 | 8068 |
| 8069 session_deps_.use_alternative_services = true; | 8069 session_deps_.use_alternative_services = true; |
| 8070 | 8070 |
| 8071 for (size_t i = 0; i < arraysize(tests); ++i) { | 8071 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 8072 session_deps_.proxy_service = | 8072 session_deps_.proxy_service = |
| 8073 ProxyService::CreateFixed(tests[i].proxy_server); | 8073 ProxyService::CreateFixed(tests[i].proxy_server); |
| 8074 scoped_refptr<HttpNetworkSession> session( | 8074 scoped_ptr<HttpNetworkSession> session( |
| 8075 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 8075 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 8076 | 8076 |
| 8077 HttpNetworkSessionPeer peer(session); | 8077 HttpNetworkSessionPeer peer(session.get()); |
| 8078 CaptureGroupNameTransportSocketPool* transport_conn_pool = | 8078 CaptureGroupNameTransportSocketPool* transport_conn_pool = |
| 8079 new CaptureGroupNameTransportSocketPool(NULL, NULL); | 8079 new CaptureGroupNameTransportSocketPool(NULL, NULL); |
| 8080 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 8080 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 8081 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 8081 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| 8082 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( | 8082 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( |
| 8083 new MockClientSocketPoolManager); | 8083 new MockClientSocketPoolManager); |
| 8084 mock_pool_manager->SetTransportSocketPool(transport_conn_pool); | 8084 mock_pool_manager->SetTransportSocketPool(transport_conn_pool); |
| 8085 mock_pool_manager->SetSSLSocketPool(ssl_conn_pool); | 8085 mock_pool_manager->SetSSLSocketPool(ssl_conn_pool); |
| 8086 peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); | 8086 peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); |
| 8087 | 8087 |
| 8088 EXPECT_EQ(ERR_IO_PENDING, | 8088 EXPECT_EQ(ERR_IO_PENDING, |
| 8089 GroupNameTransactionHelper(tests[i].url, session)); | 8089 GroupNameTransactionHelper(tests[i].url, session.get())); |
| 8090 if (tests[i].ssl) | 8090 if (tests[i].ssl) |
| 8091 EXPECT_EQ(tests[i].expected_group_name, | 8091 EXPECT_EQ(tests[i].expected_group_name, |
| 8092 ssl_conn_pool->last_group_name_received()); | 8092 ssl_conn_pool->last_group_name_received()); |
| 8093 else | 8093 else |
| 8094 EXPECT_EQ(tests[i].expected_group_name, | 8094 EXPECT_EQ(tests[i].expected_group_name, |
| 8095 transport_conn_pool->last_group_name_received()); | 8095 transport_conn_pool->last_group_name_received()); |
| 8096 } | 8096 } |
| 8097 } | 8097 } |
| 8098 | 8098 |
| 8099 TEST_P(HttpNetworkTransactionTest, GroupNameForHTTPProxyConnections) { | 8099 TEST_P(HttpNetworkTransactionTest, GroupNameForHTTPProxyConnections) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 8126 "ftp/ftp.google.com:21", | 8126 "ftp/ftp.google.com:21", |
| 8127 false, | 8127 false, |
| 8128 }, | 8128 }, |
| 8129 }; | 8129 }; |
| 8130 | 8130 |
| 8131 session_deps_.use_alternative_services = true; | 8131 session_deps_.use_alternative_services = true; |
| 8132 | 8132 |
| 8133 for (size_t i = 0; i < arraysize(tests); ++i) { | 8133 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 8134 session_deps_.proxy_service = | 8134 session_deps_.proxy_service = |
| 8135 ProxyService::CreateFixed(tests[i].proxy_server); | 8135 ProxyService::CreateFixed(tests[i].proxy_server); |
| 8136 scoped_refptr<HttpNetworkSession> session( | 8136 scoped_ptr<HttpNetworkSession> session( |
| 8137 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 8137 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 8138 | 8138 |
| 8139 HttpNetworkSessionPeer peer(session); | 8139 HttpNetworkSessionPeer peer(session.get()); |
| 8140 | 8140 |
| 8141 HostPortPair proxy_host("http_proxy", 80); | 8141 HostPortPair proxy_host("http_proxy", 80); |
| 8142 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = | 8142 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = |
| 8143 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); | 8143 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); |
| 8144 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 8144 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 8145 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 8145 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| 8146 | 8146 |
| 8147 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( | 8147 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( |
| 8148 new MockClientSocketPoolManager); | 8148 new MockClientSocketPoolManager); |
| 8149 mock_pool_manager->SetSocketPoolForHTTPProxy(proxy_host, http_proxy_pool); | 8149 mock_pool_manager->SetSocketPoolForHTTPProxy(proxy_host, http_proxy_pool); |
| 8150 mock_pool_manager->SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool); | 8150 mock_pool_manager->SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool); |
| 8151 peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); | 8151 peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); |
| 8152 | 8152 |
| 8153 EXPECT_EQ(ERR_IO_PENDING, | 8153 EXPECT_EQ(ERR_IO_PENDING, |
| 8154 GroupNameTransactionHelper(tests[i].url, session)); | 8154 GroupNameTransactionHelper(tests[i].url, session.get())); |
| 8155 if (tests[i].ssl) | 8155 if (tests[i].ssl) |
| 8156 EXPECT_EQ(tests[i].expected_group_name, | 8156 EXPECT_EQ(tests[i].expected_group_name, |
| 8157 ssl_conn_pool->last_group_name_received()); | 8157 ssl_conn_pool->last_group_name_received()); |
| 8158 else | 8158 else |
| 8159 EXPECT_EQ(tests[i].expected_group_name, | 8159 EXPECT_EQ(tests[i].expected_group_name, |
| 8160 http_proxy_pool->last_group_name_received()); | 8160 http_proxy_pool->last_group_name_received()); |
| 8161 } | 8161 } |
| 8162 } | 8162 } |
| 8163 | 8163 |
| 8164 TEST_P(HttpNetworkTransactionTest, GroupNameForSOCKSConnections) { | 8164 TEST_P(HttpNetworkTransactionTest, GroupNameForSOCKSConnections) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8196 "socks4/ssl/host.with.alternate:443", | 8196 "socks4/ssl/host.with.alternate:443", |
| 8197 true, | 8197 true, |
| 8198 }, | 8198 }, |
| 8199 }; | 8199 }; |
| 8200 | 8200 |
| 8201 session_deps_.use_alternative_services = true; | 8201 session_deps_.use_alternative_services = true; |
| 8202 | 8202 |
| 8203 for (size_t i = 0; i < arraysize(tests); ++i) { | 8203 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 8204 session_deps_.proxy_service = | 8204 session_deps_.proxy_service = |
| 8205 ProxyService::CreateFixed(tests[i].proxy_server); | 8205 ProxyService::CreateFixed(tests[i].proxy_server); |
| 8206 scoped_refptr<HttpNetworkSession> session( | 8206 scoped_ptr<HttpNetworkSession> session( |
| 8207 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 8207 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 8208 | 8208 |
| 8209 HttpNetworkSessionPeer peer(session); | 8209 HttpNetworkSessionPeer peer(session.get()); |
| 8210 | 8210 |
| 8211 HostPortPair proxy_host("socks_proxy", 1080); | 8211 HostPortPair proxy_host("socks_proxy", 1080); |
| 8212 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = | 8212 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = |
| 8213 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); | 8213 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); |
| 8214 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 8214 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 8215 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 8215 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| 8216 | 8216 |
| 8217 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( | 8217 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( |
| 8218 new MockClientSocketPoolManager); | 8218 new MockClientSocketPoolManager); |
| 8219 mock_pool_manager->SetSocketPoolForSOCKSProxy(proxy_host, socks_conn_pool); | 8219 mock_pool_manager->SetSocketPoolForSOCKSProxy(proxy_host, socks_conn_pool); |
| 8220 mock_pool_manager->SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool); | 8220 mock_pool_manager->SetSocketPoolForSSLWithProxy(proxy_host, ssl_conn_pool); |
| 8221 peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); | 8221 peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); |
| 8222 | 8222 |
| 8223 scoped_ptr<HttpTransaction> trans( | 8223 scoped_ptr<HttpTransaction> trans( |
| 8224 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8224 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8225 | 8225 |
| 8226 EXPECT_EQ(ERR_IO_PENDING, | 8226 EXPECT_EQ(ERR_IO_PENDING, |
| 8227 GroupNameTransactionHelper(tests[i].url, session)); | 8227 GroupNameTransactionHelper(tests[i].url, session.get())); |
| 8228 if (tests[i].ssl) | 8228 if (tests[i].ssl) |
| 8229 EXPECT_EQ(tests[i].expected_group_name, | 8229 EXPECT_EQ(tests[i].expected_group_name, |
| 8230 ssl_conn_pool->last_group_name_received()); | 8230 ssl_conn_pool->last_group_name_received()); |
| 8231 else | 8231 else |
| 8232 EXPECT_EQ(tests[i].expected_group_name, | 8232 EXPECT_EQ(tests[i].expected_group_name, |
| 8233 socks_conn_pool->last_group_name_received()); | 8233 socks_conn_pool->last_group_name_received()); |
| 8234 } | 8234 } |
| 8235 } | 8235 } |
| 8236 | 8236 |
| 8237 TEST_P(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) { | 8237 TEST_P(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) { |
| 8238 HttpRequestInfo request; | 8238 HttpRequestInfo request; |
| 8239 request.method = "GET"; | 8239 request.method = "GET"; |
| 8240 request.url = GURL("http://www.example.org/"); | 8240 request.url = GURL("http://www.example.org/"); |
| 8241 | 8241 |
| 8242 session_deps_.proxy_service = | 8242 session_deps_.proxy_service = |
| 8243 ProxyService::CreateFixed("myproxy:70;foobar:80"); | 8243 ProxyService::CreateFixed("myproxy:70;foobar:80"); |
| 8244 | 8244 |
| 8245 // This simulates failure resolving all hostnames; that means we will fail | 8245 // This simulates failure resolving all hostnames; that means we will fail |
| 8246 // connecting to both proxies (myproxy:70 and foobar:80). | 8246 // connecting to both proxies (myproxy:70 and foobar:80). |
| 8247 session_deps_.host_resolver->rules()->AddSimulatedFailure("*"); | 8247 session_deps_.host_resolver->rules()->AddSimulatedFailure("*"); |
| 8248 | 8248 |
| 8249 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8249 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8250 scoped_ptr<HttpTransaction> trans( | 8250 scoped_ptr<HttpTransaction> trans( |
| 8251 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8251 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8252 | 8252 |
| 8253 TestCompletionCallback callback; | 8253 TestCompletionCallback callback; |
| 8254 | 8254 |
| 8255 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8255 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8256 EXPECT_EQ(ERR_IO_PENDING, rv); | 8256 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8257 | 8257 |
| 8258 rv = callback.WaitForResult(); | 8258 rv = callback.WaitForResult(); |
| 8259 EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, rv); | 8259 EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, rv); |
| 8260 } | 8260 } |
| 8261 | 8261 |
| 8262 // Base test to make sure that when the load flags for a request specify to | 8262 // Base test to make sure that when the load flags for a request specify to |
| 8263 // bypass the cache, the DNS cache is not used. | 8263 // bypass the cache, the DNS cache is not used. |
| 8264 void HttpNetworkTransactionTest::BypassHostCacheOnRefreshHelper( | 8264 void HttpNetworkTransactionTest::BypassHostCacheOnRefreshHelper( |
| 8265 int load_flags) { | 8265 int load_flags) { |
| 8266 // Issue a request, asking to bypass the cache(s). | 8266 // Issue a request, asking to bypass the cache(s). |
| 8267 HttpRequestInfo request; | 8267 HttpRequestInfo request; |
| 8268 request.method = "GET"; | 8268 request.method = "GET"; |
| 8269 request.load_flags = load_flags; | 8269 request.load_flags = load_flags; |
| 8270 request.url = GURL("http://www.example.org/"); | 8270 request.url = GURL("http://www.example.org/"); |
| 8271 | 8271 |
| 8272 // Select a host resolver that does caching. | 8272 // Select a host resolver that does caching. |
| 8273 session_deps_.host_resolver.reset(new MockCachingHostResolver); | 8273 session_deps_.host_resolver.reset(new MockCachingHostResolver); |
| 8274 | 8274 |
| 8275 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8275 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8276 scoped_ptr<HttpTransaction> trans( | 8276 scoped_ptr<HttpTransaction> trans( |
| 8277 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8277 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8278 | 8278 |
| 8279 // Warm up the host cache so it has an entry for "www.example.org". | 8279 // Warm up the host cache so it has an entry for "www.example.org". |
| 8280 AddressList addrlist; | 8280 AddressList addrlist; |
| 8281 TestCompletionCallback callback; | 8281 TestCompletionCallback callback; |
| 8282 int rv = session_deps_.host_resolver->Resolve( | 8282 int rv = session_deps_.host_resolver->Resolve( |
| 8283 HostResolver::RequestInfo(HostPortPair("www.example.org", 80)), | 8283 HostResolver::RequestInfo(HostPortPair("www.example.org", 80)), |
| 8284 DEFAULT_PRIORITY, &addrlist, callback.callback(), NULL, BoundNetLog()); | 8284 DEFAULT_PRIORITY, &addrlist, callback.callback(), NULL, BoundNetLog()); |
| 8285 EXPECT_EQ(ERR_IO_PENDING, rv); | 8285 EXPECT_EQ(ERR_IO_PENDING, rv); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8334 request.method = "GET"; | 8334 request.method = "GET"; |
| 8335 request.url = GURL("http://www.foo.com/"); | 8335 request.url = GURL("http://www.foo.com/"); |
| 8336 request.load_flags = 0; | 8336 request.load_flags = 0; |
| 8337 | 8337 |
| 8338 MockWrite write_failure[] = { | 8338 MockWrite write_failure[] = { |
| 8339 MockWrite(ASYNC, ERR_CONNECTION_RESET), | 8339 MockWrite(ASYNC, ERR_CONNECTION_RESET), |
| 8340 }; | 8340 }; |
| 8341 StaticSocketDataProvider data(NULL, 0, | 8341 StaticSocketDataProvider data(NULL, 0, |
| 8342 write_failure, arraysize(write_failure)); | 8342 write_failure, arraysize(write_failure)); |
| 8343 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8343 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8344 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8344 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8345 | 8345 |
| 8346 TestCompletionCallback callback; | 8346 TestCompletionCallback callback; |
| 8347 | 8347 |
| 8348 scoped_ptr<HttpTransaction> trans( | 8348 scoped_ptr<HttpTransaction> trans( |
| 8349 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8349 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8350 | 8350 |
| 8351 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8351 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8352 EXPECT_EQ(ERR_IO_PENDING, rv); | 8352 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8353 | 8353 |
| 8354 rv = callback.WaitForResult(); | 8354 rv = callback.WaitForResult(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 8366 request.url = GURL("http://www.foo.com/"); | 8366 request.url = GURL("http://www.foo.com/"); |
| 8367 request.load_flags = 0; | 8367 request.load_flags = 0; |
| 8368 | 8368 |
| 8369 MockRead data_reads[] = { | 8369 MockRead data_reads[] = { |
| 8370 MockRead("HTTP/1."), | 8370 MockRead("HTTP/1."), |
| 8371 MockRead(SYNCHRONOUS, OK), | 8371 MockRead(SYNCHRONOUS, OK), |
| 8372 }; | 8372 }; |
| 8373 | 8373 |
| 8374 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 8374 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 8375 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8375 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8376 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8376 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8377 | 8377 |
| 8378 TestCompletionCallback callback; | 8378 TestCompletionCallback callback; |
| 8379 | 8379 |
| 8380 scoped_ptr<HttpTransaction> trans( | 8380 scoped_ptr<HttpTransaction> trans( |
| 8381 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8381 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8382 | 8382 |
| 8383 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8383 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8384 EXPECT_EQ(ERR_IO_PENDING, rv); | 8384 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8385 | 8385 |
| 8386 rv = callback.WaitForResult(); | 8386 rv = callback.WaitForResult(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8444 MockRead data_reads2[] = { | 8444 MockRead data_reads2[] = { |
| 8445 MockRead("HTTP/1.1 200 OK\r\n"), | 8445 MockRead("HTTP/1.1 200 OK\r\n"), |
| 8446 MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"), | 8446 MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"), |
| 8447 MockRead("Content-Length: 100\r\n\r\n"), | 8447 MockRead("Content-Length: 100\r\n\r\n"), |
| 8448 MockRead(SYNCHRONOUS, OK), | 8448 MockRead(SYNCHRONOUS, OK), |
| 8449 }; | 8449 }; |
| 8450 | 8450 |
| 8451 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 8451 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 8452 data_writes2, arraysize(data_writes2)); | 8452 data_writes2, arraysize(data_writes2)); |
| 8453 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 8453 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
| 8454 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8454 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8455 | 8455 |
| 8456 TestCompletionCallback callback1; | 8456 TestCompletionCallback callback1; |
| 8457 | 8457 |
| 8458 scoped_ptr<HttpTransaction> trans( | 8458 scoped_ptr<HttpTransaction> trans( |
| 8459 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8459 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8460 | 8460 |
| 8461 int rv = trans->Start(&request, callback1.callback(), BoundNetLog()); | 8461 int rv = trans->Start(&request, callback1.callback(), BoundNetLog()); |
| 8462 EXPECT_EQ(ERR_IO_PENDING, rv); | 8462 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8463 | 8463 |
| 8464 rv = callback1.WaitForResult(); | 8464 rv = callback1.WaitForResult(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8500 StaticSocketDataProvider data(proxy_reads, arraysize(proxy_reads), NULL, 0); | 8500 StaticSocketDataProvider data(proxy_reads, arraysize(proxy_reads), NULL, 0); |
| 8501 SSLSocketDataProvider ssl(ASYNC, OK); | 8501 SSLSocketDataProvider ssl(ASYNC, OK); |
| 8502 | 8502 |
| 8503 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8503 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8504 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 8504 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 8505 | 8505 |
| 8506 TestCompletionCallback callback; | 8506 TestCompletionCallback callback; |
| 8507 | 8507 |
| 8508 session_deps_.socket_factory->ResetNextMockIndexes(); | 8508 session_deps_.socket_factory->ResetNextMockIndexes(); |
| 8509 | 8509 |
| 8510 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8510 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8511 scoped_ptr<HttpTransaction> trans( | 8511 scoped_ptr<HttpTransaction> trans( |
| 8512 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8512 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8513 | 8513 |
| 8514 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8514 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8515 EXPECT_EQ(ERR_IO_PENDING, rv); | 8515 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8516 | 8516 |
| 8517 rv = callback.WaitForResult(); | 8517 rv = callback.WaitForResult(); |
| 8518 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 8518 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 8519 } | 8519 } |
| 8520 | 8520 |
| 8521 TEST_P(HttpNetworkTransactionTest, LargeContentLengthThenClose) { | 8521 TEST_P(HttpNetworkTransactionTest, LargeContentLengthThenClose) { |
| 8522 HttpRequestInfo request; | 8522 HttpRequestInfo request; |
| 8523 request.method = "GET"; | 8523 request.method = "GET"; |
| 8524 request.url = GURL("http://www.example.org/"); | 8524 request.url = GURL("http://www.example.org/"); |
| 8525 request.load_flags = 0; | 8525 request.load_flags = 0; |
| 8526 | 8526 |
| 8527 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8527 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8528 scoped_ptr<HttpTransaction> trans( | 8528 scoped_ptr<HttpTransaction> trans( |
| 8529 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8529 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8530 | 8530 |
| 8531 MockRead data_reads[] = { | 8531 MockRead data_reads[] = { |
| 8532 MockRead("HTTP/1.0 200 OK\r\nContent-Length:6719476739\r\n\r\n"), | 8532 MockRead("HTTP/1.0 200 OK\r\nContent-Length:6719476739\r\n\r\n"), |
| 8533 MockRead(SYNCHRONOUS, OK), | 8533 MockRead(SYNCHRONOUS, OK), |
| 8534 }; | 8534 }; |
| 8535 | 8535 |
| 8536 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 8536 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 8537 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8537 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 8566 new UploadFileElementReader(base::ThreadTaskRunnerHandle::Get().get(), | 8566 new UploadFileElementReader(base::ThreadTaskRunnerHandle::Get().get(), |
| 8567 temp_file_path, 0, kuint64max, base::Time())); | 8567 temp_file_path, 0, kuint64max, base::Time())); |
| 8568 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 8568 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 8569 | 8569 |
| 8570 HttpRequestInfo request; | 8570 HttpRequestInfo request; |
| 8571 request.method = "POST"; | 8571 request.method = "POST"; |
| 8572 request.url = GURL("http://www.example.org/upload"); | 8572 request.url = GURL("http://www.example.org/upload"); |
| 8573 request.upload_data_stream = &upload_data_stream; | 8573 request.upload_data_stream = &upload_data_stream; |
| 8574 request.load_flags = 0; | 8574 request.load_flags = 0; |
| 8575 | 8575 |
| 8576 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8576 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8577 scoped_ptr<HttpTransaction> trans( | 8577 scoped_ptr<HttpTransaction> trans( |
| 8578 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8578 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8579 | 8579 |
| 8580 MockRead data_reads[] = { | 8580 MockRead data_reads[] = { |
| 8581 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 8581 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
| 8582 MockRead("hello world"), | 8582 MockRead("hello world"), |
| 8583 MockRead(SYNCHRONOUS, OK), | 8583 MockRead(SYNCHRONOUS, OK), |
| 8584 }; | 8584 }; |
| 8585 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 8585 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 8586 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8586 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8621 temp_file, 0, kuint64max, base::Time())); | 8621 temp_file, 0, kuint64max, base::Time())); |
| 8622 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 8622 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 8623 | 8623 |
| 8624 HttpRequestInfo request; | 8624 HttpRequestInfo request; |
| 8625 request.method = "POST"; | 8625 request.method = "POST"; |
| 8626 request.url = GURL("http://www.example.org/upload"); | 8626 request.url = GURL("http://www.example.org/upload"); |
| 8627 request.upload_data_stream = &upload_data_stream; | 8627 request.upload_data_stream = &upload_data_stream; |
| 8628 request.load_flags = 0; | 8628 request.load_flags = 0; |
| 8629 | 8629 |
| 8630 // If we try to upload an unreadable file, the transaction should fail. | 8630 // If we try to upload an unreadable file, the transaction should fail. |
| 8631 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8631 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8632 scoped_ptr<HttpTransaction> trans( | 8632 scoped_ptr<HttpTransaction> trans( |
| 8633 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8633 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8634 | 8634 |
| 8635 StaticSocketDataProvider data(NULL, 0, NULL, 0); | 8635 StaticSocketDataProvider data(NULL, 0, NULL, 0); |
| 8636 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8636 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8637 | 8637 |
| 8638 TestCompletionCallback callback; | 8638 TestCompletionCallback callback; |
| 8639 | 8639 |
| 8640 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8640 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8641 EXPECT_EQ(ERR_IO_PENDING, rv); | 8641 EXPECT_EQ(ERR_IO_PENDING, rv); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8675 ScopedVector<UploadElementReader> element_readers; | 8675 ScopedVector<UploadElementReader> element_readers; |
| 8676 element_readers.push_back(fake_reader); | 8676 element_readers.push_back(fake_reader); |
| 8677 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 8677 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 8678 | 8678 |
| 8679 HttpRequestInfo request; | 8679 HttpRequestInfo request; |
| 8680 request.method = "POST"; | 8680 request.method = "POST"; |
| 8681 request.url = GURL("http://www.example.org/upload"); | 8681 request.url = GURL("http://www.example.org/upload"); |
| 8682 request.upload_data_stream = &upload_data_stream; | 8682 request.upload_data_stream = &upload_data_stream; |
| 8683 request.load_flags = 0; | 8683 request.load_flags = 0; |
| 8684 | 8684 |
| 8685 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8685 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8686 scoped_ptr<HttpTransaction> trans( | 8686 scoped_ptr<HttpTransaction> trans( |
| 8687 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8687 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8688 | 8688 |
| 8689 StaticSocketDataProvider data; | 8689 StaticSocketDataProvider data; |
| 8690 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8690 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8691 | 8691 |
| 8692 TestCompletionCallback callback; | 8692 TestCompletionCallback callback; |
| 8693 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8693 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8694 EXPECT_EQ(ERR_IO_PENDING, rv); | 8694 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8695 base::MessageLoop::current()->RunUntilIdle(); | 8695 base::MessageLoop::current()->RunUntilIdle(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8782 data_writes3, arraysize(data_writes3)); | 8782 data_writes3, arraysize(data_writes3)); |
| 8783 StaticSocketDataProvider data4(data_reads4, arraysize(data_reads4), | 8783 StaticSocketDataProvider data4(data_reads4, arraysize(data_reads4), |
| 8784 data_writes4, arraysize(data_writes4)); | 8784 data_writes4, arraysize(data_writes4)); |
| 8785 session_deps_.socket_factory->AddSocketDataProvider(&data1); | 8785 session_deps_.socket_factory->AddSocketDataProvider(&data1); |
| 8786 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 8786 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
| 8787 session_deps_.socket_factory->AddSocketDataProvider(&data3); | 8787 session_deps_.socket_factory->AddSocketDataProvider(&data3); |
| 8788 session_deps_.socket_factory->AddSocketDataProvider(&data4); | 8788 session_deps_.socket_factory->AddSocketDataProvider(&data4); |
| 8789 | 8789 |
| 8790 TestCompletionCallback callback1; | 8790 TestCompletionCallback callback1; |
| 8791 | 8791 |
| 8792 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8792 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8793 scoped_ptr<HttpTransaction> trans( | 8793 scoped_ptr<HttpTransaction> trans( |
| 8794 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8794 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8795 | 8795 |
| 8796 // Issue the first request with Authorize headers. There should be a | 8796 // Issue the first request with Authorize headers. There should be a |
| 8797 // password prompt for first_realm waiting to be filled in after the | 8797 // password prompt for first_realm waiting to be filled in after the |
| 8798 // transaction completes. | 8798 // transaction completes. |
| 8799 int rv = trans->Start(&request, callback1.callback(), BoundNetLog()); | 8799 int rv = trans->Start(&request, callback1.callback(), BoundNetLog()); |
| 8800 EXPECT_EQ(ERR_IO_PENDING, rv); | 8800 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8801 rv = callback1.WaitForResult(); | 8801 rv = callback1.WaitForResult(); |
| 8802 EXPECT_EQ(OK, rv); | 8802 EXPECT_EQ(OK, rv); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8877 request.method = "GET"; | 8877 request.method = "GET"; |
| 8878 request.url = GURL("http://www.example.org/"); | 8878 request.url = GURL("http://www.example.org/"); |
| 8879 request.load_flags = 0; | 8879 request.load_flags = 0; |
| 8880 | 8880 |
| 8881 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 8881 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 8882 | 8882 |
| 8883 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8883 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8884 | 8884 |
| 8885 TestCompletionCallback callback; | 8885 TestCompletionCallback callback; |
| 8886 | 8886 |
| 8887 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8887 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8888 scoped_ptr<HttpTransaction> trans( | 8888 scoped_ptr<HttpTransaction> trans( |
| 8889 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8889 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8890 | 8890 |
| 8891 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8891 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8892 EXPECT_EQ(ERR_IO_PENDING, rv); | 8892 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8893 | 8893 |
| 8894 HostPortPair http_host_port_pair("www.example.org", 80); | 8894 HostPortPair http_host_port_pair("www.example.org", 80); |
| 8895 HttpServerProperties& http_server_properties = | 8895 HttpServerProperties& http_server_properties = |
| 8896 *session->http_server_properties(); | 8896 *session->http_server_properties(); |
| 8897 AlternativeServiceVector alternative_service_vector = | 8897 AlternativeServiceVector alternative_service_vector = |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8941 request.method = "GET"; | 8941 request.method = "GET"; |
| 8942 request.url = GURL("http://www.example.org/"); | 8942 request.url = GURL("http://www.example.org/"); |
| 8943 request.load_flags = 0; | 8943 request.load_flags = 0; |
| 8944 | 8944 |
| 8945 StaticSocketDataProvider data(data_reads, arraysize(data_reads), nullptr, 0); | 8945 StaticSocketDataProvider data(data_reads, arraysize(data_reads), nullptr, 0); |
| 8946 | 8946 |
| 8947 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8947 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8948 | 8948 |
| 8949 TestCompletionCallback callback; | 8949 TestCompletionCallback callback; |
| 8950 | 8950 |
| 8951 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8951 scoped_ptr<HttpNetworkSession> session = CreateSession(&session_deps_); |
| 8952 scoped_ptr<HttpTransaction> trans( | 8952 scoped_ptr<HttpTransaction> trans( |
| 8953 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8953 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8954 | 8954 |
| 8955 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8955 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8956 EXPECT_EQ(ERR_IO_PENDING, rv); | 8956 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8957 | 8957 |
| 8958 HostPortPair http_host_port_pair("www.example.org", 80); | 8958 HostPortPair http_host_port_pair("www.example.org", 80); |
| 8959 HttpServerProperties& http_server_properties = | 8959 HttpServerProperties& http_server_properties = |
| 8960 *session->http_server_properties(); | 8960 *session->http_server_properties(); |
| 8961 AlternativeServiceVector alternative_service_vector = | 8961 AlternativeServiceVector alternative_service_vector = |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8998 request.method = "GET"; | 8998 request.method = "GET"; |
| 8999 request.url = GURL("http://www.example.org/"); | 8999 request.url = GURL("http://www.example.org/"); |
| 9000 request.load_flags = 0; | 9000 request.load_flags = 0; |
| 9001 | 9001 |
| 9002 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 9002 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 9003 | 9003 |
| 9004 session_deps_.socket_factory->AddSocketDataProvider(&data); | 9004 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 9005 | 9005 |
| 9006 TestCompletionCallback callback; | 9006 TestCompletionCallback callback; |
| 9007 | 9007 |
| 9008 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9008 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9009 scoped_ptr<HttpTransaction> trans( | 9009 scoped_ptr<HttpTransaction> trans( |
| 9010 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9010 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9011 | 9011 |
| 9012 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 9012 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 9013 EXPECT_EQ(ERR_IO_PENDING, rv); | 9013 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9014 | 9014 |
| 9015 HostPortPair http_host_port_pair("www.example.org", 80); | 9015 HostPortPair http_host_port_pair("www.example.org", 80); |
| 9016 HttpServerProperties& http_server_properties = | 9016 HttpServerProperties& http_server_properties = |
| 9017 *session->http_server_properties(); | 9017 *session->http_server_properties(); |
| 9018 AlternativeServiceVector alternative_service_vector = | 9018 AlternativeServiceVector alternative_service_vector = |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9065 request.method = "GET"; | 9065 request.method = "GET"; |
| 9066 request.url = GURL("http://www.example.org/"); | 9066 request.url = GURL("http://www.example.org/"); |
| 9067 request.load_flags = 0; | 9067 request.load_flags = 0; |
| 9068 | 9068 |
| 9069 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 9069 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 9070 | 9070 |
| 9071 session_deps_.socket_factory->AddSocketDataProvider(&data); | 9071 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 9072 | 9072 |
| 9073 TestCompletionCallback callback; | 9073 TestCompletionCallback callback; |
| 9074 | 9074 |
| 9075 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9075 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9076 scoped_ptr<HttpTransaction> trans( | 9076 scoped_ptr<HttpTransaction> trans( |
| 9077 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9077 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9078 | 9078 |
| 9079 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 9079 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 9080 EXPECT_EQ(ERR_IO_PENDING, rv); | 9080 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9081 | 9081 |
| 9082 HostPortPair http_host_port_pair("www.example.org", 80); | 9082 HostPortPair http_host_port_pair("www.example.org", 80); |
| 9083 HttpServerProperties& http_server_properties = | 9083 HttpServerProperties& http_server_properties = |
| 9084 *session->http_server_properties(); | 9084 *session->http_server_properties(); |
| 9085 AlternativeServiceVector alternative_service_vector = | 9085 AlternativeServiceVector alternative_service_vector = |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9122 request.method = "GET"; | 9122 request.method = "GET"; |
| 9123 request.url = GURL("http://www.example.org/"); | 9123 request.url = GURL("http://www.example.org/"); |
| 9124 request.load_flags = 0; | 9124 request.load_flags = 0; |
| 9125 | 9125 |
| 9126 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 9126 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 9127 | 9127 |
| 9128 session_deps_.socket_factory->AddSocketDataProvider(&data); | 9128 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 9129 | 9129 |
| 9130 TestCompletionCallback callback; | 9130 TestCompletionCallback callback; |
| 9131 | 9131 |
| 9132 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9132 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9133 | 9133 |
| 9134 HostPortPair http_host_port_pair("www.example.org", 80); | 9134 HostPortPair http_host_port_pair("www.example.org", 80); |
| 9135 HttpServerProperties& http_server_properties = | 9135 HttpServerProperties& http_server_properties = |
| 9136 *session->http_server_properties(); | 9136 *session->http_server_properties(); |
| 9137 AlternativeService alternative_service(QUIC, "", 80); | 9137 AlternativeService alternative_service(QUIC, "", 80); |
| 9138 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9138 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9139 http_server_properties.SetAlternativeService( | 9139 http_server_properties.SetAlternativeService( |
| 9140 http_host_port_pair, alternative_service, 1.0, expiration); | 9140 http_host_port_pair, alternative_service, 1.0, expiration); |
| 9141 | 9141 |
| 9142 AlternativeServiceVector alternative_service_vector = | 9142 AlternativeServiceVector alternative_service_vector = |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9189 request.method = "GET"; | 9189 request.method = "GET"; |
| 9190 request.url = GURL("http://www.example.org/"); | 9190 request.url = GURL("http://www.example.org/"); |
| 9191 request.load_flags = 0; | 9191 request.load_flags = 0; |
| 9192 | 9192 |
| 9193 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 9193 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 9194 | 9194 |
| 9195 session_deps_.socket_factory->AddSocketDataProvider(&data); | 9195 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 9196 | 9196 |
| 9197 TestCompletionCallback callback; | 9197 TestCompletionCallback callback; |
| 9198 | 9198 |
| 9199 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9199 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9200 scoped_ptr<HttpTransaction> trans( | 9200 scoped_ptr<HttpTransaction> trans( |
| 9201 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9201 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9202 | 9202 |
| 9203 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 9203 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 9204 EXPECT_EQ(ERR_IO_PENDING, rv); | 9204 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9205 | 9205 |
| 9206 HostPortPair http_host_port_pair("www.example.org", 80); | 9206 HostPortPair http_host_port_pair("www.example.org", 80); |
| 9207 HttpServerProperties& http_server_properties = | 9207 HttpServerProperties& http_server_properties = |
| 9208 *session->http_server_properties(); | 9208 *session->http_server_properties(); |
| 9209 AlternativeServiceVector alternative_service_vector = | 9209 AlternativeServiceVector alternative_service_vector = |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9248 session_deps_.socket_factory->AddSocketDataProvider(&first_data); | 9248 session_deps_.socket_factory->AddSocketDataProvider(&first_data); |
| 9249 | 9249 |
| 9250 MockRead data_reads[] = { | 9250 MockRead data_reads[] = { |
| 9251 MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello world"), | 9251 MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello world"), |
| 9252 MockRead(ASYNC, OK), | 9252 MockRead(ASYNC, OK), |
| 9253 }; | 9253 }; |
| 9254 StaticSocketDataProvider second_data(data_reads, arraysize(data_reads), | 9254 StaticSocketDataProvider second_data(data_reads, arraysize(data_reads), |
| 9255 nullptr, 0); | 9255 nullptr, 0); |
| 9256 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9256 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9257 | 9257 |
| 9258 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9258 scoped_ptr<HttpNetworkSession> session = CreateSession(&session_deps_); |
| 9259 | 9259 |
| 9260 base::WeakPtr<HttpServerProperties> http_server_properties = | 9260 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9261 session->http_server_properties(); | 9261 session->http_server_properties(); |
| 9262 AlternativeService alternative_service( | 9262 AlternativeService alternative_service( |
| 9263 AlternateProtocolFromNextProto(GetParam()), "different.example.org", 80); | 9263 AlternateProtocolFromNextProto(GetParam()), "different.example.org", 80); |
| 9264 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9264 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9265 http_server_properties->SetAlternativeService( | 9265 http_server_properties->SetAlternativeService( |
| 9266 HostPortPair::FromURL(request.url), alternative_service, 1.0, expiration); | 9266 HostPortPair::FromURL(request.url), alternative_service, 1.0, expiration); |
| 9267 | 9267 |
| 9268 scoped_ptr<HttpTransaction> trans( | 9268 scoped_ptr<HttpTransaction> trans( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 9292 | 9292 |
| 9293 MockRead data_reads[] = { | 9293 MockRead data_reads[] = { |
| 9294 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9294 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9295 MockRead("hello world"), | 9295 MockRead("hello world"), |
| 9296 MockRead(ASYNC, OK), | 9296 MockRead(ASYNC, OK), |
| 9297 }; | 9297 }; |
| 9298 StaticSocketDataProvider second_data( | 9298 StaticSocketDataProvider second_data( |
| 9299 data_reads, arraysize(data_reads), NULL, 0); | 9299 data_reads, arraysize(data_reads), NULL, 0); |
| 9300 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9300 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9301 | 9301 |
| 9302 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9302 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9303 | 9303 |
| 9304 base::WeakPtr<HttpServerProperties> http_server_properties = | 9304 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9305 session->http_server_properties(); | 9305 session->http_server_properties(); |
| 9306 const HostPortPair host_port_pair = HostPortPair::FromURL(request.url); | 9306 const HostPortPair host_port_pair = HostPortPair::FromURL(request.url); |
| 9307 // Port must be < 1024, or the header will be ignored (since initial port was | 9307 // Port must be < 1024, or the header will be ignored (since initial port was |
| 9308 // port 80 (another restricted port). | 9308 // port 80 (another restricted port). |
| 9309 const AlternativeService alternative_service( | 9309 const AlternativeService alternative_service( |
| 9310 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9310 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9311 666); // Port is ignored by MockConnect anyway. | 9311 666); // Port is ignored by MockConnect anyway. |
| 9312 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9312 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9358 | 9358 |
| 9359 MockRead data_reads[] = { | 9359 MockRead data_reads[] = { |
| 9360 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9360 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9361 MockRead("hello world"), | 9361 MockRead("hello world"), |
| 9362 MockRead(ASYNC, OK), | 9362 MockRead(ASYNC, OK), |
| 9363 }; | 9363 }; |
| 9364 StaticSocketDataProvider second_data( | 9364 StaticSocketDataProvider second_data( |
| 9365 data_reads, arraysize(data_reads), NULL, 0); | 9365 data_reads, arraysize(data_reads), NULL, 0); |
| 9366 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9366 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9367 | 9367 |
| 9368 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9368 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9369 | 9369 |
| 9370 base::WeakPtr<HttpServerProperties> http_server_properties = | 9370 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9371 session->http_server_properties(); | 9371 session->http_server_properties(); |
| 9372 const int kUnrestrictedAlternatePort = 1024; | 9372 const int kUnrestrictedAlternatePort = 1024; |
| 9373 AlternativeService alternative_service( | 9373 AlternativeService alternative_service( |
| 9374 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9374 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9375 kUnrestrictedAlternatePort); | 9375 kUnrestrictedAlternatePort); |
| 9376 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9376 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9377 http_server_properties->SetAlternativeService( | 9377 http_server_properties->SetAlternativeService( |
| 9378 HostPortPair::FromURL(restricted_port_request.url), alternative_service, | 9378 HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9410 | 9410 |
| 9411 MockRead data_reads[] = { | 9411 MockRead data_reads[] = { |
| 9412 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9412 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9413 MockRead("hello world"), | 9413 MockRead("hello world"), |
| 9414 MockRead(ASYNC, OK), | 9414 MockRead(ASYNC, OK), |
| 9415 }; | 9415 }; |
| 9416 StaticSocketDataProvider second_data( | 9416 StaticSocketDataProvider second_data( |
| 9417 data_reads, arraysize(data_reads), NULL, 0); | 9417 data_reads, arraysize(data_reads), NULL, 0); |
| 9418 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9418 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9419 | 9419 |
| 9420 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9420 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9421 | 9421 |
| 9422 base::WeakPtr<HttpServerProperties> http_server_properties = | 9422 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9423 session->http_server_properties(); | 9423 session->http_server_properties(); |
| 9424 const int kUnrestrictedAlternatePort = 1024; | 9424 const int kUnrestrictedAlternatePort = 1024; |
| 9425 AlternativeService alternative_service( | 9425 AlternativeService alternative_service( |
| 9426 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9426 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9427 kUnrestrictedAlternatePort); | 9427 kUnrestrictedAlternatePort); |
| 9428 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9428 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9429 http_server_properties->SetAlternativeService( | 9429 http_server_properties->SetAlternativeService( |
| 9430 HostPortPair::FromURL(restricted_port_request.url), alternative_service, | 9430 HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 9461 | 9461 |
| 9462 MockRead data_reads[] = { | 9462 MockRead data_reads[] = { |
| 9463 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9463 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9464 MockRead("hello world"), | 9464 MockRead("hello world"), |
| 9465 MockRead(ASYNC, OK), | 9465 MockRead(ASYNC, OK), |
| 9466 }; | 9466 }; |
| 9467 StaticSocketDataProvider second_data( | 9467 StaticSocketDataProvider second_data( |
| 9468 data_reads, arraysize(data_reads), NULL, 0); | 9468 data_reads, arraysize(data_reads), NULL, 0); |
| 9469 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9469 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9470 | 9470 |
| 9471 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9471 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9472 | 9472 |
| 9473 base::WeakPtr<HttpServerProperties> http_server_properties = | 9473 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9474 session->http_server_properties(); | 9474 session->http_server_properties(); |
| 9475 const int kRestrictedAlternatePort = 80; | 9475 const int kRestrictedAlternatePort = 80; |
| 9476 AlternativeService alternative_service( | 9476 AlternativeService alternative_service( |
| 9477 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9477 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9478 kRestrictedAlternatePort); | 9478 kRestrictedAlternatePort); |
| 9479 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9479 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9480 http_server_properties->SetAlternativeService( | 9480 http_server_properties->SetAlternativeService( |
| 9481 HostPortPair::FromURL(restricted_port_request.url), alternative_service, | 9481 HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9513 | 9513 |
| 9514 MockRead data_reads[] = { | 9514 MockRead data_reads[] = { |
| 9515 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9515 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9516 MockRead("hello world"), | 9516 MockRead("hello world"), |
| 9517 MockRead(ASYNC, OK), | 9517 MockRead(ASYNC, OK), |
| 9518 }; | 9518 }; |
| 9519 StaticSocketDataProvider second_data( | 9519 StaticSocketDataProvider second_data( |
| 9520 data_reads, arraysize(data_reads), NULL, 0); | 9520 data_reads, arraysize(data_reads), NULL, 0); |
| 9521 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9521 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9522 | 9522 |
| 9523 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9523 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9524 | 9524 |
| 9525 base::WeakPtr<HttpServerProperties> http_server_properties = | 9525 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9526 session->http_server_properties(); | 9526 session->http_server_properties(); |
| 9527 const int kRestrictedAlternatePort = 80; | 9527 const int kRestrictedAlternatePort = 80; |
| 9528 AlternativeService alternative_service( | 9528 AlternativeService alternative_service( |
| 9529 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9529 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9530 kRestrictedAlternatePort); | 9530 kRestrictedAlternatePort); |
| 9531 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9531 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9532 http_server_properties->SetAlternativeService( | 9532 http_server_properties->SetAlternativeService( |
| 9533 HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, | 9533 HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 9564 | 9564 |
| 9565 MockRead data_reads[] = { | 9565 MockRead data_reads[] = { |
| 9566 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9566 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9567 MockRead("hello world"), | 9567 MockRead("hello world"), |
| 9568 MockRead(ASYNC, OK), | 9568 MockRead(ASYNC, OK), |
| 9569 }; | 9569 }; |
| 9570 StaticSocketDataProvider second_data( | 9570 StaticSocketDataProvider second_data( |
| 9571 data_reads, arraysize(data_reads), NULL, 0); | 9571 data_reads, arraysize(data_reads), NULL, 0); |
| 9572 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9572 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9573 | 9573 |
| 9574 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9574 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9575 | 9575 |
| 9576 base::WeakPtr<HttpServerProperties> http_server_properties = | 9576 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9577 session->http_server_properties(); | 9577 session->http_server_properties(); |
| 9578 const int kUnrestrictedAlternatePort = 1025; | 9578 const int kUnrestrictedAlternatePort = 1025; |
| 9579 AlternativeService alternative_service( | 9579 AlternativeService alternative_service( |
| 9580 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9580 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9581 kUnrestrictedAlternatePort); | 9581 kUnrestrictedAlternatePort); |
| 9582 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9582 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9583 http_server_properties->SetAlternativeService( | 9583 http_server_properties->SetAlternativeService( |
| 9584 HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, | 9584 HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 9610 // so only the standard HTTP request will try to connect. | 9610 // so only the standard HTTP request will try to connect. |
| 9611 MockRead data_reads[] = { | 9611 MockRead data_reads[] = { |
| 9612 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9612 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9613 MockRead("hello world"), | 9613 MockRead("hello world"), |
| 9614 MockRead(ASYNC, OK), | 9614 MockRead(ASYNC, OK), |
| 9615 }; | 9615 }; |
| 9616 StaticSocketDataProvider data( | 9616 StaticSocketDataProvider data( |
| 9617 data_reads, arraysize(data_reads), NULL, 0); | 9617 data_reads, arraysize(data_reads), NULL, 0); |
| 9618 session_deps_.socket_factory->AddSocketDataProvider(&data); | 9618 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 9619 | 9619 |
| 9620 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9620 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9621 | 9621 |
| 9622 base::WeakPtr<HttpServerProperties> http_server_properties = | 9622 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9623 session->http_server_properties(); | 9623 session->http_server_properties(); |
| 9624 const int kUnsafePort = 7; | 9624 const int kUnsafePort = 7; |
| 9625 AlternativeService alternative_service( | 9625 AlternativeService alternative_service( |
| 9626 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9626 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9627 kUnsafePort); | 9627 kUnsafePort); |
| 9628 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9628 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9629 http_server_properties->SetAlternativeService( | 9629 http_server_properties->SetAlternativeService( |
| 9630 HostPortPair::FromURL(request.url), alternative_service, 1.0, expiration); | 9630 HostPortPair::FromURL(request.url), alternative_service, 1.0, expiration); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9695 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); | 9695 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); |
| 9696 StaticSocketDataProvider hanging_non_alternate_protocol_socket( | 9696 StaticSocketDataProvider hanging_non_alternate_protocol_socket( |
| 9697 NULL, 0, NULL, 0); | 9697 NULL, 0, NULL, 0); |
| 9698 hanging_non_alternate_protocol_socket.set_connect_data( | 9698 hanging_non_alternate_protocol_socket.set_connect_data( |
| 9699 never_finishing_connect); | 9699 never_finishing_connect); |
| 9700 session_deps_.socket_factory->AddSocketDataProvider( | 9700 session_deps_.socket_factory->AddSocketDataProvider( |
| 9701 &hanging_non_alternate_protocol_socket); | 9701 &hanging_non_alternate_protocol_socket); |
| 9702 | 9702 |
| 9703 TestCompletionCallback callback; | 9703 TestCompletionCallback callback; |
| 9704 | 9704 |
| 9705 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9705 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9706 scoped_ptr<HttpTransaction> trans( | 9706 scoped_ptr<HttpTransaction> trans( |
| 9707 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9707 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9708 | 9708 |
| 9709 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 9709 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 9710 EXPECT_EQ(ERR_IO_PENDING, rv); | 9710 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9711 EXPECT_EQ(OK, callback.WaitForResult()); | 9711 EXPECT_EQ(OK, callback.WaitForResult()); |
| 9712 | 9712 |
| 9713 const HttpResponseInfo* response = trans->GetResponseInfo(); | 9713 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 9714 ASSERT_TRUE(response != NULL); | 9714 ASSERT_TRUE(response != NULL); |
| 9715 ASSERT_TRUE(response->headers.get() != NULL); | 9715 ASSERT_TRUE(response->headers.get() != NULL); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9797 }; | 9797 }; |
| 9798 | 9798 |
| 9799 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, | 9799 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, |
| 9800 arraysize(spdy_writes)); | 9800 arraysize(spdy_writes)); |
| 9801 // Socket 4 is the successful Alternate-Protocol for transaction 3. | 9801 // Socket 4 is the successful Alternate-Protocol for transaction 3. |
| 9802 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); | 9802 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); |
| 9803 | 9803 |
| 9804 // Socket 5 is the unsuccessful non-Alternate-Protocol for transaction 3. | 9804 // Socket 5 is the unsuccessful non-Alternate-Protocol for transaction 3. |
| 9805 session_deps_.socket_factory->AddSocketDataProvider(&hanging_socket); | 9805 session_deps_.socket_factory->AddSocketDataProvider(&hanging_socket); |
| 9806 | 9806 |
| 9807 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9807 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9808 TestCompletionCallback callback1; | 9808 TestCompletionCallback callback1; |
| 9809 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get()); | 9809 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get()); |
| 9810 | 9810 |
| 9811 int rv = trans1.Start(&request, callback1.callback(), BoundNetLog()); | 9811 int rv = trans1.Start(&request, callback1.callback(), BoundNetLog()); |
| 9812 EXPECT_EQ(ERR_IO_PENDING, rv); | 9812 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9813 EXPECT_EQ(OK, callback1.WaitForResult()); | 9813 EXPECT_EQ(OK, callback1.WaitForResult()); |
| 9814 | 9814 |
| 9815 const HttpResponseInfo* response = trans1.GetResponseInfo(); | 9815 const HttpResponseInfo* response = trans1.GetResponseInfo(); |
| 9816 ASSERT_TRUE(response != NULL); | 9816 ASSERT_TRUE(response != NULL); |
| 9817 ASSERT_TRUE(response->headers.get() != NULL); | 9817 ASSERT_TRUE(response->headers.get() != NULL); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9888 hanging_alternate_protocol_socket.set_connect_data( | 9888 hanging_alternate_protocol_socket.set_connect_data( |
| 9889 never_finishing_connect); | 9889 never_finishing_connect); |
| 9890 session_deps_.socket_factory->AddSocketDataProvider( | 9890 session_deps_.socket_factory->AddSocketDataProvider( |
| 9891 &hanging_alternate_protocol_socket); | 9891 &hanging_alternate_protocol_socket); |
| 9892 | 9892 |
| 9893 // 2nd request is just a copy of the first one, over HTTP again. | 9893 // 2nd request is just a copy of the first one, over HTTP again. |
| 9894 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); | 9894 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); |
| 9895 | 9895 |
| 9896 TestCompletionCallback callback; | 9896 TestCompletionCallback callback; |
| 9897 | 9897 |
| 9898 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9898 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9899 scoped_ptr<HttpTransaction> trans( | 9899 scoped_ptr<HttpTransaction> trans( |
| 9900 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9900 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9901 | 9901 |
| 9902 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 9902 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 9903 EXPECT_EQ(ERR_IO_PENDING, rv); | 9903 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9904 EXPECT_EQ(OK, callback.WaitForResult()); | 9904 EXPECT_EQ(OK, callback.WaitForResult()); |
| 9905 | 9905 |
| 9906 const HttpResponseInfo* response = trans->GetResponseInfo(); | 9906 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 9907 ASSERT_TRUE(response != NULL); | 9907 ASSERT_TRUE(response != NULL); |
| 9908 ASSERT_TRUE(response->headers.get() != NULL); | 9908 ASSERT_TRUE(response->headers.get() != NULL); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10052 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); | 10052 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); |
| 10053 StaticSocketDataProvider hanging_non_alternate_protocol_socket( | 10053 StaticSocketDataProvider hanging_non_alternate_protocol_socket( |
| 10054 NULL, 0, NULL, 0); | 10054 NULL, 0, NULL, 0); |
| 10055 hanging_non_alternate_protocol_socket.set_connect_data( | 10055 hanging_non_alternate_protocol_socket.set_connect_data( |
| 10056 never_finishing_connect); | 10056 never_finishing_connect); |
| 10057 session_deps_.socket_factory->AddSocketDataProvider( | 10057 session_deps_.socket_factory->AddSocketDataProvider( |
| 10058 &hanging_non_alternate_protocol_socket); | 10058 &hanging_non_alternate_protocol_socket); |
| 10059 | 10059 |
| 10060 TestCompletionCallback callback; | 10060 TestCompletionCallback callback; |
| 10061 | 10061 |
| 10062 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10062 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10063 scoped_ptr<HttpTransaction> trans( | 10063 scoped_ptr<HttpTransaction> trans( |
| 10064 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10064 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10065 | 10065 |
| 10066 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 10066 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 10067 EXPECT_EQ(ERR_IO_PENDING, rv); | 10067 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10068 EXPECT_EQ(OK, callback.WaitForResult()); | 10068 EXPECT_EQ(OK, callback.WaitForResult()); |
| 10069 | 10069 |
| 10070 const HttpResponseInfo* response = trans->GetResponseInfo(); | 10070 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 10071 ASSERT_TRUE(response != NULL); | 10071 ASSERT_TRUE(response != NULL); |
| 10072 ASSERT_TRUE(response->headers.get() != NULL); | 10072 ASSERT_TRUE(response->headers.get() != NULL); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10145 MockRead spdy_reads[] = { | 10145 MockRead spdy_reads[] = { |
| 10146 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), | 10146 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), |
| 10147 }; | 10147 }; |
| 10148 | 10148 |
| 10149 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, | 10149 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, |
| 10150 arraysize(spdy_writes)); | 10150 arraysize(spdy_writes)); |
| 10151 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); | 10151 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); |
| 10152 | 10152 |
| 10153 TestCompletionCallback callback; | 10153 TestCompletionCallback callback; |
| 10154 | 10154 |
| 10155 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10155 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10156 | 10156 |
| 10157 scoped_ptr<HttpTransaction> trans( | 10157 scoped_ptr<HttpTransaction> trans( |
| 10158 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10158 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10159 | 10159 |
| 10160 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 10160 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 10161 EXPECT_EQ(ERR_IO_PENDING, rv); | 10161 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10162 EXPECT_EQ(OK, callback.WaitForResult()); | 10162 EXPECT_EQ(OK, callback.WaitForResult()); |
| 10163 | 10163 |
| 10164 const HttpResponseInfo* response = trans->GetResponseInfo(); | 10164 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 10165 ASSERT_TRUE(response != NULL); | 10165 ASSERT_TRUE(response != NULL); |
| 10166 ASSERT_TRUE(response->headers.get() != NULL); | 10166 ASSERT_TRUE(response->headers.get() != NULL); |
| 10167 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); | 10167 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); |
| 10168 | 10168 |
| 10169 std::string response_data; | 10169 std::string response_data; |
| 10170 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 10170 ASSERT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 10171 EXPECT_EQ("hello world", response_data); | 10171 EXPECT_EQ("hello world", response_data); |
| 10172 | 10172 |
| 10173 // Set up an initial SpdySession in the pool to reuse. | 10173 // Set up an initial SpdySession in the pool to reuse. |
| 10174 HostPortPair host_port_pair("www.example.org", 443); | 10174 HostPortPair host_port_pair("www.example.org", 443); |
| 10175 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | 10175 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
| 10176 PRIVACY_MODE_DISABLED); | 10176 PRIVACY_MODE_DISABLED); |
| 10177 base::WeakPtr<SpdySession> spdy_session = | 10177 base::WeakPtr<SpdySession> spdy_session = |
| 10178 CreateSecureSpdySession(session, key, BoundNetLog()); | 10178 CreateSecureSpdySession(session.get(), key, BoundNetLog()); |
| 10179 | 10179 |
| 10180 trans.reset(new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10180 trans.reset(new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10181 | 10181 |
| 10182 rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 10182 rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 10183 EXPECT_EQ(ERR_IO_PENDING, rv); | 10183 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10184 EXPECT_EQ(OK, callback.WaitForResult()); | 10184 EXPECT_EQ(OK, callback.WaitForResult()); |
| 10185 | 10185 |
| 10186 response = trans->GetResponseInfo(); | 10186 response = trans->GetResponseInfo(); |
| 10187 ASSERT_TRUE(response != NULL); | 10187 ASSERT_TRUE(response != NULL); |
| 10188 ASSERT_TRUE(response->headers.get() != NULL); | 10188 ASSERT_TRUE(response->headers.get() != NULL); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10537 ProxyService::CreateFixed(test_config.proxy_url); | 10537 ProxyService::CreateFixed(test_config.proxy_url); |
| 10538 } else { | 10538 } else { |
| 10539 session_deps_.proxy_service = ProxyService::CreateDirect(); | 10539 session_deps_.proxy_service = ProxyService::CreateDirect(); |
| 10540 } | 10540 } |
| 10541 | 10541 |
| 10542 HttpRequestInfo request; | 10542 HttpRequestInfo request; |
| 10543 request.method = "GET"; | 10543 request.method = "GET"; |
| 10544 request.url = GURL(test_config.server_url); | 10544 request.url = GURL(test_config.server_url); |
| 10545 request.load_flags = 0; | 10545 request.load_flags = 0; |
| 10546 | 10546 |
| 10547 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10547 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10548 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); | 10548 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); |
| 10549 | 10549 |
| 10550 SSLSocketDataProvider ssl_socket_data_provider(SYNCHRONOUS, OK); | 10550 SSLSocketDataProvider ssl_socket_data_provider(SYNCHRONOUS, OK); |
| 10551 | 10551 |
| 10552 std::vector<std::vector<MockRead>> mock_reads(1); | 10552 std::vector<std::vector<MockRead>> mock_reads(1); |
| 10553 std::vector<std::vector<MockWrite>> mock_writes(1); | 10553 std::vector<std::vector<MockWrite>> mock_writes(1); |
| 10554 for (int round = 0; round < test_config.num_auth_rounds; ++round) { | 10554 for (int round = 0; round < test_config.num_auth_rounds; ++round) { |
| 10555 const TestRound& read_write_round = test_config.rounds[round]; | 10555 const TestRound& read_write_round = test_config.rounds[round]; |
| 10556 | 10556 |
| 10557 // Set up expected reads and writes. | 10557 // Set up expected reads and writes. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10637 origin, BoundNetLog()); | 10637 origin, BoundNetLog()); |
| 10638 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER); | 10638 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER); |
| 10639 | 10639 |
| 10640 int rv = OK; | 10640 int rv = OK; |
| 10641 const HttpResponseInfo* response = NULL; | 10641 const HttpResponseInfo* response = NULL; |
| 10642 HttpRequestInfo request; | 10642 HttpRequestInfo request; |
| 10643 request.method = "GET"; | 10643 request.method = "GET"; |
| 10644 request.url = origin; | 10644 request.url = origin; |
| 10645 request.load_flags = 0; | 10645 request.load_flags = 0; |
| 10646 | 10646 |
| 10647 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10647 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10648 | 10648 |
| 10649 // Use a TCP Socket Pool with only one connection per group. This is used | 10649 // Use a TCP Socket Pool with only one connection per group. This is used |
| 10650 // to validate that the TCP socket is not released to the pool between | 10650 // to validate that the TCP socket is not released to the pool between |
| 10651 // each round of multi-round authentication. | 10651 // each round of multi-round authentication. |
| 10652 HttpNetworkSessionPeer session_peer(session); | 10652 HttpNetworkSessionPeer session_peer(session.get()); |
| 10653 TransportClientSocketPool* transport_pool = new TransportClientSocketPool( | 10653 TransportClientSocketPool* transport_pool = new TransportClientSocketPool( |
| 10654 50, // Max sockets for pool | 10654 50, // Max sockets for pool |
| 10655 1, // Max sockets per group | 10655 1, // Max sockets per group |
| 10656 session_deps_.host_resolver.get(), | 10656 session_deps_.host_resolver.get(), |
| 10657 session_deps_.socket_factory.get(), | 10657 session_deps_.socket_factory.get(), |
| 10658 session_deps_.net_log); | 10658 session_deps_.net_log); |
| 10659 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( | 10659 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( |
| 10660 new MockClientSocketPoolManager); | 10660 new MockClientSocketPoolManager); |
| 10661 mock_pool_manager->SetTransportSocketPool(transport_pool); | 10661 mock_pool_manager->SetTransportSocketPool(transport_pool); |
| 10662 session_peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); | 10662 session_peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10837 ssl.SetNextProto(kProtoHTTP11); | 10837 ssl.SetNextProto(kProtoHTTP11); |
| 10838 | 10838 |
| 10839 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 10839 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 10840 | 10840 |
| 10841 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 10841 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 10842 data_writes, arraysize(data_writes)); | 10842 data_writes, arraysize(data_writes)); |
| 10843 session_deps_.socket_factory->AddSocketDataProvider(&data); | 10843 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 10844 | 10844 |
| 10845 TestCompletionCallback callback; | 10845 TestCompletionCallback callback; |
| 10846 | 10846 |
| 10847 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10847 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10848 scoped_ptr<HttpTransaction> trans( | 10848 scoped_ptr<HttpTransaction> trans( |
| 10849 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10849 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10850 | 10850 |
| 10851 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 10851 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 10852 | 10852 |
| 10853 EXPECT_EQ(ERR_IO_PENDING, rv); | 10853 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10854 EXPECT_EQ(OK, callback.WaitForResult()); | 10854 EXPECT_EQ(OK, callback.WaitForResult()); |
| 10855 | 10855 |
| 10856 const HttpResponseInfo* response = trans->GetResponseInfo(); | 10856 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 10857 ASSERT_TRUE(response != NULL); | 10857 ASSERT_TRUE(response != NULL); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10889 MockRead spdy_reads[] = { | 10889 MockRead spdy_reads[] = { |
| 10890 MockRead(SYNCHRONOUS, 0, 0) // Not async - return 0 immediately. | 10890 MockRead(SYNCHRONOUS, 0, 0) // Not async - return 0 immediately. |
| 10891 }; | 10891 }; |
| 10892 | 10892 |
| 10893 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, | 10893 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, |
| 10894 arraysize(spdy_writes)); | 10894 arraysize(spdy_writes)); |
| 10895 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); | 10895 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); |
| 10896 | 10896 |
| 10897 TestCompletionCallback callback; | 10897 TestCompletionCallback callback; |
| 10898 | 10898 |
| 10899 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10899 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10900 scoped_ptr<HttpTransaction> trans( | 10900 scoped_ptr<HttpTransaction> trans( |
| 10901 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10901 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10902 | 10902 |
| 10903 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 10903 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 10904 EXPECT_EQ(ERR_IO_PENDING, rv); | 10904 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10905 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); | 10905 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); |
| 10906 } | 10906 } |
| 10907 | 10907 |
| 10908 // A subclass of HttpAuthHandlerMock that records the request URL when | 10908 // A subclass of HttpAuthHandlerMock that records the request URL when |
| 10909 // it gets it. This is needed since the auth handler may get destroyed | 10909 // it gets it. This is needed since the auth handler may get destroyed |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11046 StaticSocketDataProvider hanging_non_alternate_protocol_socket( | 11046 StaticSocketDataProvider hanging_non_alternate_protocol_socket( |
| 11047 NULL, 0, NULL, 0); | 11047 NULL, 0, NULL, 0); |
| 11048 hanging_non_alternate_protocol_socket.set_connect_data( | 11048 hanging_non_alternate_protocol_socket.set_connect_data( |
| 11049 never_finishing_connect); | 11049 never_finishing_connect); |
| 11050 | 11050 |
| 11051 session_deps_.socket_factory->AddSocketDataProvider(&data_1); | 11051 session_deps_.socket_factory->AddSocketDataProvider(&data_1); |
| 11052 session_deps_.socket_factory->AddSocketDataProvider(&data_2); | 11052 session_deps_.socket_factory->AddSocketDataProvider(&data_2); |
| 11053 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 11053 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 11054 session_deps_.socket_factory->AddSocketDataProvider( | 11054 session_deps_.socket_factory->AddSocketDataProvider( |
| 11055 &hanging_non_alternate_protocol_socket); | 11055 &hanging_non_alternate_protocol_socket); |
| 11056 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11056 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11057 | 11057 |
| 11058 // First round should work and provide the Alternate-Protocol state. | 11058 // First round should work and provide the Alternate-Protocol state. |
| 11059 TestCompletionCallback callback_1; | 11059 TestCompletionCallback callback_1; |
| 11060 scoped_ptr<HttpTransaction> trans_1( | 11060 scoped_ptr<HttpTransaction> trans_1( |
| 11061 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11061 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11062 int rv = trans_1->Start(&request, callback_1.callback(), BoundNetLog()); | 11062 int rv = trans_1->Start(&request, callback_1.callback(), BoundNetLog()); |
| 11063 EXPECT_EQ(ERR_IO_PENDING, rv); | 11063 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 11064 EXPECT_EQ(OK, callback_1.WaitForResult()); | 11064 EXPECT_EQ(OK, callback_1.WaitForResult()); |
| 11065 | 11065 |
| 11066 // Second round should attempt a tunnel connect and get an auth challenge. | 11066 // Second round should attempt a tunnel connect and get an auth challenge. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11106 MockRead(SYNCHRONOUS, "hello world"), | 11106 MockRead(SYNCHRONOUS, "hello world"), |
| 11107 MockRead(SYNCHRONOUS, OK), | 11107 MockRead(SYNCHRONOUS, OK), |
| 11108 }; | 11108 }; |
| 11109 | 11109 |
| 11110 HttpRequestInfo request; | 11110 HttpRequestInfo request; |
| 11111 request.method = "GET"; | 11111 request.method = "GET"; |
| 11112 request.url = GURL("http://www.example.org/"); | 11112 request.url = GURL("http://www.example.org/"); |
| 11113 request.load_flags = 0; | 11113 request.load_flags = 0; |
| 11114 | 11114 |
| 11115 session_deps_.host_resolver->set_synchronous_mode(true); | 11115 session_deps_.host_resolver->set_synchronous_mode(true); |
| 11116 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11116 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11117 scoped_ptr<HttpTransaction> trans( | 11117 scoped_ptr<HttpTransaction> trans( |
| 11118 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11118 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11119 | 11119 |
| 11120 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 11120 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 11121 data.set_connect_data(mock_connect); | 11121 data.set_connect_data(mock_connect); |
| 11122 session_deps_.socket_factory->AddSocketDataProvider(&data); | 11122 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 11123 | 11123 |
| 11124 TestCompletionCallback callback; | 11124 TestCompletionCallback callback; |
| 11125 | 11125 |
| 11126 BoundTestNetLog log; | 11126 BoundTestNetLog log; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 11144 MockRead(ASYNC, "Connection: Keep-Alive\r\n\r\n"), | 11144 MockRead(ASYNC, "Connection: Keep-Alive\r\n\r\n"), |
| 11145 MockRead(ASYNC, "1"), | 11145 MockRead(ASYNC, "1"), |
| 11146 // 2 async reads are necessary to trigger a ReadResponseBody call after the | 11146 // 2 async reads are necessary to trigger a ReadResponseBody call after the |
| 11147 // HttpNetworkTransaction has been deleted. | 11147 // HttpNetworkTransaction has been deleted. |
| 11148 MockRead(ASYNC, "2"), | 11148 MockRead(ASYNC, "2"), |
| 11149 MockRead(SYNCHRONOUS, ERR_IO_PENDING), // Should never read this. | 11149 MockRead(SYNCHRONOUS, ERR_IO_PENDING), // Should never read this. |
| 11150 }; | 11150 }; |
| 11151 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 11151 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 11152 session_deps_.socket_factory->AddSocketDataProvider(&data); | 11152 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 11153 | 11153 |
| 11154 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11154 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11155 | 11155 |
| 11156 { | 11156 { |
| 11157 HttpRequestInfo request; | 11157 HttpRequestInfo request; |
| 11158 request.method = "GET"; | 11158 request.method = "GET"; |
| 11159 request.url = GURL("http://www.example.org/"); | 11159 request.url = GURL("http://www.example.org/"); |
| 11160 request.load_flags = 0; | 11160 request.load_flags = 0; |
| 11161 | 11161 |
| 11162 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); | 11162 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); |
| 11163 TestCompletionCallback callback; | 11163 TestCompletionCallback callback; |
| 11164 | 11164 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 11180 // Socket should now be idle, waiting to be reused. | 11180 // Socket should now be idle, waiting to be reused. |
| 11181 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session.get())); | 11181 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session.get())); |
| 11182 } | 11182 } |
| 11183 | 11183 |
| 11184 // Test a basic GET request through a proxy. | 11184 // Test a basic GET request through a proxy. |
| 11185 TEST_P(HttpNetworkTransactionTest, ProxyGet) { | 11185 TEST_P(HttpNetworkTransactionTest, ProxyGet) { |
| 11186 session_deps_.proxy_service = | 11186 session_deps_.proxy_service = |
| 11187 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); | 11187 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 11188 BoundTestNetLog log; | 11188 BoundTestNetLog log; |
| 11189 session_deps_.net_log = log.bound().net_log(); | 11189 session_deps_.net_log = log.bound().net_log(); |
| 11190 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11190 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11191 | 11191 |
| 11192 HttpRequestInfo request; | 11192 HttpRequestInfo request; |
| 11193 request.method = "GET"; | 11193 request.method = "GET"; |
| 11194 request.url = GURL("http://www.example.org/"); | 11194 request.url = GURL("http://www.example.org/"); |
| 11195 | 11195 |
| 11196 MockWrite data_writes1[] = { | 11196 MockWrite data_writes1[] = { |
| 11197 MockWrite( | 11197 MockWrite( |
| 11198 "GET http://www.example.org/ HTTP/1.1\r\n" | 11198 "GET http://www.example.org/ HTTP/1.1\r\n" |
| 11199 "Host: www.example.org\r\n" | 11199 "Host: www.example.org\r\n" |
| 11200 "Proxy-Connection: keep-alive\r\n\r\n"), | 11200 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11244 TestLoadTimingNotReusedWithPac(load_timing_info, | 11244 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 11245 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); | 11245 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); |
| 11246 } | 11246 } |
| 11247 | 11247 |
| 11248 // Test a basic HTTPS GET request through a proxy. | 11248 // Test a basic HTTPS GET request through a proxy. |
| 11249 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { | 11249 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { |
| 11250 session_deps_.proxy_service = | 11250 session_deps_.proxy_service = |
| 11251 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); | 11251 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 11252 BoundTestNetLog log; | 11252 BoundTestNetLog log; |
| 11253 session_deps_.net_log = log.bound().net_log(); | 11253 session_deps_.net_log = log.bound().net_log(); |
| 11254 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11254 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11255 | 11255 |
| 11256 HttpRequestInfo request; | 11256 HttpRequestInfo request; |
| 11257 request.method = "GET"; | 11257 request.method = "GET"; |
| 11258 request.url = GURL("https://www.example.org/"); | 11258 request.url = GURL("https://www.example.org/"); |
| 11259 | 11259 |
| 11260 // Since we have proxy, should try to establish tunnel. | 11260 // Since we have proxy, should try to establish tunnel. |
| 11261 MockWrite data_writes1[] = { | 11261 MockWrite data_writes1[] = { |
| 11262 MockWrite( | 11262 MockWrite( |
| 11263 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 11263 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 11264 "Host: www.example.org\r\n" | 11264 "Host: www.example.org\r\n" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11321 TestLoadTimingNotReusedWithPac(load_timing_info, | 11321 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 11322 CONNECT_TIMING_HAS_SSL_TIMES); | 11322 CONNECT_TIMING_HAS_SSL_TIMES); |
| 11323 } | 11323 } |
| 11324 | 11324 |
| 11325 // Test a basic HTTPS GET request through a proxy, but the server hangs up | 11325 // Test a basic HTTPS GET request through a proxy, but the server hangs up |
| 11326 // while establishing the tunnel. | 11326 // while establishing the tunnel. |
| 11327 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) { | 11327 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) { |
| 11328 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); | 11328 session_deps_.proxy_service = ProxyService::CreateFixed("myproxy:70"); |
| 11329 BoundTestNetLog log; | 11329 BoundTestNetLog log; |
| 11330 session_deps_.net_log = log.bound().net_log(); | 11330 session_deps_.net_log = log.bound().net_log(); |
| 11331 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11331 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11332 | 11332 |
| 11333 HttpRequestInfo request; | 11333 HttpRequestInfo request; |
| 11334 request.method = "GET"; | 11334 request.method = "GET"; |
| 11335 request.url = GURL("https://www.example.org/"); | 11335 request.url = GURL("https://www.example.org/"); |
| 11336 | 11336 |
| 11337 // Since we have proxy, should try to establish tunnel. | 11337 // Since we have proxy, should try to establish tunnel. |
| 11338 MockWrite data_writes1[] = { | 11338 MockWrite data_writes1[] = { |
| 11339 MockWrite( | 11339 MockWrite( |
| 11340 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 11340 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 11341 "Host: www.example.org\r\n" | 11341 "Host: www.example.org\r\n" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11393 }; | 11393 }; |
| 11394 | 11394 |
| 11395 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, | 11395 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, |
| 11396 arraysize(spdy_writes)); | 11396 arraysize(spdy_writes)); |
| 11397 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); | 11397 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); |
| 11398 | 11398 |
| 11399 SSLSocketDataProvider ssl(ASYNC, OK); | 11399 SSLSocketDataProvider ssl(ASYNC, OK); |
| 11400 ssl.SetNextProto(GetParam()); | 11400 ssl.SetNextProto(GetParam()); |
| 11401 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 11401 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 11402 | 11402 |
| 11403 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11403 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11404 | 11404 |
| 11405 // Set up an initial SpdySession in the pool to reuse. | 11405 // Set up an initial SpdySession in the pool to reuse. |
| 11406 HostPortPair host_port_pair("www.example.org", 443); | 11406 HostPortPair host_port_pair("www.example.org", 443); |
| 11407 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | 11407 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
| 11408 PRIVACY_MODE_DISABLED); | 11408 PRIVACY_MODE_DISABLED); |
| 11409 base::WeakPtr<SpdySession> spdy_session = | 11409 base::WeakPtr<SpdySession> spdy_session = |
| 11410 CreateInsecureSpdySession(session, key, BoundNetLog()); | 11410 CreateInsecureSpdySession(session.get(), key, BoundNetLog()); |
| 11411 | 11411 |
| 11412 HttpRequestInfo request; | 11412 HttpRequestInfo request; |
| 11413 request.method = "GET"; | 11413 request.method = "GET"; |
| 11414 request.url = GURL("https://www.example.org/"); | 11414 request.url = GURL("https://www.example.org/"); |
| 11415 request.load_flags = 0; | 11415 request.load_flags = 0; |
| 11416 | 11416 |
| 11417 // This is the important line that marks this as a preconnect. | 11417 // This is the important line that marks this as a preconnect. |
| 11418 request.motivation = HttpRequestInfo::PRECONNECT_MOTIVATED; | 11418 request.motivation = HttpRequestInfo::PRECONNECT_MOTIVATED; |
| 11419 | 11419 |
| 11420 scoped_ptr<HttpTransaction> trans( | 11420 scoped_ptr<HttpTransaction> trans( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 11436 request_info.load_flags = LOAD_NORMAL; | 11436 request_info.load_flags = LOAD_NORMAL; |
| 11437 | 11437 |
| 11438 SSLSocketDataProvider ssl_data(mode, OK); | 11438 SSLSocketDataProvider ssl_data(mode, OK); |
| 11439 MockWrite data_writes[] = { | 11439 MockWrite data_writes[] = { |
| 11440 MockWrite(mode, error), | 11440 MockWrite(mode, error), |
| 11441 }; | 11441 }; |
| 11442 StaticSocketDataProvider data(NULL, 0, data_writes, arraysize(data_writes)); | 11442 StaticSocketDataProvider data(NULL, 0, data_writes, arraysize(data_writes)); |
| 11443 session_deps_.socket_factory->AddSocketDataProvider(&data); | 11443 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 11444 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data); | 11444 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data); |
| 11445 | 11445 |
| 11446 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11446 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11447 scoped_ptr<HttpTransaction> trans( | 11447 scoped_ptr<HttpTransaction> trans( |
| 11448 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11448 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11449 | 11449 |
| 11450 TestCompletionCallback callback; | 11450 TestCompletionCallback callback; |
| 11451 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); | 11451 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); |
| 11452 if (rv == ERR_IO_PENDING) | 11452 if (rv == ERR_IO_PENDING) |
| 11453 rv = callback.WaitForResult(); | 11453 rv = callback.WaitForResult(); |
| 11454 ASSERT_EQ(error, rv); | 11454 ASSERT_EQ(error, rv); |
| 11455 } | 11455 } |
| 11456 | 11456 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11523 // connection was attempted with TLSv1.1. This is transparent to the caller | 11523 // connection was attempted with TLSv1.1. This is transparent to the caller |
| 11524 // of the HttpNetworkTransaction. Because this test failure is due to | 11524 // of the HttpNetworkTransaction. Because this test failure is due to |
| 11525 // requiring a client certificate, this fallback handshake should also | 11525 // requiring a client certificate, this fallback handshake should also |
| 11526 // fail. | 11526 // fail. |
| 11527 SSLSocketDataProvider ssl_data4(ASYNC, ERR_SSL_PROTOCOL_ERROR); | 11527 SSLSocketDataProvider ssl_data4(ASYNC, ERR_SSL_PROTOCOL_ERROR); |
| 11528 ssl_data4.cert_request_info = cert_request.get(); | 11528 ssl_data4.cert_request_info = cert_request.get(); |
| 11529 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data4); | 11529 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data4); |
| 11530 StaticSocketDataProvider data4(NULL, 0, NULL, 0); | 11530 StaticSocketDataProvider data4(NULL, 0, NULL, 0); |
| 11531 session_deps_.socket_factory->AddSocketDataProvider(&data4); | 11531 session_deps_.socket_factory->AddSocketDataProvider(&data4); |
| 11532 | 11532 |
| 11533 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11533 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11534 scoped_ptr<HttpTransaction> trans( | 11534 scoped_ptr<HttpTransaction> trans( |
| 11535 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11535 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11536 | 11536 |
| 11537 // Begin the SSL handshake with the peer. This consumes ssl_data1. | 11537 // Begin the SSL handshake with the peer. This consumes ssl_data1. |
| 11538 TestCompletionCallback callback; | 11538 TestCompletionCallback callback; |
| 11539 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); | 11539 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); |
| 11540 ASSERT_EQ(ERR_IO_PENDING, rv); | 11540 ASSERT_EQ(ERR_IO_PENDING, rv); |
| 11541 | 11541 |
| 11542 // Complete the SSL handshake, which should abort due to requiring a | 11542 // Complete the SSL handshake, which should abort due to requiring a |
| 11543 // client certificate. | 11543 // client certificate. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11640 StaticSocketDataProvider data4(data2_reads, arraysize(data2_reads), NULL, 0); | 11640 StaticSocketDataProvider data4(data2_reads, arraysize(data2_reads), NULL, 0); |
| 11641 session_deps_.socket_factory->AddSocketDataProvider(&data4); | 11641 session_deps_.socket_factory->AddSocketDataProvider(&data4); |
| 11642 | 11642 |
| 11643 // Need one more if TLSv1.2 is enabled. | 11643 // Need one more if TLSv1.2 is enabled. |
| 11644 SSLSocketDataProvider ssl_data5(ASYNC, OK); | 11644 SSLSocketDataProvider ssl_data5(ASYNC, OK); |
| 11645 ssl_data5.cert_request_info = cert_request.get(); | 11645 ssl_data5.cert_request_info = cert_request.get(); |
| 11646 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data5); | 11646 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data5); |
| 11647 StaticSocketDataProvider data5(data2_reads, arraysize(data2_reads), NULL, 0); | 11647 StaticSocketDataProvider data5(data2_reads, arraysize(data2_reads), NULL, 0); |
| 11648 session_deps_.socket_factory->AddSocketDataProvider(&data5); | 11648 session_deps_.socket_factory->AddSocketDataProvider(&data5); |
| 11649 | 11649 |
| 11650 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11650 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11651 scoped_ptr<HttpTransaction> trans( | 11651 scoped_ptr<HttpTransaction> trans( |
| 11652 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11652 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11653 | 11653 |
| 11654 // Begin the initial SSL handshake. | 11654 // Begin the initial SSL handshake. |
| 11655 TestCompletionCallback callback; | 11655 TestCompletionCallback callback; |
| 11656 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); | 11656 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); |
| 11657 ASSERT_EQ(ERR_IO_PENDING, rv); | 11657 ASSERT_EQ(ERR_IO_PENDING, rv); |
| 11658 | 11658 |
| 11659 // Complete the SSL handshake, which should abort due to requiring a | 11659 // Complete the SSL handshake, which should abort due to requiring a |
| 11660 // client certificate. | 11660 // client certificate. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11732 requests[0].url = GURL("https://www.example.com/"); | 11732 requests[0].url = GURL("https://www.example.com/"); |
| 11733 requests[0].method = "GET"; | 11733 requests[0].method = "GET"; |
| 11734 requests[0].load_flags = LOAD_NORMAL; | 11734 requests[0].load_flags = LOAD_NORMAL; |
| 11735 | 11735 |
| 11736 requests[1].url = GURL("http://www.example.com/"); | 11736 requests[1].url = GURL("http://www.example.com/"); |
| 11737 requests[1].method = "GET"; | 11737 requests[1].method = "GET"; |
| 11738 requests[1].load_flags = LOAD_NORMAL; | 11738 requests[1].load_flags = LOAD_NORMAL; |
| 11739 | 11739 |
| 11740 for (size_t i = 0; i < arraysize(requests); ++i) { | 11740 for (size_t i = 0; i < arraysize(requests); ++i) { |
| 11741 session_deps_.socket_factory->ResetNextMockIndexes(); | 11741 session_deps_.socket_factory->ResetNextMockIndexes(); |
| 11742 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11742 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11743 scoped_ptr<HttpNetworkTransaction> trans( | 11743 scoped_ptr<HttpNetworkTransaction> trans( |
| 11744 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11744 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11745 | 11745 |
| 11746 // Begin the SSL handshake with the proxy. | 11746 // Begin the SSL handshake with the proxy. |
| 11747 TestCompletionCallback callback; | 11747 TestCompletionCallback callback; |
| 11748 int rv = trans->Start(&requests[i], callback.callback(), BoundNetLog()); | 11748 int rv = trans->Start(&requests[i], callback.callback(), BoundNetLog()); |
| 11749 ASSERT_EQ(ERR_IO_PENDING, rv); | 11749 ASSERT_EQ(ERR_IO_PENDING, rv); |
| 11750 | 11750 |
| 11751 // Complete the SSL handshake, which should abort due to requiring a | 11751 // Complete the SSL handshake, which should abort due to requiring a |
| 11752 // client certificate. | 11752 // client certificate. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11785 HostPortPair("www.example.com", 443), &client_cert)); | 11785 HostPortPair("www.example.com", 443), &client_cert)); |
| 11786 } | 11786 } |
| 11787 } | 11787 } |
| 11788 | 11788 |
| 11789 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPooling) { | 11789 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPooling) { |
| 11790 session_deps_.use_alternative_services = true; | 11790 session_deps_.use_alternative_services = true; |
| 11791 session_deps_.next_protos = SpdyNextProtos(); | 11791 session_deps_.next_protos = SpdyNextProtos(); |
| 11792 | 11792 |
| 11793 // Set up a special HttpNetworkSession with a MockCachingHostResolver. | 11793 // Set up a special HttpNetworkSession with a MockCachingHostResolver. |
| 11794 session_deps_.host_resolver.reset(new MockCachingHostResolver()); | 11794 session_deps_.host_resolver.reset(new MockCachingHostResolver()); |
| 11795 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11795 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11796 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 11796 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 11797 pool_peer.DisableDomainAuthenticationVerification(); | 11797 pool_peer.DisableDomainAuthenticationVerification(); |
| 11798 | 11798 |
| 11799 SSLSocketDataProvider ssl(ASYNC, OK); | 11799 SSLSocketDataProvider ssl(ASYNC, OK); |
| 11800 ssl.SetNextProto(GetParam()); | 11800 ssl.SetNextProto(GetParam()); |
| 11801 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 11801 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 11802 | 11802 |
| 11803 scoped_ptr<SpdyFrame> host1_req( | 11803 scoped_ptr<SpdyFrame> host1_req( |
| 11804 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); | 11804 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); |
| 11805 scoped_ptr<SpdyFrame> host2_req( | 11805 scoped_ptr<SpdyFrame> host2_req( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11884 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); | 11884 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); |
| 11885 EXPECT_EQ("hello!", response_data); | 11885 EXPECT_EQ("hello!", response_data); |
| 11886 } | 11886 } |
| 11887 | 11887 |
| 11888 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPoolingAfterResolution) { | 11888 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPoolingAfterResolution) { |
| 11889 session_deps_.use_alternative_services = true; | 11889 session_deps_.use_alternative_services = true; |
| 11890 session_deps_.next_protos = SpdyNextProtos(); | 11890 session_deps_.next_protos = SpdyNextProtos(); |
| 11891 | 11891 |
| 11892 // Set up a special HttpNetworkSession with a MockCachingHostResolver. | 11892 // Set up a special HttpNetworkSession with a MockCachingHostResolver. |
| 11893 session_deps_.host_resolver.reset(new MockCachingHostResolver()); | 11893 session_deps_.host_resolver.reset(new MockCachingHostResolver()); |
| 11894 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11894 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11895 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 11895 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 11896 pool_peer.DisableDomainAuthenticationVerification(); | 11896 pool_peer.DisableDomainAuthenticationVerification(); |
| 11897 | 11897 |
| 11898 SSLSocketDataProvider ssl(ASYNC, OK); | 11898 SSLSocketDataProvider ssl(ASYNC, OK); |
| 11899 ssl.SetNextProto(GetParam()); | 11899 ssl.SetNextProto(GetParam()); |
| 11900 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 11900 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 11901 | 11901 |
| 11902 scoped_ptr<SpdyFrame> host1_req( | 11902 scoped_ptr<SpdyFrame> host1_req( |
| 11903 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); | 11903 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); |
| 11904 scoped_ptr<SpdyFrame> host2_req( | 11904 scoped_ptr<SpdyFrame> host2_req( |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12014 TEST_P(HttpNetworkTransactionTest, | 12014 TEST_P(HttpNetworkTransactionTest, |
| 12015 UseIPConnectionPoolingWithHostCacheExpiration) { | 12015 UseIPConnectionPoolingWithHostCacheExpiration) { |
| 12016 session_deps_.use_alternative_services = true; | 12016 session_deps_.use_alternative_services = true; |
| 12017 session_deps_.next_protos = SpdyNextProtos(); | 12017 session_deps_.next_protos = SpdyNextProtos(); |
| 12018 | 12018 |
| 12019 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. | 12019 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. |
| 12020 OneTimeCachingHostResolver host_resolver(HostPortPair("www.gmail.com", 443)); | 12020 OneTimeCachingHostResolver host_resolver(HostPortPair("www.gmail.com", 443)); |
| 12021 HttpNetworkSession::Params params = | 12021 HttpNetworkSession::Params params = |
| 12022 SpdySessionDependencies::CreateSessionParams(&session_deps_); | 12022 SpdySessionDependencies::CreateSessionParams(&session_deps_); |
| 12023 params.host_resolver = &host_resolver; | 12023 params.host_resolver = &host_resolver; |
| 12024 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12024 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12025 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 12025 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 12026 pool_peer.DisableDomainAuthenticationVerification(); | 12026 pool_peer.DisableDomainAuthenticationVerification(); |
| 12027 | 12027 |
| 12028 SSLSocketDataProvider ssl(ASYNC, OK); | 12028 SSLSocketDataProvider ssl(ASYNC, OK); |
| 12029 ssl.SetNextProto(GetParam()); | 12029 ssl.SetNextProto(GetParam()); |
| 12030 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 12030 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 12031 | 12031 |
| 12032 scoped_ptr<SpdyFrame> host1_req( | 12032 scoped_ptr<SpdyFrame> host1_req( |
| 12033 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); | 12033 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); |
| 12034 scoped_ptr<SpdyFrame> host2_req( | 12034 scoped_ptr<SpdyFrame> host2_req( |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12154 | 12154 |
| 12155 SequencedSocketData data2(reads2, arraysize(reads2), writes2, | 12155 SequencedSocketData data2(reads2, arraysize(reads2), writes2, |
| 12156 arraysize(writes2)); | 12156 arraysize(writes2)); |
| 12157 | 12157 |
| 12158 SSLSocketDataProvider ssl(ASYNC, OK); | 12158 SSLSocketDataProvider ssl(ASYNC, OK); |
| 12159 ssl.SetNextProto(GetParam()); | 12159 ssl.SetNextProto(GetParam()); |
| 12160 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 12160 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 12161 session_deps_.socket_factory->AddSocketDataProvider(&data1); | 12161 session_deps_.socket_factory->AddSocketDataProvider(&data1); |
| 12162 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 12162 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
| 12163 | 12163 |
| 12164 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12164 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12165 | 12165 |
| 12166 // Start the first transaction to set up the SpdySession | 12166 // Start the first transaction to set up the SpdySession |
| 12167 HttpRequestInfo request1; | 12167 HttpRequestInfo request1; |
| 12168 request1.method = "GET"; | 12168 request1.method = "GET"; |
| 12169 request1.url = GURL(https_url); | 12169 request1.url = GURL(https_url); |
| 12170 request1.load_flags = 0; | 12170 request1.load_flags = 0; |
| 12171 HttpNetworkTransaction trans1(LOWEST, session.get()); | 12171 HttpNetworkTransaction trans1(LOWEST, session.get()); |
| 12172 TestCompletionCallback callback1; | 12172 TestCompletionCallback callback1; |
| 12173 EXPECT_EQ(ERR_IO_PENDING, | 12173 EXPECT_EQ(ERR_IO_PENDING, |
| 12174 trans1.Start(&request1, callback1.callback(), BoundNetLog())); | 12174 trans1.Start(&request1, callback1.callback(), BoundNetLog())); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12266 vector_as_array(&writes), writes.size()); | 12266 vector_as_array(&writes), writes.size()); |
| 12267 session_deps_.socket_factory->AddSocketDataProvider(&data); | 12267 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 12268 | 12268 |
| 12269 // Connection to the origin fails. | 12269 // Connection to the origin fails. |
| 12270 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 12270 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 12271 StaticSocketDataProvider data_refused; | 12271 StaticSocketDataProvider data_refused; |
| 12272 data_refused.set_connect_data(mock_connect); | 12272 data_refused.set_connect_data(mock_connect); |
| 12273 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); | 12273 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); |
| 12274 | 12274 |
| 12275 session_deps_.use_alternative_services = true; | 12275 session_deps_.use_alternative_services = true; |
| 12276 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12276 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12277 base::WeakPtr<HttpServerProperties> http_server_properties = | 12277 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 12278 session->http_server_properties(); | 12278 session->http_server_properties(); |
| 12279 AlternativeService alternative_service( | 12279 AlternativeService alternative_service( |
| 12280 AlternateProtocolFromNextProto(GetParam()), alternative); | 12280 AlternateProtocolFromNextProto(GetParam()), alternative); |
| 12281 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 12281 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 12282 http_server_properties->SetAlternativeService(origin, alternative_service, | 12282 http_server_properties->SetAlternativeService(origin, alternative_service, |
| 12283 1.0, expiration); | 12283 1.0, expiration); |
| 12284 | 12284 |
| 12285 // First request to alternative. | 12285 // First request to alternative. |
| 12286 if (pooling) { | 12286 if (pooling) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12370 | 12370 |
| 12371 // This test documents that an alternate Job should not be used if HTTP/1.1 is | 12371 // This test documents that an alternate Job should not be used if HTTP/1.1 is |
| 12372 // negotiated. In order to test this, a failed connection to the origin is | 12372 // negotiated. In order to test this, a failed connection to the origin is |
| 12373 // mocked. This way the request relies on the alternate Job. | 12373 // mocked. This way the request relies on the alternate Job. |
| 12374 StaticSocketDataProvider data_refused; | 12374 StaticSocketDataProvider data_refused; |
| 12375 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); | 12375 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); |
| 12376 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); | 12376 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); |
| 12377 | 12377 |
| 12378 // Set up alternative service for origin. | 12378 // Set up alternative service for origin. |
| 12379 session_deps_.use_alternative_services = true; | 12379 session_deps_.use_alternative_services = true; |
| 12380 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12380 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12381 base::WeakPtr<HttpServerProperties> http_server_properties = | 12381 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 12382 session->http_server_properties(); | 12382 session->http_server_properties(); |
| 12383 AlternativeService alternative_service( | 12383 AlternativeService alternative_service( |
| 12384 AlternateProtocolFromNextProto(GetParam()), alternative); | 12384 AlternateProtocolFromNextProto(GetParam()), alternative); |
| 12385 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 12385 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 12386 http_server_properties->SetAlternativeService(origin, alternative_service, | 12386 http_server_properties->SetAlternativeService(origin, alternative_service, |
| 12387 1.0, expiration); | 12387 1.0, expiration); |
| 12388 | 12388 |
| 12389 scoped_ptr<HttpTransaction> trans( | 12389 scoped_ptr<HttpTransaction> trans( |
| 12390 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 12390 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12443 MockRead("Content-Type: text/html\r\n"), | 12443 MockRead("Content-Type: text/html\r\n"), |
| 12444 MockRead("Content-Length: 7\r\n\r\n"), | 12444 MockRead("Content-Length: 7\r\n\r\n"), |
| 12445 MockRead("another"), | 12445 MockRead("another"), |
| 12446 }; | 12446 }; |
| 12447 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), | 12447 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), |
| 12448 http_writes, arraysize(http_writes)); | 12448 http_writes, arraysize(http_writes)); |
| 12449 session_deps_.socket_factory->AddSocketDataProvider(&http_data); | 12449 session_deps_.socket_factory->AddSocketDataProvider(&http_data); |
| 12450 | 12450 |
| 12451 // Set up alternative service for origin. | 12451 // Set up alternative service for origin. |
| 12452 session_deps_.use_alternative_services = true; | 12452 session_deps_.use_alternative_services = true; |
| 12453 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12453 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12454 base::WeakPtr<HttpServerProperties> http_server_properties = | 12454 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 12455 session->http_server_properties(); | 12455 session->http_server_properties(); |
| 12456 AlternativeService alternative_service( | 12456 AlternativeService alternative_service( |
| 12457 AlternateProtocolFromNextProto(GetParam()), alternative); | 12457 AlternateProtocolFromNextProto(GetParam()), alternative); |
| 12458 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 12458 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 12459 http_server_properties->SetAlternativeService(origin, alternative_service, | 12459 http_server_properties->SetAlternativeService(origin, alternative_service, |
| 12460 1.0, expiration); | 12460 1.0, expiration); |
| 12461 | 12461 |
| 12462 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get()); | 12462 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get()); |
| 12463 HttpRequestInfo request1; | 12463 HttpRequestInfo request1; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12552 | 12552 |
| 12553 // This test documents that an alternate Job should not pool to an already | 12553 // This test documents that an alternate Job should not pool to an already |
| 12554 // existing HTTP/1.1 connection. In order to test this, a failed connection | 12554 // existing HTTP/1.1 connection. In order to test this, a failed connection |
| 12555 // to the origin is mocked. This way |request2| relies on the alternate Job. | 12555 // to the origin is mocked. This way |request2| relies on the alternate Job. |
| 12556 StaticSocketDataProvider data_refused; | 12556 StaticSocketDataProvider data_refused; |
| 12557 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); | 12557 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); |
| 12558 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); | 12558 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); |
| 12559 | 12559 |
| 12560 // Set up alternative service for origin. | 12560 // Set up alternative service for origin. |
| 12561 session_deps_.use_alternative_services = true; | 12561 session_deps_.use_alternative_services = true; |
| 12562 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12562 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12563 base::WeakPtr<HttpServerProperties> http_server_properties = | 12563 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 12564 session->http_server_properties(); | 12564 session->http_server_properties(); |
| 12565 AlternativeService alternative_service( | 12565 AlternativeService alternative_service( |
| 12566 AlternateProtocolFromNextProto(GetParam()), alternative); | 12566 AlternateProtocolFromNextProto(GetParam()), alternative); |
| 12567 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 12567 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 12568 http_server_properties->SetAlternativeService(origin, alternative_service, | 12568 http_server_properties->SetAlternativeService(origin, alternative_service, |
| 12569 1.0, expiration); | 12569 1.0, expiration); |
| 12570 | 12570 |
| 12571 // First transaction to alternative to open an HTTP/1.1 socket. | 12571 // First transaction to alternative to open an HTTP/1.1 socket. |
| 12572 scoped_ptr<HttpTransaction> trans1( | 12572 scoped_ptr<HttpTransaction> trans1( |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12686 TestNetLog log; | 12686 TestNetLog log; |
| 12687 session_deps_.net_log = &log; | 12687 session_deps_.net_log = &log; |
| 12688 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy | 12688 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy |
| 12689 ssl1.SetNextProto(GetParam()); | 12689 ssl1.SetNextProto(GetParam()); |
| 12690 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); | 12690 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); |
| 12691 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server | 12691 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server |
| 12692 ssl2.SetNextProto(GetParam()); | 12692 ssl2.SetNextProto(GetParam()); |
| 12693 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); | 12693 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 12694 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1); | 12694 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1); |
| 12695 | 12695 |
| 12696 scoped_refptr<HttpNetworkSession> session( | 12696 scoped_ptr<HttpNetworkSession> session( |
| 12697 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); | 12697 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); |
| 12698 | 12698 |
| 12699 // Start the first transaction to set up the SpdySession | 12699 // Start the first transaction to set up the SpdySession |
| 12700 HttpRequestInfo request1; | 12700 HttpRequestInfo request1; |
| 12701 request1.method = "GET"; | 12701 request1.method = "GET"; |
| 12702 request1.url = GURL(https_url); | 12702 request1.url = GURL(https_url); |
| 12703 request1.load_flags = 0; | 12703 request1.load_flags = 0; |
| 12704 HttpNetworkTransaction trans1(LOWEST, session.get()); | 12704 HttpNetworkTransaction trans1(LOWEST, session.get()); |
| 12705 TestCompletionCallback callback1; | 12705 TestCompletionCallback callback1; |
| 12706 EXPECT_EQ(ERR_IO_PENDING, | 12706 EXPECT_EQ(ERR_IO_PENDING, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12821 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server | 12821 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server |
| 12822 ssl2.SetNextProto(GetParam()); | 12822 ssl2.SetNextProto(GetParam()); |
| 12823 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); | 12823 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 12824 session_deps_.deterministic_socket_factory->AddSocketDataProvider( | 12824 session_deps_.deterministic_socket_factory->AddSocketDataProvider( |
| 12825 data2.get()); | 12825 data2.get()); |
| 12826 | 12826 |
| 12827 session_deps_.host_resolver.reset(new MockCachingHostResolver()); | 12827 session_deps_.host_resolver.reset(new MockCachingHostResolver()); |
| 12828 session_deps_.host_resolver->rules()->AddRule("news.example.org", ip_addr); | 12828 session_deps_.host_resolver->rules()->AddRule("news.example.org", ip_addr); |
| 12829 session_deps_.host_resolver->rules()->AddRule("proxy", ip_addr); | 12829 session_deps_.host_resolver->rules()->AddRule("proxy", ip_addr); |
| 12830 | 12830 |
| 12831 scoped_refptr<HttpNetworkSession> session( | 12831 scoped_ptr<HttpNetworkSession> session( |
| 12832 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); | 12832 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); |
| 12833 | 12833 |
| 12834 // Start the first transaction to set up the SpdySession | 12834 // Start the first transaction to set up the SpdySession |
| 12835 HttpRequestInfo request1; | 12835 HttpRequestInfo request1; |
| 12836 request1.method = "GET"; | 12836 request1.method = "GET"; |
| 12837 request1.url = GURL(url1); | 12837 request1.url = GURL(url1); |
| 12838 request1.load_flags = 0; | 12838 request1.load_flags = 0; |
| 12839 HttpNetworkTransaction trans1(LOWEST, session.get()); | 12839 HttpNetworkTransaction trans1(LOWEST, session.get()); |
| 12840 TestCompletionCallback callback1; | 12840 TestCompletionCallback callback1; |
| 12841 ASSERT_EQ(ERR_IO_PENDING, | 12841 ASSERT_EQ(ERR_IO_PENDING, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12896 SSLSocketDataProvider ssl1(ASYNC, OK); | 12896 SSLSocketDataProvider ssl1(ASYNC, OK); |
| 12897 ssl1.SetNextProto(GetParam()); | 12897 ssl1.SetNextProto(GetParam()); |
| 12898 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); | 12898 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); |
| 12899 session_deps_.socket_factory->AddSocketDataProvider(&data1); | 12899 session_deps_.socket_factory->AddSocketDataProvider(&data1); |
| 12900 | 12900 |
| 12901 SSLSocketDataProvider ssl2(ASYNC, OK); | 12901 SSLSocketDataProvider ssl2(ASYNC, OK); |
| 12902 ssl2.SetNextProto(GetParam()); | 12902 ssl2.SetNextProto(GetParam()); |
| 12903 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); | 12903 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 12904 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 12904 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
| 12905 | 12905 |
| 12906 scoped_refptr<HttpNetworkSession> session( | 12906 scoped_ptr<HttpNetworkSession> session( |
| 12907 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 12907 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
| 12908 | 12908 |
| 12909 // Start the first transaction to set up the SpdySession and verify that | 12909 // Start the first transaction to set up the SpdySession and verify that |
| 12910 // connection was closed. | 12910 // connection was closed. |
| 12911 HttpRequestInfo request1; | 12911 HttpRequestInfo request1; |
| 12912 request1.method = "GET"; | 12912 request1.method = "GET"; |
| 12913 request1.url = GURL(https_url); | 12913 request1.url = GURL(https_url); |
| 12914 request1.load_flags = 0; | 12914 request1.load_flags = 0; |
| 12915 HttpNetworkTransaction trans1(MEDIUM, session.get()); | 12915 HttpNetworkTransaction trans1(MEDIUM, session.get()); |
| 12916 TestCompletionCallback callback1; | 12916 TestCompletionCallback callback1; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 12935 TEST_P(HttpNetworkTransactionTest, CloseIdleSpdySessionToOpenNewOne) { | 12935 TEST_P(HttpNetworkTransactionTest, CloseIdleSpdySessionToOpenNewOne) { |
| 12936 session_deps_.next_protos = SpdyNextProtos(); | 12936 session_deps_.next_protos = SpdyNextProtos(); |
| 12937 ClientSocketPoolManager::set_max_sockets_per_group( | 12937 ClientSocketPoolManager::set_max_sockets_per_group( |
| 12938 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); | 12938 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); |
| 12939 ClientSocketPoolManager::set_max_sockets_per_pool( | 12939 ClientSocketPoolManager::set_max_sockets_per_pool( |
| 12940 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); | 12940 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); |
| 12941 | 12941 |
| 12942 // Use two different hosts with different IPs so they don't get pooled. | 12942 // Use two different hosts with different IPs so they don't get pooled. |
| 12943 session_deps_.host_resolver->rules()->AddRule("www.a.com", "10.0.0.1"); | 12943 session_deps_.host_resolver->rules()->AddRule("www.a.com", "10.0.0.1"); |
| 12944 session_deps_.host_resolver->rules()->AddRule("www.b.com", "10.0.0.2"); | 12944 session_deps_.host_resolver->rules()->AddRule("www.b.com", "10.0.0.2"); |
| 12945 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12945 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12946 | 12946 |
| 12947 SSLSocketDataProvider ssl1(ASYNC, OK); | 12947 SSLSocketDataProvider ssl1(ASYNC, OK); |
| 12948 ssl1.SetNextProto(GetParam()); | 12948 ssl1.SetNextProto(GetParam()); |
| 12949 SSLSocketDataProvider ssl2(ASYNC, OK); | 12949 SSLSocketDataProvider ssl2(ASYNC, OK); |
| 12950 ssl2.SetNextProto(GetParam()); | 12950 ssl2.SetNextProto(GetParam()); |
| 12951 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); | 12951 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); |
| 12952 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); | 12952 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 12953 | 12953 |
| 12954 scoped_ptr<SpdyFrame> host1_req(spdy_util_.ConstructSpdyGet( | 12954 scoped_ptr<SpdyFrame> host1_req(spdy_util_.ConstructSpdyGet( |
| 12955 "https://www.a.com", false, 1, DEFAULT_PRIORITY)); | 12955 "https://www.a.com", false, 1, DEFAULT_PRIORITY)); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13095 EXPECT_FALSE( | 13095 EXPECT_FALSE( |
| 13096 HasSpdySession(session->spdy_session_pool(), spdy_session_key_b)); | 13096 HasSpdySession(session->spdy_session_pool(), spdy_session_key_b)); |
| 13097 } | 13097 } |
| 13098 | 13098 |
| 13099 TEST_P(HttpNetworkTransactionTest, HttpSyncConnectError) { | 13099 TEST_P(HttpNetworkTransactionTest, HttpSyncConnectError) { |
| 13100 HttpRequestInfo request; | 13100 HttpRequestInfo request; |
| 13101 request.method = "GET"; | 13101 request.method = "GET"; |
| 13102 request.url = GURL("http://www.example.org/"); | 13102 request.url = GURL("http://www.example.org/"); |
| 13103 request.load_flags = 0; | 13103 request.load_flags = 0; |
| 13104 | 13104 |
| 13105 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13105 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13106 scoped_ptr<HttpTransaction> trans( | 13106 scoped_ptr<HttpTransaction> trans( |
| 13107 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13107 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13108 | 13108 |
| 13109 MockConnect mock_connect(SYNCHRONOUS, ERR_NAME_NOT_RESOLVED); | 13109 MockConnect mock_connect(SYNCHRONOUS, ERR_NAME_NOT_RESOLVED); |
| 13110 StaticSocketDataProvider data; | 13110 StaticSocketDataProvider data; |
| 13111 data.set_connect_data(mock_connect); | 13111 data.set_connect_data(mock_connect); |
| 13112 session_deps_.socket_factory->AddSocketDataProvider(&data); | 13112 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 13113 | 13113 |
| 13114 TestCompletionCallback callback; | 13114 TestCompletionCallback callback; |
| 13115 | 13115 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 13132 EXPECT_FALSE(trans->GetRemoteEndpoint(&endpoint)); | 13132 EXPECT_FALSE(trans->GetRemoteEndpoint(&endpoint)); |
| 13133 EXPECT_TRUE(endpoint.address().empty()); | 13133 EXPECT_TRUE(endpoint.address().empty()); |
| 13134 } | 13134 } |
| 13135 | 13135 |
| 13136 TEST_P(HttpNetworkTransactionTest, HttpAsyncConnectError) { | 13136 TEST_P(HttpNetworkTransactionTest, HttpAsyncConnectError) { |
| 13137 HttpRequestInfo request; | 13137 HttpRequestInfo request; |
| 13138 request.method = "GET"; | 13138 request.method = "GET"; |
| 13139 request.url = GURL("http://www.example.org/"); | 13139 request.url = GURL("http://www.example.org/"); |
| 13140 request.load_flags = 0; | 13140 request.load_flags = 0; |
| 13141 | 13141 |
| 13142 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13142 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13143 scoped_ptr<HttpTransaction> trans( | 13143 scoped_ptr<HttpTransaction> trans( |
| 13144 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13144 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13145 | 13145 |
| 13146 MockConnect mock_connect(ASYNC, ERR_NAME_NOT_RESOLVED); | 13146 MockConnect mock_connect(ASYNC, ERR_NAME_NOT_RESOLVED); |
| 13147 StaticSocketDataProvider data; | 13147 StaticSocketDataProvider data; |
| 13148 data.set_connect_data(mock_connect); | 13148 data.set_connect_data(mock_connect); |
| 13149 session_deps_.socket_factory->AddSocketDataProvider(&data); | 13149 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 13150 | 13150 |
| 13151 TestCompletionCallback callback; | 13151 TestCompletionCallback callback; |
| 13152 | 13152 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 13169 EXPECT_FALSE(trans->GetRemoteEndpoint(&endpoint)); | 13169 EXPECT_FALSE(trans->GetRemoteEndpoint(&endpoint)); |
| 13170 EXPECT_TRUE(endpoint.address().empty()); | 13170 EXPECT_TRUE(endpoint.address().empty()); |
| 13171 } | 13171 } |
| 13172 | 13172 |
| 13173 TEST_P(HttpNetworkTransactionTest, HttpSyncWriteError) { | 13173 TEST_P(HttpNetworkTransactionTest, HttpSyncWriteError) { |
| 13174 HttpRequestInfo request; | 13174 HttpRequestInfo request; |
| 13175 request.method = "GET"; | 13175 request.method = "GET"; |
| 13176 request.url = GURL("http://www.example.org/"); | 13176 request.url = GURL("http://www.example.org/"); |
| 13177 request.load_flags = 0; | 13177 request.load_flags = 0; |
| 13178 | 13178 |
| 13179 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13179 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13180 scoped_ptr<HttpTransaction> trans( | 13180 scoped_ptr<HttpTransaction> trans( |
| 13181 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13181 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13182 | 13182 |
| 13183 MockWrite data_writes[] = { | 13183 MockWrite data_writes[] = { |
| 13184 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 13184 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 13185 }; | 13185 }; |
| 13186 MockRead data_reads[] = { | 13186 MockRead data_reads[] = { |
| 13187 MockRead(SYNCHRONOUS, ERR_UNEXPECTED), // Should not be reached. | 13187 MockRead(SYNCHRONOUS, ERR_UNEXPECTED), // Should not be reached. |
| 13188 }; | 13188 }; |
| 13189 | 13189 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 13203 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); | 13203 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); |
| 13204 EXPECT_TRUE(request_headers.HasHeader("Host")); | 13204 EXPECT_TRUE(request_headers.HasHeader("Host")); |
| 13205 } | 13205 } |
| 13206 | 13206 |
| 13207 TEST_P(HttpNetworkTransactionTest, HttpAsyncWriteError) { | 13207 TEST_P(HttpNetworkTransactionTest, HttpAsyncWriteError) { |
| 13208 HttpRequestInfo request; | 13208 HttpRequestInfo request; |
| 13209 request.method = "GET"; | 13209 request.method = "GET"; |
| 13210 request.url = GURL("http://www.example.org/"); | 13210 request.url = GURL("http://www.example.org/"); |
| 13211 request.load_flags = 0; | 13211 request.load_flags = 0; |
| 13212 | 13212 |
| 13213 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13213 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13214 scoped_ptr<HttpTransaction> trans( | 13214 scoped_ptr<HttpTransaction> trans( |
| 13215 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13215 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13216 | 13216 |
| 13217 MockWrite data_writes[] = { | 13217 MockWrite data_writes[] = { |
| 13218 MockWrite(ASYNC, ERR_CONNECTION_RESET), | 13218 MockWrite(ASYNC, ERR_CONNECTION_RESET), |
| 13219 }; | 13219 }; |
| 13220 MockRead data_reads[] = { | 13220 MockRead data_reads[] = { |
| 13221 MockRead(SYNCHRONOUS, ERR_UNEXPECTED), // Should not be reached. | 13221 MockRead(SYNCHRONOUS, ERR_UNEXPECTED), // Should not be reached. |
| 13222 }; | 13222 }; |
| 13223 | 13223 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 13237 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); | 13237 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); |
| 13238 EXPECT_TRUE(request_headers.HasHeader("Host")); | 13238 EXPECT_TRUE(request_headers.HasHeader("Host")); |
| 13239 } | 13239 } |
| 13240 | 13240 |
| 13241 TEST_P(HttpNetworkTransactionTest, HttpSyncReadError) { | 13241 TEST_P(HttpNetworkTransactionTest, HttpSyncReadError) { |
| 13242 HttpRequestInfo request; | 13242 HttpRequestInfo request; |
| 13243 request.method = "GET"; | 13243 request.method = "GET"; |
| 13244 request.url = GURL("http://www.example.org/"); | 13244 request.url = GURL("http://www.example.org/"); |
| 13245 request.load_flags = 0; | 13245 request.load_flags = 0; |
| 13246 | 13246 |
| 13247 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13247 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13248 scoped_ptr<HttpTransaction> trans( | 13248 scoped_ptr<HttpTransaction> trans( |
| 13249 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13249 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13250 | 13250 |
| 13251 MockWrite data_writes[] = { | 13251 MockWrite data_writes[] = { |
| 13252 MockWrite( | 13252 MockWrite( |
| 13253 "GET / HTTP/1.1\r\n" | 13253 "GET / HTTP/1.1\r\n" |
| 13254 "Host: www.example.org\r\n" | 13254 "Host: www.example.org\r\n" |
| 13255 "Connection: keep-alive\r\n\r\n"), | 13255 "Connection: keep-alive\r\n\r\n"), |
| 13256 }; | 13256 }; |
| 13257 MockRead data_reads[] = { | 13257 MockRead data_reads[] = { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 13274 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); | 13274 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); |
| 13275 EXPECT_TRUE(request_headers.HasHeader("Host")); | 13275 EXPECT_TRUE(request_headers.HasHeader("Host")); |
| 13276 } | 13276 } |
| 13277 | 13277 |
| 13278 TEST_P(HttpNetworkTransactionTest, HttpAsyncReadError) { | 13278 TEST_P(HttpNetworkTransactionTest, HttpAsyncReadError) { |
| 13279 HttpRequestInfo request; | 13279 HttpRequestInfo request; |
| 13280 request.method = "GET"; | 13280 request.method = "GET"; |
| 13281 request.url = GURL("http://www.example.org/"); | 13281 request.url = GURL("http://www.example.org/"); |
| 13282 request.load_flags = 0; | 13282 request.load_flags = 0; |
| 13283 | 13283 |
| 13284 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13284 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13285 scoped_ptr<HttpTransaction> trans( | 13285 scoped_ptr<HttpTransaction> trans( |
| 13286 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13286 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13287 | 13287 |
| 13288 MockWrite data_writes[] = { | 13288 MockWrite data_writes[] = { |
| 13289 MockWrite( | 13289 MockWrite( |
| 13290 "GET / HTTP/1.1\r\n" | 13290 "GET / HTTP/1.1\r\n" |
| 13291 "Host: www.example.org\r\n" | 13291 "Host: www.example.org\r\n" |
| 13292 "Connection: keep-alive\r\n\r\n"), | 13292 "Connection: keep-alive\r\n\r\n"), |
| 13293 }; | 13293 }; |
| 13294 MockRead data_reads[] = { | 13294 MockRead data_reads[] = { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 13312 EXPECT_TRUE(request_headers.HasHeader("Host")); | 13312 EXPECT_TRUE(request_headers.HasHeader("Host")); |
| 13313 } | 13313 } |
| 13314 | 13314 |
| 13315 TEST_P(HttpNetworkTransactionTest, GetFullRequestHeadersIncludesExtraHeader) { | 13315 TEST_P(HttpNetworkTransactionTest, GetFullRequestHeadersIncludesExtraHeader) { |
| 13316 HttpRequestInfo request; | 13316 HttpRequestInfo request; |
| 13317 request.method = "GET"; | 13317 request.method = "GET"; |
| 13318 request.url = GURL("http://www.example.org/"); | 13318 request.url = GURL("http://www.example.org/"); |
| 13319 request.load_flags = 0; | 13319 request.load_flags = 0; |
| 13320 request.extra_headers.SetHeader("X-Foo", "bar"); | 13320 request.extra_headers.SetHeader("X-Foo", "bar"); |
| 13321 | 13321 |
| 13322 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13322 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13323 scoped_ptr<HttpTransaction> trans( | 13323 scoped_ptr<HttpTransaction> trans( |
| 13324 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13324 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13325 | 13325 |
| 13326 MockWrite data_writes[] = { | 13326 MockWrite data_writes[] = { |
| 13327 MockWrite( | 13327 MockWrite( |
| 13328 "GET / HTTP/1.1\r\n" | 13328 "GET / HTTP/1.1\r\n" |
| 13329 "Host: www.example.org\r\n" | 13329 "Host: www.example.org\r\n" |
| 13330 "Connection: keep-alive\r\n" | 13330 "Connection: keep-alive\r\n" |
| 13331 "X-Foo: bar\r\n\r\n"), | 13331 "X-Foo: bar\r\n\r\n"), |
| 13332 }; | 13332 }; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13702 NOTREACHED(); | 13702 NOTREACHED(); |
| 13703 return scoped_ptr<WebSocketStream>(); | 13703 return scoped_ptr<WebSocketStream>(); |
| 13704 } | 13704 } |
| 13705 }; | 13705 }; |
| 13706 | 13706 |
| 13707 } // namespace | 13707 } // namespace |
| 13708 | 13708 |
| 13709 // Make sure that HttpNetworkTransaction passes on its priority to its | 13709 // Make sure that HttpNetworkTransaction passes on its priority to its |
| 13710 // stream request on start. | 13710 // stream request on start. |
| 13711 TEST_P(HttpNetworkTransactionTest, SetStreamRequestPriorityOnStart) { | 13711 TEST_P(HttpNetworkTransactionTest, SetStreamRequestPriorityOnStart) { |
| 13712 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13712 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13713 HttpNetworkSessionPeer peer(session); | 13713 HttpNetworkSessionPeer peer(session.get()); |
| 13714 FakeStreamFactory* fake_factory = new FakeStreamFactory(); | 13714 FakeStreamFactory* fake_factory = new FakeStreamFactory(); |
| 13715 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); | 13715 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); |
| 13716 | 13716 |
| 13717 HttpNetworkTransaction trans(LOW, session.get()); | 13717 HttpNetworkTransaction trans(LOW, session.get()); |
| 13718 | 13718 |
| 13719 ASSERT_TRUE(fake_factory->last_stream_request() == NULL); | 13719 ASSERT_TRUE(fake_factory->last_stream_request() == NULL); |
| 13720 | 13720 |
| 13721 HttpRequestInfo request; | 13721 HttpRequestInfo request; |
| 13722 TestCompletionCallback callback; | 13722 TestCompletionCallback callback; |
| 13723 EXPECT_EQ(ERR_IO_PENDING, | 13723 EXPECT_EQ(ERR_IO_PENDING, |
| 13724 trans.Start(&request, callback.callback(), BoundNetLog())); | 13724 trans.Start(&request, callback.callback(), BoundNetLog())); |
| 13725 | 13725 |
| 13726 base::WeakPtr<FakeStreamRequest> fake_request = | 13726 base::WeakPtr<FakeStreamRequest> fake_request = |
| 13727 fake_factory->last_stream_request(); | 13727 fake_factory->last_stream_request(); |
| 13728 ASSERT_TRUE(fake_request != NULL); | 13728 ASSERT_TRUE(fake_request != NULL); |
| 13729 EXPECT_EQ(LOW, fake_request->priority()); | 13729 EXPECT_EQ(LOW, fake_request->priority()); |
| 13730 } | 13730 } |
| 13731 | 13731 |
| 13732 // Make sure that HttpNetworkTransaction passes on its priority | 13732 // Make sure that HttpNetworkTransaction passes on its priority |
| 13733 // updates to its stream request. | 13733 // updates to its stream request. |
| 13734 TEST_P(HttpNetworkTransactionTest, SetStreamRequestPriority) { | 13734 TEST_P(HttpNetworkTransactionTest, SetStreamRequestPriority) { |
| 13735 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13735 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13736 HttpNetworkSessionPeer peer(session); | 13736 HttpNetworkSessionPeer peer(session.get()); |
| 13737 FakeStreamFactory* fake_factory = new FakeStreamFactory(); | 13737 FakeStreamFactory* fake_factory = new FakeStreamFactory(); |
| 13738 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); | 13738 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); |
| 13739 | 13739 |
| 13740 HttpNetworkTransaction trans(LOW, session.get()); | 13740 HttpNetworkTransaction trans(LOW, session.get()); |
| 13741 | 13741 |
| 13742 HttpRequestInfo request; | 13742 HttpRequestInfo request; |
| 13743 TestCompletionCallback callback; | 13743 TestCompletionCallback callback; |
| 13744 EXPECT_EQ(ERR_IO_PENDING, | 13744 EXPECT_EQ(ERR_IO_PENDING, |
| 13745 trans.Start(&request, callback.callback(), BoundNetLog())); | 13745 trans.Start(&request, callback.callback(), BoundNetLog())); |
| 13746 | 13746 |
| 13747 base::WeakPtr<FakeStreamRequest> fake_request = | 13747 base::WeakPtr<FakeStreamRequest> fake_request = |
| 13748 fake_factory->last_stream_request(); | 13748 fake_factory->last_stream_request(); |
| 13749 ASSERT_TRUE(fake_request != NULL); | 13749 ASSERT_TRUE(fake_request != NULL); |
| 13750 EXPECT_EQ(LOW, fake_request->priority()); | 13750 EXPECT_EQ(LOW, fake_request->priority()); |
| 13751 | 13751 |
| 13752 trans.SetPriority(LOWEST); | 13752 trans.SetPriority(LOWEST); |
| 13753 ASSERT_TRUE(fake_request != NULL); | 13753 ASSERT_TRUE(fake_request != NULL); |
| 13754 EXPECT_EQ(LOWEST, fake_request->priority()); | 13754 EXPECT_EQ(LOWEST, fake_request->priority()); |
| 13755 } | 13755 } |
| 13756 | 13756 |
| 13757 // Make sure that HttpNetworkTransaction passes on its priority | 13757 // Make sure that HttpNetworkTransaction passes on its priority |
| 13758 // updates to its stream. | 13758 // updates to its stream. |
| 13759 TEST_P(HttpNetworkTransactionTest, SetStreamPriority) { | 13759 TEST_P(HttpNetworkTransactionTest, SetStreamPriority) { |
| 13760 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13760 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13761 HttpNetworkSessionPeer peer(session); | 13761 HttpNetworkSessionPeer peer(session.get()); |
| 13762 FakeStreamFactory* fake_factory = new FakeStreamFactory(); | 13762 FakeStreamFactory* fake_factory = new FakeStreamFactory(); |
| 13763 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); | 13763 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); |
| 13764 | 13764 |
| 13765 HttpNetworkTransaction trans(LOW, session.get()); | 13765 HttpNetworkTransaction trans(LOW, session.get()); |
| 13766 | 13766 |
| 13767 HttpRequestInfo request; | 13767 HttpRequestInfo request; |
| 13768 TestCompletionCallback callback; | 13768 TestCompletionCallback callback; |
| 13769 EXPECT_EQ(ERR_IO_PENDING, | 13769 EXPECT_EQ(ERR_IO_PENDING, |
| 13770 trans.Start(&request, callback.callback(), BoundNetLog())); | 13770 trans.Start(&request, callback.callback(), BoundNetLog())); |
| 13771 | 13771 |
| 13772 base::WeakPtr<FakeStreamRequest> fake_request = | 13772 base::WeakPtr<FakeStreamRequest> fake_request = |
| 13773 fake_factory->last_stream_request(); | 13773 fake_factory->last_stream_request(); |
| 13774 ASSERT_TRUE(fake_request != NULL); | 13774 ASSERT_TRUE(fake_request != NULL); |
| 13775 base::WeakPtr<FakeStream> fake_stream = fake_request->FinishStreamRequest(); | 13775 base::WeakPtr<FakeStream> fake_stream = fake_request->FinishStreamRequest(); |
| 13776 ASSERT_TRUE(fake_stream != NULL); | 13776 ASSERT_TRUE(fake_stream != NULL); |
| 13777 EXPECT_EQ(LOW, fake_stream->priority()); | 13777 EXPECT_EQ(LOW, fake_stream->priority()); |
| 13778 | 13778 |
| 13779 trans.SetPriority(LOWEST); | 13779 trans.SetPriority(LOWEST); |
| 13780 EXPECT_EQ(LOWEST, fake_stream->priority()); | 13780 EXPECT_EQ(LOWEST, fake_stream->priority()); |
| 13781 } | 13781 } |
| 13782 | 13782 |
| 13783 TEST_P(HttpNetworkTransactionTest, CreateWebSocketHandshakeStream) { | 13783 TEST_P(HttpNetworkTransactionTest, CreateWebSocketHandshakeStream) { |
| 13784 // The same logic needs to be tested for both ws: and wss: schemes, but this | 13784 // The same logic needs to be tested for both ws: and wss: schemes, but this |
| 13785 // test is already parameterised on NextProto, so it uses a loop to verify | 13785 // test is already parameterised on NextProto, so it uses a loop to verify |
| 13786 // that the different schemes work. | 13786 // that the different schemes work. |
| 13787 std::string test_cases[] = {"ws://www.example.org/", | 13787 std::string test_cases[] = {"ws://www.example.org/", |
| 13788 "wss://www.example.org/"}; | 13788 "wss://www.example.org/"}; |
| 13789 for (size_t i = 0; i < arraysize(test_cases); ++i) { | 13789 for (size_t i = 0; i < arraysize(test_cases); ++i) { |
| 13790 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13790 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13791 HttpNetworkSessionPeer peer(session); | 13791 HttpNetworkSessionPeer peer(session.get()); |
| 13792 FakeStreamFactory* fake_factory = new FakeStreamFactory(); | 13792 FakeStreamFactory* fake_factory = new FakeStreamFactory(); |
| 13793 FakeWebSocketStreamCreateHelper websocket_stream_create_helper; | 13793 FakeWebSocketStreamCreateHelper websocket_stream_create_helper; |
| 13794 peer.SetHttpStreamFactoryForWebSocket( | 13794 peer.SetHttpStreamFactoryForWebSocket( |
| 13795 scoped_ptr<HttpStreamFactory>(fake_factory)); | 13795 scoped_ptr<HttpStreamFactory>(fake_factory)); |
| 13796 | 13796 |
| 13797 HttpNetworkTransaction trans(LOW, session.get()); | 13797 HttpNetworkTransaction trans(LOW, session.get()); |
| 13798 trans.SetWebSocketHandshakeStreamCreateHelper( | 13798 trans.SetWebSocketHandshakeStreamCreateHelper( |
| 13799 &websocket_stream_create_helper); | 13799 &websocket_stream_create_helper); |
| 13800 | 13800 |
| 13801 HttpRequestInfo request; | 13801 HttpRequestInfo request; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13862 MockRead http_reads[] = { | 13862 MockRead http_reads[] = { |
| 13863 MockRead("HTTP/1.1 200 OK\r\n"), | 13863 MockRead("HTTP/1.1 200 OK\r\n"), |
| 13864 MockRead("Content-Length: 7\r\n\r\n"), | 13864 MockRead("Content-Length: 7\r\n\r\n"), |
| 13865 MockRead("falafel"), | 13865 MockRead("falafel"), |
| 13866 MockRead(SYNCHRONOUS, OK), | 13866 MockRead(SYNCHRONOUS, OK), |
| 13867 }; | 13867 }; |
| 13868 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), | 13868 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), |
| 13869 http_writes, arraysize(http_writes)); | 13869 http_writes, arraysize(http_writes)); |
| 13870 session_deps_.socket_factory->AddSocketDataProvider(&http_data); | 13870 session_deps_.socket_factory->AddSocketDataProvider(&http_data); |
| 13871 | 13871 |
| 13872 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13872 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13873 | 13873 |
| 13874 // Start the SSL request. | 13874 // Start the SSL request. |
| 13875 TestCompletionCallback ssl_callback; | 13875 TestCompletionCallback ssl_callback; |
| 13876 scoped_ptr<HttpTransaction> ssl_trans( | 13876 scoped_ptr<HttpTransaction> ssl_trans( |
| 13877 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13877 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13878 ASSERT_EQ(ERR_IO_PENDING, | 13878 ASSERT_EQ(ERR_IO_PENDING, |
| 13879 ssl_trans->Start(&ssl_request, ssl_callback.callback(), | 13879 ssl_trans->Start(&ssl_request, ssl_callback.callback(), |
| 13880 BoundNetLog())); | 13880 BoundNetLog())); |
| 13881 | 13881 |
| 13882 // Start the HTTP request. Pool should stall. | 13882 // Start the HTTP request. Pool should stall. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13944 MockRead http_reads[] = { | 13944 MockRead http_reads[] = { |
| 13945 MockRead("HTTP/1.1 200 OK\r\n"), | 13945 MockRead("HTTP/1.1 200 OK\r\n"), |
| 13946 MockRead("Content-Length: 7\r\n\r\n"), | 13946 MockRead("Content-Length: 7\r\n\r\n"), |
| 13947 MockRead("falafel"), | 13947 MockRead("falafel"), |
| 13948 MockRead(SYNCHRONOUS, OK), | 13948 MockRead(SYNCHRONOUS, OK), |
| 13949 }; | 13949 }; |
| 13950 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), | 13950 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), |
| 13951 http_writes, arraysize(http_writes)); | 13951 http_writes, arraysize(http_writes)); |
| 13952 session_deps_.socket_factory->AddSocketDataProvider(&http_data); | 13952 session_deps_.socket_factory->AddSocketDataProvider(&http_data); |
| 13953 | 13953 |
| 13954 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13954 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13955 | 13955 |
| 13956 // Preconnect an SSL socket. A preconnect is needed because connect jobs are | 13956 // Preconnect an SSL socket. A preconnect is needed because connect jobs are |
| 13957 // cancelled when a normal transaction is cancelled. | 13957 // cancelled when a normal transaction is cancelled. |
| 13958 HttpStreamFactory* http_stream_factory = session->http_stream_factory(); | 13958 HttpStreamFactory* http_stream_factory = session->http_stream_factory(); |
| 13959 SSLConfig ssl_config; | 13959 SSLConfig ssl_config; |
| 13960 session->ssl_config_service()->GetSSLConfig(&ssl_config); | 13960 session->ssl_config_service()->GetSSLConfig(&ssl_config); |
| 13961 http_stream_factory->PreconnectStreams(1, ssl_request, ssl_config, | 13961 http_stream_factory->PreconnectStreams(1, ssl_request, ssl_config, |
| 13962 ssl_config); | 13962 ssl_config); |
| 13963 EXPECT_EQ(0, GetIdleSocketCountInSSLSocketPool(session.get())); | 13963 EXPECT_EQ(0, GetIdleSocketCountInSSLSocketPool(session.get())); |
| 13964 | 13964 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 13985 ScopedVector<UploadElementReader> element_readers; | 13985 ScopedVector<UploadElementReader> element_readers; |
| 13986 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 13986 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 13987 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 13987 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 13988 | 13988 |
| 13989 HttpRequestInfo request; | 13989 HttpRequestInfo request; |
| 13990 request.method = "POST"; | 13990 request.method = "POST"; |
| 13991 request.url = GURL("http://www.foo.com/"); | 13991 request.url = GURL("http://www.foo.com/"); |
| 13992 request.upload_data_stream = &upload_data_stream; | 13992 request.upload_data_stream = &upload_data_stream; |
| 13993 request.load_flags = 0; | 13993 request.load_flags = 0; |
| 13994 | 13994 |
| 13995 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13995 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13996 scoped_ptr<HttpTransaction> trans( | 13996 scoped_ptr<HttpTransaction> trans( |
| 13997 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13997 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13998 // Send headers successfully, but get an error while sending the body. | 13998 // Send headers successfully, but get an error while sending the body. |
| 13999 MockWrite data_writes[] = { | 13999 MockWrite data_writes[] = { |
| 14000 MockWrite("POST / HTTP/1.1\r\n" | 14000 MockWrite("POST / HTTP/1.1\r\n" |
| 14001 "Host: www.foo.com\r\n" | 14001 "Host: www.foo.com\r\n" |
| 14002 "Connection: keep-alive\r\n" | 14002 "Connection: keep-alive\r\n" |
| 14003 "Content-Length: 3\r\n\r\n"), | 14003 "Content-Length: 3\r\n\r\n"), |
| 14004 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14004 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14005 }; | 14005 }; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 14030 std::string response_data; | 14030 std::string response_data; |
| 14031 rv = ReadTransaction(trans.get(), &response_data); | 14031 rv = ReadTransaction(trans.get(), &response_data); |
| 14032 EXPECT_EQ(OK, rv); | 14032 EXPECT_EQ(OK, rv); |
| 14033 EXPECT_EQ("hello world", response_data); | 14033 EXPECT_EQ("hello world", response_data); |
| 14034 } | 14034 } |
| 14035 | 14035 |
| 14036 // This test makes sure the retry logic doesn't trigger when reading an error | 14036 // This test makes sure the retry logic doesn't trigger when reading an error |
| 14037 // response from a server that rejected a POST with a CONNECTION_RESET. | 14037 // response from a server that rejected a POST with a CONNECTION_RESET. |
| 14038 TEST_P(HttpNetworkTransactionTest, | 14038 TEST_P(HttpNetworkTransactionTest, |
| 14039 PostReadsErrorResponseAfterResetOnReusedSocket) { | 14039 PostReadsErrorResponseAfterResetOnReusedSocket) { |
| 14040 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14040 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14041 MockWrite data_writes[] = { | 14041 MockWrite data_writes[] = { |
| 14042 MockWrite("GET / HTTP/1.1\r\n" | 14042 MockWrite("GET / HTTP/1.1\r\n" |
| 14043 "Host: www.foo.com\r\n" | 14043 "Host: www.foo.com\r\n" |
| 14044 "Connection: keep-alive\r\n\r\n"), | 14044 "Connection: keep-alive\r\n\r\n"), |
| 14045 MockWrite("POST / HTTP/1.1\r\n" | 14045 MockWrite("POST / HTTP/1.1\r\n" |
| 14046 "Host: www.foo.com\r\n" | 14046 "Host: www.foo.com\r\n" |
| 14047 "Connection: keep-alive\r\n" | 14047 "Connection: keep-alive\r\n" |
| 14048 "Content-Length: 3\r\n\r\n"), | 14048 "Content-Length: 3\r\n\r\n"), |
| 14049 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14049 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14050 }; | 14050 }; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14124 ScopedVector<UploadElementReader> element_readers; | 14124 ScopedVector<UploadElementReader> element_readers; |
| 14125 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14125 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14126 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14126 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14127 | 14127 |
| 14128 HttpRequestInfo request; | 14128 HttpRequestInfo request; |
| 14129 request.method = "POST"; | 14129 request.method = "POST"; |
| 14130 request.url = GURL("http://www.foo.com/"); | 14130 request.url = GURL("http://www.foo.com/"); |
| 14131 request.upload_data_stream = &upload_data_stream; | 14131 request.upload_data_stream = &upload_data_stream; |
| 14132 request.load_flags = 0; | 14132 request.load_flags = 0; |
| 14133 | 14133 |
| 14134 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14134 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14135 scoped_ptr<HttpTransaction> trans( | 14135 scoped_ptr<HttpTransaction> trans( |
| 14136 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14136 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14137 // Send headers successfully, but get an error while sending the body. | 14137 // Send headers successfully, but get an error while sending the body. |
| 14138 MockWrite data_writes[] = { | 14138 MockWrite data_writes[] = { |
| 14139 MockWrite("POST / HTTP/1.1\r\n" | 14139 MockWrite("POST / HTTP/1.1\r\n" |
| 14140 "Host: www.foo.com\r\n" | 14140 "Host: www.foo.com\r\n" |
| 14141 "Connection: keep-alive\r\n" | 14141 "Connection: keep-alive\r\n" |
| 14142 "Content-Length: 3\r\n\r\n" | 14142 "Content-Length: 3\r\n\r\n" |
| 14143 "fo"), | 14143 "fo"), |
| 14144 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14144 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14179 ScopedVector<UploadElementReader> element_readers; | 14179 ScopedVector<UploadElementReader> element_readers; |
| 14180 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14180 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14181 ChunkedUploadDataStream upload_data_stream(0); | 14181 ChunkedUploadDataStream upload_data_stream(0); |
| 14182 | 14182 |
| 14183 HttpRequestInfo request; | 14183 HttpRequestInfo request; |
| 14184 request.method = "POST"; | 14184 request.method = "POST"; |
| 14185 request.url = GURL("http://www.foo.com/"); | 14185 request.url = GURL("http://www.foo.com/"); |
| 14186 request.upload_data_stream = &upload_data_stream; | 14186 request.upload_data_stream = &upload_data_stream; |
| 14187 request.load_flags = 0; | 14187 request.load_flags = 0; |
| 14188 | 14188 |
| 14189 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14189 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14190 scoped_ptr<HttpTransaction> trans( | 14190 scoped_ptr<HttpTransaction> trans( |
| 14191 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14191 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14192 // Send headers successfully, but get an error while sending the body. | 14192 // Send headers successfully, but get an error while sending the body. |
| 14193 MockWrite data_writes[] = { | 14193 MockWrite data_writes[] = { |
| 14194 MockWrite("POST / HTTP/1.1\r\n" | 14194 MockWrite("POST / HTTP/1.1\r\n" |
| 14195 "Host: www.foo.com\r\n" | 14195 "Host: www.foo.com\r\n" |
| 14196 "Connection: keep-alive\r\n" | 14196 "Connection: keep-alive\r\n" |
| 14197 "Transfer-Encoding: chunked\r\n\r\n"), | 14197 "Transfer-Encoding: chunked\r\n\r\n"), |
| 14198 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14198 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14199 }; | 14199 }; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14238 ScopedVector<UploadElementReader> element_readers; | 14238 ScopedVector<UploadElementReader> element_readers; |
| 14239 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14239 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14240 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14240 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14241 | 14241 |
| 14242 HttpRequestInfo request; | 14242 HttpRequestInfo request; |
| 14243 request.method = "POST"; | 14243 request.method = "POST"; |
| 14244 request.url = GURL("http://www.foo.com/"); | 14244 request.url = GURL("http://www.foo.com/"); |
| 14245 request.upload_data_stream = &upload_data_stream; | 14245 request.upload_data_stream = &upload_data_stream; |
| 14246 request.load_flags = 0; | 14246 request.load_flags = 0; |
| 14247 | 14247 |
| 14248 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14248 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14249 scoped_ptr<HttpTransaction> trans( | 14249 scoped_ptr<HttpTransaction> trans( |
| 14250 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14250 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14251 | 14251 |
| 14252 MockWrite data_writes[] = { | 14252 MockWrite data_writes[] = { |
| 14253 MockWrite("POST / HTTP/1.1\r\n" | 14253 MockWrite("POST / HTTP/1.1\r\n" |
| 14254 "Host: www.foo.com\r\n" | 14254 "Host: www.foo.com\r\n" |
| 14255 "Connection: keep-alive\r\n" | 14255 "Connection: keep-alive\r\n" |
| 14256 "Content-Length: 3\r\n\r\n"), | 14256 "Content-Length: 3\r\n\r\n"), |
| 14257 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14257 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14258 }; | 14258 }; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14291 ScopedVector<UploadElementReader> element_readers; | 14291 ScopedVector<UploadElementReader> element_readers; |
| 14292 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14292 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14293 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14293 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14294 | 14294 |
| 14295 HttpRequestInfo request; | 14295 HttpRequestInfo request; |
| 14296 request.method = "POST"; | 14296 request.method = "POST"; |
| 14297 request.url = GURL("http://www.foo.com/"); | 14297 request.url = GURL("http://www.foo.com/"); |
| 14298 request.upload_data_stream = &upload_data_stream; | 14298 request.upload_data_stream = &upload_data_stream; |
| 14299 request.load_flags = 0; | 14299 request.load_flags = 0; |
| 14300 | 14300 |
| 14301 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14301 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14302 scoped_ptr<HttpTransaction> trans( | 14302 scoped_ptr<HttpTransaction> trans( |
| 14303 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14303 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14304 // Send headers successfully, but get an error while sending the body. | 14304 // Send headers successfully, but get an error while sending the body. |
| 14305 MockWrite data_writes[] = { | 14305 MockWrite data_writes[] = { |
| 14306 MockWrite("POST / HTTP/1.1\r\n" | 14306 MockWrite("POST / HTTP/1.1\r\n" |
| 14307 "Host: www.foo.com\r\n" | 14307 "Host: www.foo.com\r\n" |
| 14308 "Connection: keep-alive\r\n" | 14308 "Connection: keep-alive\r\n" |
| 14309 "Content-Length: 3\r\n\r\n"), | 14309 "Content-Length: 3\r\n\r\n"), |
| 14310 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14310 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14311 }; | 14311 }; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 14333 ScopedVector<UploadElementReader> element_readers; | 14333 ScopedVector<UploadElementReader> element_readers; |
| 14334 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14334 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14335 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14335 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14336 | 14336 |
| 14337 HttpRequestInfo request; | 14337 HttpRequestInfo request; |
| 14338 request.method = "POST"; | 14338 request.method = "POST"; |
| 14339 request.url = GURL("http://www.foo.com/"); | 14339 request.url = GURL("http://www.foo.com/"); |
| 14340 request.upload_data_stream = &upload_data_stream; | 14340 request.upload_data_stream = &upload_data_stream; |
| 14341 request.load_flags = 0; | 14341 request.load_flags = 0; |
| 14342 | 14342 |
| 14343 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14343 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14344 scoped_ptr<HttpTransaction> trans( | 14344 scoped_ptr<HttpTransaction> trans( |
| 14345 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14345 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14346 // Send headers successfully, but get an error while sending the body. | 14346 // Send headers successfully, but get an error while sending the body. |
| 14347 MockWrite data_writes[] = { | 14347 MockWrite data_writes[] = { |
| 14348 MockWrite("POST / HTTP/1.1\r\n" | 14348 MockWrite("POST / HTTP/1.1\r\n" |
| 14349 "Host: www.foo.com\r\n" | 14349 "Host: www.foo.com\r\n" |
| 14350 "Connection: keep-alive\r\n" | 14350 "Connection: keep-alive\r\n" |
| 14351 "Content-Length: 3\r\n\r\n"), | 14351 "Content-Length: 3\r\n\r\n"), |
| 14352 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14352 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14353 }; | 14353 }; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 14376 ScopedVector<UploadElementReader> element_readers; | 14376 ScopedVector<UploadElementReader> element_readers; |
| 14377 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14377 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14378 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14378 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14379 | 14379 |
| 14380 HttpRequestInfo request; | 14380 HttpRequestInfo request; |
| 14381 request.method = "POST"; | 14381 request.method = "POST"; |
| 14382 request.url = GURL("http://www.foo.com/"); | 14382 request.url = GURL("http://www.foo.com/"); |
| 14383 request.upload_data_stream = &upload_data_stream; | 14383 request.upload_data_stream = &upload_data_stream; |
| 14384 request.load_flags = 0; | 14384 request.load_flags = 0; |
| 14385 | 14385 |
| 14386 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14386 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14387 scoped_ptr<HttpTransaction> trans( | 14387 scoped_ptr<HttpTransaction> trans( |
| 14388 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14388 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14389 // Send headers successfully, but get an error while sending the body. | 14389 // Send headers successfully, but get an error while sending the body. |
| 14390 MockWrite data_writes[] = { | 14390 MockWrite data_writes[] = { |
| 14391 MockWrite("POST / HTTP/1.1\r\n" | 14391 MockWrite("POST / HTTP/1.1\r\n" |
| 14392 "Host: www.foo.com\r\n" | 14392 "Host: www.foo.com\r\n" |
| 14393 "Connection: keep-alive\r\n" | 14393 "Connection: keep-alive\r\n" |
| 14394 "Content-Length: 3\r\n\r\n"), | 14394 "Content-Length: 3\r\n\r\n"), |
| 14395 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14395 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14396 }; | 14396 }; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 14416 ScopedVector<UploadElementReader> element_readers; | 14416 ScopedVector<UploadElementReader> element_readers; |
| 14417 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14417 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14418 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14418 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14419 | 14419 |
| 14420 HttpRequestInfo request; | 14420 HttpRequestInfo request; |
| 14421 request.method = "POST"; | 14421 request.method = "POST"; |
| 14422 request.url = GURL("http://www.foo.com/"); | 14422 request.url = GURL("http://www.foo.com/"); |
| 14423 request.upload_data_stream = &upload_data_stream; | 14423 request.upload_data_stream = &upload_data_stream; |
| 14424 request.load_flags = 0; | 14424 request.load_flags = 0; |
| 14425 | 14425 |
| 14426 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14426 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14427 scoped_ptr<HttpTransaction> trans( | 14427 scoped_ptr<HttpTransaction> trans( |
| 14428 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14428 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14429 // Send headers successfully, but get an error while sending the body. | 14429 // Send headers successfully, but get an error while sending the body. |
| 14430 MockWrite data_writes[] = { | 14430 MockWrite data_writes[] = { |
| 14431 MockWrite("POST / HTTP/1.1\r\n" | 14431 MockWrite("POST / HTTP/1.1\r\n" |
| 14432 "Host: www.foo.com\r\n" | 14432 "Host: www.foo.com\r\n" |
| 14433 "Connection: keep-alive\r\n" | 14433 "Connection: keep-alive\r\n" |
| 14434 "Content-Length: 3\r\n\r\n"), | 14434 "Content-Length: 3\r\n\r\n"), |
| 14435 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14435 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14436 }; | 14436 }; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 14457 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWssTunnel) { | 14457 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWssTunnel) { |
| 14458 HttpRequestInfo request; | 14458 HttpRequestInfo request; |
| 14459 request.method = "GET"; | 14459 request.method = "GET"; |
| 14460 request.url = GURL("wss://www.example.org/"); | 14460 request.url = GURL("wss://www.example.org/"); |
| 14461 AddWebSocketHeaders(&request.extra_headers); | 14461 AddWebSocketHeaders(&request.extra_headers); |
| 14462 | 14462 |
| 14463 // Configure against proxy server "myproxy:70". | 14463 // Configure against proxy server "myproxy:70". |
| 14464 session_deps_.proxy_service = | 14464 session_deps_.proxy_service = |
| 14465 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); | 14465 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 14466 | 14466 |
| 14467 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14467 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14468 | 14468 |
| 14469 // Since a proxy is configured, try to establish a tunnel. | 14469 // Since a proxy is configured, try to establish a tunnel. |
| 14470 MockWrite data_writes[] = { | 14470 MockWrite data_writes[] = { |
| 14471 MockWrite( | 14471 MockWrite( |
| 14472 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 14472 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 14473 "Host: www.example.org\r\n" | 14473 "Host: www.example.org\r\n" |
| 14474 "Proxy-Connection: keep-alive\r\n\r\n"), | 14474 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 14475 | 14475 |
| 14476 // After calling trans->RestartWithAuth(), this is the request we should | 14476 // After calling trans->RestartWithAuth(), this is the request we should |
| 14477 // be issuing -- the final header line contains the credentials. | 14477 // be issuing -- the final header line contains the credentials. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14563 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWsTunnel) { | 14563 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWsTunnel) { |
| 14564 HttpRequestInfo request; | 14564 HttpRequestInfo request; |
| 14565 request.method = "GET"; | 14565 request.method = "GET"; |
| 14566 request.url = GURL("ws://www.example.org/"); | 14566 request.url = GURL("ws://www.example.org/"); |
| 14567 AddWebSocketHeaders(&request.extra_headers); | 14567 AddWebSocketHeaders(&request.extra_headers); |
| 14568 | 14568 |
| 14569 // Configure against proxy server "myproxy:70". | 14569 // Configure against proxy server "myproxy:70". |
| 14570 session_deps_.proxy_service = | 14570 session_deps_.proxy_service = |
| 14571 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); | 14571 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 14572 | 14572 |
| 14573 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14573 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14574 | 14574 |
| 14575 MockWrite data_writes[] = { | 14575 MockWrite data_writes[] = { |
| 14576 // Try to establish a tunnel for the WebSocket connection, with | 14576 // Try to establish a tunnel for the WebSocket connection, with |
| 14577 // credentials. Because WebSockets have a separate set of socket pools, | 14577 // credentials. Because WebSockets have a separate set of socket pools, |
| 14578 // they cannot and will not use the same TCP/IP connection as the | 14578 // they cannot and will not use the same TCP/IP connection as the |
| 14579 // preflight HTTP request. | 14579 // preflight HTTP request. |
| 14580 MockWrite( | 14580 MockWrite( |
| 14581 "CONNECT www.example.org:80 HTTP/1.1\r\n" | 14581 "CONNECT www.example.org:80 HTTP/1.1\r\n" |
| 14582 "Host: www.example.org:80\r\n" | 14582 "Host: www.example.org:80\r\n" |
| 14583 "Proxy-Connection: keep-alive\r\n" | 14583 "Proxy-Connection: keep-alive\r\n" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14639 TEST_P(HttpNetworkTransactionTest, TotalNetworkBytesPost) { | 14639 TEST_P(HttpNetworkTransactionTest, TotalNetworkBytesPost) { |
| 14640 ScopedVector<UploadElementReader> element_readers; | 14640 ScopedVector<UploadElementReader> element_readers; |
| 14641 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14641 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14642 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14642 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14643 | 14643 |
| 14644 HttpRequestInfo request; | 14644 HttpRequestInfo request; |
| 14645 request.method = "POST"; | 14645 request.method = "POST"; |
| 14646 request.url = GURL("http://www.foo.com/"); | 14646 request.url = GURL("http://www.foo.com/"); |
| 14647 request.upload_data_stream = &upload_data_stream; | 14647 request.upload_data_stream = &upload_data_stream; |
| 14648 | 14648 |
| 14649 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14649 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14650 scoped_ptr<HttpTransaction> trans( | 14650 scoped_ptr<HttpTransaction> trans( |
| 14651 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14651 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14652 MockWrite data_writes[] = { | 14652 MockWrite data_writes[] = { |
| 14653 MockWrite("POST / HTTP/1.1\r\n" | 14653 MockWrite("POST / HTTP/1.1\r\n" |
| 14654 "Host: www.foo.com\r\n" | 14654 "Host: www.foo.com\r\n" |
| 14655 "Connection: keep-alive\r\n" | 14655 "Connection: keep-alive\r\n" |
| 14656 "Content-Length: 3\r\n\r\n"), | 14656 "Content-Length: 3\r\n\r\n"), |
| 14657 MockWrite("foo"), | 14657 MockWrite("foo"), |
| 14658 }; | 14658 }; |
| 14659 | 14659 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 14683 TEST_P(HttpNetworkTransactionTest, TotalNetworkBytesPost100Continue) { | 14683 TEST_P(HttpNetworkTransactionTest, TotalNetworkBytesPost100Continue) { |
| 14684 ScopedVector<UploadElementReader> element_readers; | 14684 ScopedVector<UploadElementReader> element_readers; |
| 14685 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14685 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14686 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14686 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14687 | 14687 |
| 14688 HttpRequestInfo request; | 14688 HttpRequestInfo request; |
| 14689 request.method = "POST"; | 14689 request.method = "POST"; |
| 14690 request.url = GURL("http://www.foo.com/"); | 14690 request.url = GURL("http://www.foo.com/"); |
| 14691 request.upload_data_stream = &upload_data_stream; | 14691 request.upload_data_stream = &upload_data_stream; |
| 14692 | 14692 |
| 14693 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14693 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14694 scoped_ptr<HttpTransaction> trans( | 14694 scoped_ptr<HttpTransaction> trans( |
| 14695 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14695 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14696 MockWrite data_writes[] = { | 14696 MockWrite data_writes[] = { |
| 14697 MockWrite("POST / HTTP/1.1\r\n" | 14697 MockWrite("POST / HTTP/1.1\r\n" |
| 14698 "Host: www.foo.com\r\n" | 14698 "Host: www.foo.com\r\n" |
| 14699 "Connection: keep-alive\r\n" | 14699 "Connection: keep-alive\r\n" |
| 14700 "Content-Length: 3\r\n\r\n"), | 14700 "Content-Length: 3\r\n\r\n"), |
| 14701 MockWrite("foo"), | 14701 MockWrite("foo"), |
| 14702 }; | 14702 }; |
| 14703 | 14703 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 14728 TEST_P(HttpNetworkTransactionTest, TotalNetworkBytesChunkedPost) { | 14728 TEST_P(HttpNetworkTransactionTest, TotalNetworkBytesChunkedPost) { |
| 14729 ScopedVector<UploadElementReader> element_readers; | 14729 ScopedVector<UploadElementReader> element_readers; |
| 14730 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14730 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14731 ChunkedUploadDataStream upload_data_stream(0); | 14731 ChunkedUploadDataStream upload_data_stream(0); |
| 14732 | 14732 |
| 14733 HttpRequestInfo request; | 14733 HttpRequestInfo request; |
| 14734 request.method = "POST"; | 14734 request.method = "POST"; |
| 14735 request.url = GURL("http://www.foo.com/"); | 14735 request.url = GURL("http://www.foo.com/"); |
| 14736 request.upload_data_stream = &upload_data_stream; | 14736 request.upload_data_stream = &upload_data_stream; |
| 14737 | 14737 |
| 14738 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14738 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14739 scoped_ptr<HttpTransaction> trans( | 14739 scoped_ptr<HttpTransaction> trans( |
| 14740 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14740 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14741 // Send headers successfully, but get an error while sending the body. | 14741 // Send headers successfully, but get an error while sending the body. |
| 14742 MockWrite data_writes[] = { | 14742 MockWrite data_writes[] = { |
| 14743 MockWrite("POST / HTTP/1.1\r\n" | 14743 MockWrite("POST / HTTP/1.1\r\n" |
| 14744 "Host: www.foo.com\r\n" | 14744 "Host: www.foo.com\r\n" |
| 14745 "Connection: keep-alive\r\n" | 14745 "Connection: keep-alive\r\n" |
| 14746 "Transfer-Encoding: chunked\r\n\r\n"), | 14746 "Transfer-Encoding: chunked\r\n\r\n"), |
| 14747 MockWrite("1\r\nf\r\n"), MockWrite("2\r\noo\r\n"), MockWrite("0\r\n\r\n"), | 14747 MockWrite("1\r\nf\r\n"), MockWrite("2\r\noo\r\n"), MockWrite("0\r\n\r\n"), |
| 14748 }; | 14748 }; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 14771 std::string response_data; | 14771 std::string response_data; |
| 14772 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); | 14772 EXPECT_EQ(OK, ReadTransaction(trans.get(), &response_data)); |
| 14773 | 14773 |
| 14774 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), | 14774 EXPECT_EQ(CountWriteBytes(data_writes, arraysize(data_writes)), |
| 14775 trans->GetTotalSentBytes()); | 14775 trans->GetTotalSentBytes()); |
| 14776 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), | 14776 EXPECT_EQ(CountReadBytes(data_reads, arraysize(data_reads)), |
| 14777 trans->GetTotalReceivedBytes()); | 14777 trans->GetTotalReceivedBytes()); |
| 14778 } | 14778 } |
| 14779 | 14779 |
| 14780 } // namespace net | 14780 } // namespace net |
| OLD | NEW |