Chromium Code Reviews| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 } | 223 } |
| 224 | 224 |
| 225 void AddWebSocketHeaders(HttpRequestHeaders* headers) { | 225 void AddWebSocketHeaders(HttpRequestHeaders* headers) { |
| 226 headers->SetHeader("Connection", "Upgrade"); | 226 headers->SetHeader("Connection", "Upgrade"); |
| 227 headers->SetHeader("Upgrade", "websocket"); | 227 headers->SetHeader("Upgrade", "websocket"); |
| 228 headers->SetHeader("Origin", "http://www.example.org"); | 228 headers->SetHeader("Origin", "http://www.example.org"); |
| 229 headers->SetHeader("Sec-WebSocket-Version", "13"); | 229 headers->SetHeader("Sec-WebSocket-Version", "13"); |
| 230 headers->SetHeader("Sec-WebSocket-Key", "dGhlIHNhbXBsZSBub25jZQ=="); | 230 headers->SetHeader("Sec-WebSocket-Key", "dGhlIHNhbXBsZSBub25jZQ=="); |
| 231 } | 231 } |
| 232 | 232 |
| 233 HttpNetworkSession* CreateSession(SpdySessionDependencies* session_deps) { | 233 scoped_ptr<HttpNetworkSession> CreateSession( |
| 234 SpdySessionDependencies* session_deps) { | |
| 234 return SpdySessionDependencies::SpdyCreateSession(session_deps); | 235 return SpdySessionDependencies::SpdyCreateSession(session_deps); |
| 235 } | 236 } |
| 236 | 237 |
| 237 } // namespace | 238 } // namespace |
| 238 | 239 |
| 239 class HttpNetworkTransactionTest | 240 class HttpNetworkTransactionTest |
| 240 : public PlatformTest, | 241 : public PlatformTest, |
| 241 public ::testing::WithParamInterface<NextProto> { | 242 public ::testing::WithParamInterface<NextProto> { |
| 242 public: | 243 public: |
| 243 virtual ~HttpNetworkTransactionTest() { | 244 virtual ~HttpNetworkTransactionTest() { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 317 size_t data_count) { | 318 size_t data_count) { |
| 318 SimpleGetHelperResult out; | 319 SimpleGetHelperResult out; |
| 319 | 320 |
| 320 HttpRequestInfo request; | 321 HttpRequestInfo request; |
| 321 request.method = "GET"; | 322 request.method = "GET"; |
| 322 request.url = GURL("http://www.example.org/"); | 323 request.url = GURL("http://www.example.org/"); |
| 323 request.load_flags = 0; | 324 request.load_flags = 0; |
| 324 | 325 |
| 325 BoundTestNetLog log; | 326 BoundTestNetLog log; |
| 326 session_deps_.net_log = log.bound().net_log(); | 327 session_deps_.net_log = log.bound().net_log(); |
| 327 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 328 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 328 scoped_ptr<HttpTransaction> trans( | 329 scoped_ptr<HttpTransaction> trans( |
| 329 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 330 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 330 | 331 |
| 331 for (size_t i = 0; i < data_count; ++i) { | 332 for (size_t i = 0; i < data_count; ++i) { |
| 332 session_deps_.socket_factory->AddSocketDataProvider(data[i]); | 333 session_deps_.socket_factory->AddSocketDataProvider(data[i]); |
| 333 } | 334 } |
| 334 | 335 |
| 335 TestCompletionCallback callback; | 336 TestCompletionCallback callback; |
| 336 | 337 |
| 337 EXPECT_TRUE(log.bound().IsCapturing()); | 338 EXPECT_TRUE(log.bound().IsCapturing()); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 654 EXPECT_EQ("172.22.68.17:80", auth_challenge->challenger.ToString()); | 655 EXPECT_EQ("172.22.68.17:80", auth_challenge->challenger.ToString()); |
| 655 EXPECT_EQ(std::string(), auth_challenge->realm); | 656 EXPECT_EQ(std::string(), auth_challenge->realm); |
| 656 EXPECT_EQ("ntlm", auth_challenge->scheme); | 657 EXPECT_EQ("ntlm", auth_challenge->scheme); |
| 657 return true; | 658 return true; |
| 658 } | 659 } |
| 659 #endif // defined(NTLM_PORTABLE) | 660 #endif // defined(NTLM_PORTABLE) |
| 660 | 661 |
| 661 } // namespace | 662 } // namespace |
| 662 | 663 |
| 663 TEST_P(HttpNetworkTransactionTest, Basic) { | 664 TEST_P(HttpNetworkTransactionTest, Basic) { |
| 664 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 665 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 665 scoped_ptr<HttpTransaction> trans( | 666 scoped_ptr<HttpTransaction> trans( |
| 666 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 667 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 667 } | 668 } |
| 668 | 669 |
| 669 TEST_P(HttpNetworkTransactionTest, SimpleGET) { | 670 TEST_P(HttpNetworkTransactionTest, SimpleGET) { |
| 670 MockRead data_reads[] = { | 671 MockRead data_reads[] = { |
| 671 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 672 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
| 672 MockRead("hello world"), | 673 MockRead("hello world"), |
| 673 MockRead(SYNCHRONOUS, OK), | 674 MockRead(SYNCHRONOUS, OK), |
| 674 }; | 675 }; |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 973 MockRead("Location: http://good.com/\r\n"), | 974 MockRead("Location: http://good.com/\r\n"), |
| 974 MockRead("Content-Length: 0\r\n\r\n"), | 975 MockRead("Content-Length: 0\r\n\r\n"), |
| 975 MockRead(SYNCHRONOUS, OK), | 976 MockRead(SYNCHRONOUS, OK), |
| 976 }; | 977 }; |
| 977 | 978 |
| 978 HttpRequestInfo request; | 979 HttpRequestInfo request; |
| 979 request.method = "GET"; | 980 request.method = "GET"; |
| 980 request.url = GURL("http://redirect.com/"); | 981 request.url = GURL("http://redirect.com/"); |
| 981 request.load_flags = 0; | 982 request.load_flags = 0; |
| 982 | 983 |
| 983 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 984 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 984 scoped_ptr<HttpTransaction> trans( | 985 scoped_ptr<HttpTransaction> trans( |
| 985 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 986 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 986 | 987 |
| 987 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 988 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 988 session_deps_.socket_factory->AddSocketDataProvider(&data); | 989 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 989 | 990 |
| 990 TestCompletionCallback callback; | 991 TestCompletionCallback callback; |
| 991 | 992 |
| 992 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 993 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 993 EXPECT_EQ(ERR_IO_PENDING, rv); | 994 EXPECT_EQ(ERR_IO_PENDING, rv); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1018 } | 1019 } |
| 1019 | 1020 |
| 1020 // Do a request using the HEAD method. Verify that we don't try to read the | 1021 // Do a request using the HEAD method. Verify that we don't try to read the |
| 1021 // message body (since HEAD has none). | 1022 // message body (since HEAD has none). |
| 1022 TEST_P(HttpNetworkTransactionTest, Head) { | 1023 TEST_P(HttpNetworkTransactionTest, Head) { |
| 1023 HttpRequestInfo request; | 1024 HttpRequestInfo request; |
| 1024 request.method = "HEAD"; | 1025 request.method = "HEAD"; |
| 1025 request.url = GURL("http://www.example.org/"); | 1026 request.url = GURL("http://www.example.org/"); |
| 1026 request.load_flags = 0; | 1027 request.load_flags = 0; |
| 1027 | 1028 |
| 1028 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1029 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1029 scoped_ptr<HttpTransaction> trans( | 1030 scoped_ptr<HttpTransaction> trans( |
| 1030 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1031 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1031 BeforeProxyHeadersSentHandler proxy_headers_handler; | 1032 BeforeProxyHeadersSentHandler proxy_headers_handler; |
| 1032 trans->SetBeforeProxyHeadersSentCallback( | 1033 trans->SetBeforeProxyHeadersSentCallback( |
| 1033 base::Bind(&BeforeProxyHeadersSentHandler::OnBeforeProxyHeadersSent, | 1034 base::Bind(&BeforeProxyHeadersSentHandler::OnBeforeProxyHeadersSent, |
| 1034 base::Unretained(&proxy_headers_handler))); | 1035 base::Unretained(&proxy_headers_handler))); |
| 1035 | 1036 |
| 1036 MockWrite data_writes1[] = { | 1037 MockWrite data_writes1[] = { |
| 1037 MockWrite("HEAD / HTTP/1.1\r\n" | 1038 MockWrite("HEAD / HTTP/1.1\r\n" |
| 1038 "Host: www.example.org\r\n" | 1039 "Host: www.example.org\r\n" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1078 | 1079 |
| 1079 // Reading should give EOF right away, since there is no message body | 1080 // Reading should give EOF right away, since there is no message body |
| 1080 // (despite non-zero content-length). | 1081 // (despite non-zero content-length). |
| 1081 std::string response_data; | 1082 std::string response_data; |
| 1082 rv = ReadTransaction(trans.get(), &response_data); | 1083 rv = ReadTransaction(trans.get(), &response_data); |
| 1083 EXPECT_EQ(OK, rv); | 1084 EXPECT_EQ(OK, rv); |
| 1084 EXPECT_EQ("", response_data); | 1085 EXPECT_EQ("", response_data); |
| 1085 } | 1086 } |
| 1086 | 1087 |
| 1087 TEST_P(HttpNetworkTransactionTest, ReuseConnection) { | 1088 TEST_P(HttpNetworkTransactionTest, ReuseConnection) { |
| 1088 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1089 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1089 | 1090 |
| 1090 MockRead data_reads[] = { | 1091 MockRead data_reads[] = { |
| 1091 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\n"), | 1092 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\n"), |
| 1092 MockRead("hello"), | 1093 MockRead("hello"), |
| 1093 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\n"), | 1094 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\n"), |
| 1094 MockRead("world"), | 1095 MockRead("world"), |
| 1095 MockRead(SYNCHRONOUS, OK), | 1096 MockRead(SYNCHRONOUS, OK), |
| 1096 }; | 1097 }; |
| 1097 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1098 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 1098 session_deps_.socket_factory->AddSocketDataProvider(&data); | 1099 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1136 ScopedVector<UploadElementReader> element_readers; | 1137 ScopedVector<UploadElementReader> element_readers; |
| 1137 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 1138 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 1138 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 1139 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 1139 | 1140 |
| 1140 HttpRequestInfo request; | 1141 HttpRequestInfo request; |
| 1141 request.method = "POST"; | 1142 request.method = "POST"; |
| 1142 request.url = GURL("http://www.foo.com/"); | 1143 request.url = GURL("http://www.foo.com/"); |
| 1143 request.upload_data_stream = &upload_data_stream; | 1144 request.upload_data_stream = &upload_data_stream; |
| 1144 request.load_flags = 0; | 1145 request.load_flags = 0; |
| 1145 | 1146 |
| 1146 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1147 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1147 scoped_ptr<HttpTransaction> trans( | 1148 scoped_ptr<HttpTransaction> trans( |
| 1148 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1149 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1149 | 1150 |
| 1150 MockRead data_reads[] = { | 1151 MockRead data_reads[] = { |
| 1151 MockRead("HTTP/1.0 100 Continue\r\n\r\n"), | 1152 MockRead("HTTP/1.0 100 Continue\r\n\r\n"), |
| 1152 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 1153 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
| 1153 MockRead("hello world"), | 1154 MockRead("hello world"), |
| 1154 MockRead(SYNCHRONOUS, OK), | 1155 MockRead(SYNCHRONOUS, OK), |
| 1155 }; | 1156 }; |
| 1156 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1157 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1178 | 1179 |
| 1179 // This test is almost the same as Ignores100 above, but the response contains | 1180 // This test is almost the same as Ignores100 above, but the response contains |
| 1180 // a 102 instead of a 100. Also, instead of HTTP/1.0 the response is | 1181 // a 102 instead of a 100. Also, instead of HTTP/1.0 the response is |
| 1181 // HTTP/1.1 and the two status headers are read in one read. | 1182 // HTTP/1.1 and the two status headers are read in one read. |
| 1182 TEST_P(HttpNetworkTransactionTest, Ignores1xx) { | 1183 TEST_P(HttpNetworkTransactionTest, Ignores1xx) { |
| 1183 HttpRequestInfo request; | 1184 HttpRequestInfo request; |
| 1184 request.method = "GET"; | 1185 request.method = "GET"; |
| 1185 request.url = GURL("http://www.foo.com/"); | 1186 request.url = GURL("http://www.foo.com/"); |
| 1186 request.load_flags = 0; | 1187 request.load_flags = 0; |
| 1187 | 1188 |
| 1188 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1189 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1189 scoped_ptr<HttpTransaction> trans( | 1190 scoped_ptr<HttpTransaction> trans( |
| 1190 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1191 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1191 | 1192 |
| 1192 MockRead data_reads[] = { | 1193 MockRead data_reads[] = { |
| 1193 MockRead("HTTP/1.1 102 Unspecified status code\r\n\r\n" | 1194 MockRead("HTTP/1.1 102 Unspecified status code\r\n\r\n" |
| 1194 "HTTP/1.1 200 OK\r\n\r\n"), | 1195 "HTTP/1.1 200 OK\r\n\r\n"), |
| 1195 MockRead("hello world"), | 1196 MockRead("hello world"), |
| 1196 MockRead(SYNCHRONOUS, OK), | 1197 MockRead(SYNCHRONOUS, OK), |
| 1197 }; | 1198 }; |
| 1198 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1199 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1217 EXPECT_EQ(OK, rv); | 1218 EXPECT_EQ(OK, rv); |
| 1218 EXPECT_EQ("hello world", response_data); | 1219 EXPECT_EQ("hello world", response_data); |
| 1219 } | 1220 } |
| 1220 | 1221 |
| 1221 TEST_P(HttpNetworkTransactionTest, Incomplete100ThenEOF) { | 1222 TEST_P(HttpNetworkTransactionTest, Incomplete100ThenEOF) { |
| 1222 HttpRequestInfo request; | 1223 HttpRequestInfo request; |
| 1223 request.method = "POST"; | 1224 request.method = "POST"; |
| 1224 request.url = GURL("http://www.foo.com/"); | 1225 request.url = GURL("http://www.foo.com/"); |
| 1225 request.load_flags = 0; | 1226 request.load_flags = 0; |
| 1226 | 1227 |
| 1227 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1228 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1228 scoped_ptr<HttpTransaction> trans( | 1229 scoped_ptr<HttpTransaction> trans( |
| 1229 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1230 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1230 | 1231 |
| 1231 MockRead data_reads[] = { | 1232 MockRead data_reads[] = { |
| 1232 MockRead(SYNCHRONOUS, "HTTP/1.0 100 Continue\r\n"), | 1233 MockRead(SYNCHRONOUS, "HTTP/1.0 100 Continue\r\n"), |
| 1233 MockRead(ASYNC, 0), | 1234 MockRead(ASYNC, 0), |
| 1234 }; | 1235 }; |
| 1235 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1236 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 1236 session_deps_.socket_factory->AddSocketDataProvider(&data); | 1237 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 1237 | 1238 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1248 EXPECT_EQ(OK, rv); | 1249 EXPECT_EQ(OK, rv); |
| 1249 EXPECT_EQ("", response_data); | 1250 EXPECT_EQ("", response_data); |
| 1250 } | 1251 } |
| 1251 | 1252 |
| 1252 TEST_P(HttpNetworkTransactionTest, EmptyResponse) { | 1253 TEST_P(HttpNetworkTransactionTest, EmptyResponse) { |
| 1253 HttpRequestInfo request; | 1254 HttpRequestInfo request; |
| 1254 request.method = "POST"; | 1255 request.method = "POST"; |
| 1255 request.url = GURL("http://www.foo.com/"); | 1256 request.url = GURL("http://www.foo.com/"); |
| 1256 request.load_flags = 0; | 1257 request.load_flags = 0; |
| 1257 | 1258 |
| 1258 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1259 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1259 scoped_ptr<HttpTransaction> trans( | 1260 scoped_ptr<HttpTransaction> trans( |
| 1260 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1261 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1261 | 1262 |
| 1262 MockRead data_reads[] = { | 1263 MockRead data_reads[] = { |
| 1263 MockRead(ASYNC, 0), | 1264 MockRead(ASYNC, 0), |
| 1264 }; | 1265 }; |
| 1265 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1266 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 1266 session_deps_.socket_factory->AddSocketDataProvider(&data); | 1267 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 1267 | 1268 |
| 1268 TestCompletionCallback callback; | 1269 TestCompletionCallback callback; |
| 1269 | 1270 |
| 1270 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 1271 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 1271 EXPECT_EQ(ERR_IO_PENDING, rv); | 1272 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 1272 | 1273 |
| 1273 rv = callback.WaitForResult(); | 1274 rv = callback.WaitForResult(); |
| 1274 EXPECT_EQ(ERR_EMPTY_RESPONSE, rv); | 1275 EXPECT_EQ(ERR_EMPTY_RESPONSE, rv); |
| 1275 } | 1276 } |
| 1276 | 1277 |
| 1277 void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest( | 1278 void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest( |
| 1278 const MockWrite* write_failure, | 1279 const MockWrite* write_failure, |
| 1279 const MockRead* read_failure) { | 1280 const MockRead* read_failure) { |
| 1280 HttpRequestInfo request; | 1281 HttpRequestInfo request; |
| 1281 request.method = "GET"; | 1282 request.method = "GET"; |
| 1282 request.url = GURL("http://www.foo.com/"); | 1283 request.url = GURL("http://www.foo.com/"); |
| 1283 request.load_flags = 0; | 1284 request.load_flags = 0; |
| 1284 | 1285 |
| 1285 TestNetLog net_log; | 1286 TestNetLog net_log; |
| 1286 session_deps_.net_log = &net_log; | 1287 session_deps_.net_log = &net_log; |
| 1287 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1288 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1288 | 1289 |
| 1289 // Written data for successfully sending both requests. | 1290 // Written data for successfully sending both requests. |
| 1290 MockWrite data1_writes[] = { | 1291 MockWrite data1_writes[] = { |
| 1291 MockWrite("GET / HTTP/1.1\r\n" | 1292 MockWrite("GET / HTTP/1.1\r\n" |
| 1292 "Host: www.foo.com\r\n" | 1293 "Host: www.foo.com\r\n" |
| 1293 "Connection: keep-alive\r\n\r\n"), | 1294 "Connection: keep-alive\r\n\r\n"), |
| 1294 MockWrite("GET / HTTP/1.1\r\n" | 1295 MockWrite("GET / HTTP/1.1\r\n" |
| 1295 "Host: www.foo.com\r\n" | 1296 "Host: www.foo.com\r\n" |
| 1296 "Connection: keep-alive\r\n\r\n") | 1297 "Connection: keep-alive\r\n\r\n") |
| 1297 }; | 1298 }; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1367 const MockWrite* write_failure, | 1368 const MockWrite* write_failure, |
| 1368 const MockRead* read_failure, | 1369 const MockRead* read_failure, |
| 1369 bool use_spdy) { | 1370 bool use_spdy) { |
| 1370 HttpRequestInfo request; | 1371 HttpRequestInfo request; |
| 1371 request.method = "GET"; | 1372 request.method = "GET"; |
| 1372 request.url = GURL("https://www.foo.com/"); | 1373 request.url = GURL("https://www.foo.com/"); |
| 1373 request.load_flags = 0; | 1374 request.load_flags = 0; |
| 1374 | 1375 |
| 1375 TestNetLog net_log; | 1376 TestNetLog net_log; |
| 1376 session_deps_.net_log = &net_log; | 1377 session_deps_.net_log = &net_log; |
| 1377 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1378 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1378 | 1379 |
| 1379 SSLSocketDataProvider ssl1(ASYNC, OK); | 1380 SSLSocketDataProvider ssl1(ASYNC, OK); |
| 1380 SSLSocketDataProvider ssl2(ASYNC, OK); | 1381 SSLSocketDataProvider ssl2(ASYNC, OK); |
| 1381 if (use_spdy) { | 1382 if (use_spdy) { |
| 1382 ssl1.SetNextProto(GetParam()); | 1383 ssl1.SetNextProto(GetParam()); |
| 1383 ssl2.SetNextProto(GetParam()); | 1384 ssl2.SetNextProto(GetParam()); |
| 1384 } | 1385 } |
| 1385 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); | 1386 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); |
| 1386 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); | 1387 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 1387 | 1388 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1563 MockRead read_failure(ASYNC, OK); // EOF | 1564 MockRead read_failure(ASYNC, OK); // EOF |
| 1564 PreconnectErrorResendRequestTest(NULL, &read_failure, true); | 1565 PreconnectErrorResendRequestTest(NULL, &read_failure, true); |
| 1565 } | 1566 } |
| 1566 | 1567 |
| 1567 TEST_P(HttpNetworkTransactionTest, NonKeepAliveConnectionReset) { | 1568 TEST_P(HttpNetworkTransactionTest, NonKeepAliveConnectionReset) { |
| 1568 HttpRequestInfo request; | 1569 HttpRequestInfo request; |
| 1569 request.method = "GET"; | 1570 request.method = "GET"; |
| 1570 request.url = GURL("http://www.example.org/"); | 1571 request.url = GURL("http://www.example.org/"); |
| 1571 request.load_flags = 0; | 1572 request.load_flags = 0; |
| 1572 | 1573 |
| 1573 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1574 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1574 scoped_ptr<HttpTransaction> trans( | 1575 scoped_ptr<HttpTransaction> trans( |
| 1575 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1576 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1576 | 1577 |
| 1577 MockRead data_reads[] = { | 1578 MockRead data_reads[] = { |
| 1578 MockRead(ASYNC, ERR_CONNECTION_RESET), | 1579 MockRead(ASYNC, ERR_CONNECTION_RESET), |
| 1579 MockRead("HTTP/1.0 200 OK\r\n\r\n"), // Should not be used | 1580 MockRead("HTTP/1.0 200 OK\r\n\r\n"), // Should not be used |
| 1580 MockRead("hello world"), | 1581 MockRead("hello world"), |
| 1581 MockRead(SYNCHRONOUS, OK), | 1582 MockRead(SYNCHRONOUS, OK), |
| 1582 }; | 1583 }; |
| 1583 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1584 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1613 EXPECT_EQ(ERR_EMPTY_RESPONSE, out.rv); | 1614 EXPECT_EQ(ERR_EMPTY_RESPONSE, out.rv); |
| 1614 } | 1615 } |
| 1615 | 1616 |
| 1616 // Test that network access can be deferred and resumed. | 1617 // Test that network access can be deferred and resumed. |
| 1617 TEST_P(HttpNetworkTransactionTest, ThrottleBeforeNetworkStart) { | 1618 TEST_P(HttpNetworkTransactionTest, ThrottleBeforeNetworkStart) { |
| 1618 HttpRequestInfo request; | 1619 HttpRequestInfo request; |
| 1619 request.method = "GET"; | 1620 request.method = "GET"; |
| 1620 request.url = GURL("http://www.example.org/"); | 1621 request.url = GURL("http://www.example.org/"); |
| 1621 request.load_flags = 0; | 1622 request.load_flags = 0; |
| 1622 | 1623 |
| 1623 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1624 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1624 scoped_ptr<HttpTransaction> trans( | 1625 scoped_ptr<HttpTransaction> trans( |
| 1625 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1626 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1626 | 1627 |
| 1627 // Defer on OnBeforeNetworkStart. | 1628 // Defer on OnBeforeNetworkStart. |
| 1628 BeforeNetworkStartHandler net_start_handler(true); // defer | 1629 BeforeNetworkStartHandler net_start_handler(true); // defer |
| 1629 trans->SetBeforeNetworkStartCallback( | 1630 trans->SetBeforeNetworkStartCallback( |
| 1630 base::Bind(&BeforeNetworkStartHandler::OnBeforeNetworkStart, | 1631 base::Bind(&BeforeNetworkStartHandler::OnBeforeNetworkStart, |
| 1631 base::Unretained(&net_start_handler))); | 1632 base::Unretained(&net_start_handler))); |
| 1632 | 1633 |
| 1633 MockRead data_reads[] = { | 1634 MockRead data_reads[] = { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 1662 trans.reset(); | 1663 trans.reset(); |
| 1663 } | 1664 } |
| 1664 | 1665 |
| 1665 // Test that network use can be deferred and canceled. | 1666 // Test that network use can be deferred and canceled. |
| 1666 TEST_P(HttpNetworkTransactionTest, ThrottleAndCancelBeforeNetworkStart) { | 1667 TEST_P(HttpNetworkTransactionTest, ThrottleAndCancelBeforeNetworkStart) { |
| 1667 HttpRequestInfo request; | 1668 HttpRequestInfo request; |
| 1668 request.method = "GET"; | 1669 request.method = "GET"; |
| 1669 request.url = GURL("http://www.example.org/"); | 1670 request.url = GURL("http://www.example.org/"); |
| 1670 request.load_flags = 0; | 1671 request.load_flags = 0; |
| 1671 | 1672 |
| 1672 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1673 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1673 scoped_ptr<HttpTransaction> trans( | 1674 scoped_ptr<HttpTransaction> trans( |
| 1674 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1675 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1675 | 1676 |
| 1676 // Defer on OnBeforeNetworkStart. | 1677 // Defer on OnBeforeNetworkStart. |
| 1677 BeforeNetworkStartHandler net_start_handler(true); // defer | 1678 BeforeNetworkStartHandler net_start_handler(true); // defer |
| 1678 trans->SetBeforeNetworkStartCallback( | 1679 trans->SetBeforeNetworkStartCallback( |
| 1679 base::Bind(&BeforeNetworkStartHandler::OnBeforeNetworkStart, | 1680 base::Bind(&BeforeNetworkStartHandler::OnBeforeNetworkStart, |
| 1680 base::Unretained(&net_start_handler))); | 1681 base::Unretained(&net_start_handler))); |
| 1681 | 1682 |
| 1682 TestCompletionCallback callback; | 1683 TestCompletionCallback callback; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1693 // Next 2 cases (KeepAliveEarlyClose and KeepAliveEarlyClose2) are regression | 1694 // Next 2 cases (KeepAliveEarlyClose and KeepAliveEarlyClose2) are regression |
| 1694 // tests. There was a bug causing HttpNetworkTransaction to hang in the | 1695 // tests. There was a bug causing HttpNetworkTransaction to hang in the |
| 1695 // destructor in such situations. | 1696 // destructor in such situations. |
| 1696 // See http://crbug.com/154712 and http://crbug.com/156609. | 1697 // See http://crbug.com/154712 and http://crbug.com/156609. |
| 1697 TEST_P(HttpNetworkTransactionTest, KeepAliveEarlyClose) { | 1698 TEST_P(HttpNetworkTransactionTest, KeepAliveEarlyClose) { |
| 1698 HttpRequestInfo request; | 1699 HttpRequestInfo request; |
| 1699 request.method = "GET"; | 1700 request.method = "GET"; |
| 1700 request.url = GURL("http://www.example.org/"); | 1701 request.url = GURL("http://www.example.org/"); |
| 1701 request.load_flags = 0; | 1702 request.load_flags = 0; |
| 1702 | 1703 |
| 1703 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1704 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1704 scoped_ptr<HttpTransaction> trans( | 1705 scoped_ptr<HttpTransaction> trans( |
| 1705 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1706 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1706 | 1707 |
| 1707 MockRead data_reads[] = { | 1708 MockRead data_reads[] = { |
| 1708 MockRead("HTTP/1.0 200 OK\r\n"), | 1709 MockRead("HTTP/1.0 200 OK\r\n"), |
| 1709 MockRead("Connection: keep-alive\r\n"), | 1710 MockRead("Connection: keep-alive\r\n"), |
| 1710 MockRead("Content-Length: 100\r\n\r\n"), | 1711 MockRead("Content-Length: 100\r\n\r\n"), |
| 1711 MockRead("hello"), | 1712 MockRead("hello"), |
| 1712 MockRead(SYNCHRONOUS, 0), | 1713 MockRead(SYNCHRONOUS, 0), |
| 1713 }; | 1714 }; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1734 base::MessageLoop::current()->RunUntilIdle(); | 1735 base::MessageLoop::current()->RunUntilIdle(); |
| 1735 EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); | 1736 EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); |
| 1736 } | 1737 } |
| 1737 | 1738 |
| 1738 TEST_P(HttpNetworkTransactionTest, KeepAliveEarlyClose2) { | 1739 TEST_P(HttpNetworkTransactionTest, KeepAliveEarlyClose2) { |
| 1739 HttpRequestInfo request; | 1740 HttpRequestInfo request; |
| 1740 request.method = "GET"; | 1741 request.method = "GET"; |
| 1741 request.url = GURL("http://www.example.org/"); | 1742 request.url = GURL("http://www.example.org/"); |
| 1742 request.load_flags = 0; | 1743 request.load_flags = 0; |
| 1743 | 1744 |
| 1744 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1745 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1745 scoped_ptr<HttpTransaction> trans( | 1746 scoped_ptr<HttpTransaction> trans( |
| 1746 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1747 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1747 | 1748 |
| 1748 MockRead data_reads[] = { | 1749 MockRead data_reads[] = { |
| 1749 MockRead("HTTP/1.0 200 OK\r\n"), | 1750 MockRead("HTTP/1.0 200 OK\r\n"), |
| 1750 MockRead("Connection: keep-alive\r\n"), | 1751 MockRead("Connection: keep-alive\r\n"), |
| 1751 MockRead("Content-Length: 100\r\n\r\n"), | 1752 MockRead("Content-Length: 100\r\n\r\n"), |
| 1752 MockRead(SYNCHRONOUS, 0), | 1753 MockRead(SYNCHRONOUS, 0), |
| 1753 }; | 1754 }; |
| 1754 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 1755 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1776 // Test that we correctly reuse a keep-alive connection after not explicitly | 1777 // Test that we correctly reuse a keep-alive connection after not explicitly |
| 1777 // reading the body. | 1778 // reading the body. |
| 1778 TEST_P(HttpNetworkTransactionTest, KeepAliveAfterUnreadBody) { | 1779 TEST_P(HttpNetworkTransactionTest, KeepAliveAfterUnreadBody) { |
| 1779 HttpRequestInfo request; | 1780 HttpRequestInfo request; |
| 1780 request.method = "GET"; | 1781 request.method = "GET"; |
| 1781 request.url = GURL("http://www.foo.com/"); | 1782 request.url = GURL("http://www.foo.com/"); |
| 1782 request.load_flags = 0; | 1783 request.load_flags = 0; |
| 1783 | 1784 |
| 1784 TestNetLog net_log; | 1785 TestNetLog net_log; |
| 1785 session_deps_.net_log = &net_log; | 1786 session_deps_.net_log = &net_log; |
| 1786 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1787 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1787 | 1788 |
| 1788 // Note that because all these reads happen in the same | 1789 // Note that because all these reads happen in the same |
| 1789 // StaticSocketDataProvider, it shows that the same socket is being reused for | 1790 // StaticSocketDataProvider, it shows that the same socket is being reused for |
| 1790 // all transactions. | 1791 // all transactions. |
| 1791 MockRead data1_reads[] = { | 1792 MockRead data1_reads[] = { |
| 1792 MockRead("HTTP/1.1 204 No Content\r\n\r\n"), | 1793 MockRead("HTTP/1.1 204 No Content\r\n\r\n"), |
| 1793 MockRead("HTTP/1.1 205 Reset Content\r\n\r\n"), | 1794 MockRead("HTTP/1.1 205 Reset Content\r\n\r\n"), |
| 1794 MockRead("HTTP/1.1 304 Not Modified\r\n\r\n"), | 1795 MockRead("HTTP/1.1 304 Not Modified\r\n\r\n"), |
| 1795 MockRead("HTTP/1.1 302 Found\r\n" | 1796 MockRead("HTTP/1.1 302 Found\r\n" |
| 1796 "Content-Length: 0\r\n\r\n"), | 1797 "Content-Length: 0\r\n\r\n"), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1885 // Test the request-challenge-retry sequence for basic auth. | 1886 // Test the request-challenge-retry sequence for basic auth. |
| 1886 // (basic auth is the easiest to mock, because it has no randomness). | 1887 // (basic auth is the easiest to mock, because it has no randomness). |
| 1887 TEST_P(HttpNetworkTransactionTest, BasicAuth) { | 1888 TEST_P(HttpNetworkTransactionTest, BasicAuth) { |
| 1888 HttpRequestInfo request; | 1889 HttpRequestInfo request; |
| 1889 request.method = "GET"; | 1890 request.method = "GET"; |
| 1890 request.url = GURL("http://www.example.org/"); | 1891 request.url = GURL("http://www.example.org/"); |
| 1891 request.load_flags = 0; | 1892 request.load_flags = 0; |
| 1892 | 1893 |
| 1893 TestNetLog log; | 1894 TestNetLog log; |
| 1894 session_deps_.net_log = &log; | 1895 session_deps_.net_log = &log; |
| 1895 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1896 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1896 scoped_ptr<HttpTransaction> trans( | 1897 scoped_ptr<HttpTransaction> trans( |
| 1897 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1898 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1898 | 1899 |
| 1899 MockWrite data_writes1[] = { | 1900 MockWrite data_writes1[] = { |
| 1900 MockWrite( | 1901 MockWrite( |
| 1901 "GET / HTTP/1.1\r\n" | 1902 "GET / HTTP/1.1\r\n" |
| 1902 "Host: www.example.org\r\n" | 1903 "Host: www.example.org\r\n" |
| 1903 "Connection: keep-alive\r\n\r\n"), | 1904 "Connection: keep-alive\r\n\r\n"), |
| 1904 }; | 1905 }; |
| 1905 | 1906 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1986 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 1987 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 1987 EXPECT_EQ(100, response->headers->GetContentLength()); | 1988 EXPECT_EQ(100, response->headers->GetContentLength()); |
| 1988 } | 1989 } |
| 1989 | 1990 |
| 1990 TEST_P(HttpNetworkTransactionTest, DoNotSendAuth) { | 1991 TEST_P(HttpNetworkTransactionTest, DoNotSendAuth) { |
| 1991 HttpRequestInfo request; | 1992 HttpRequestInfo request; |
| 1992 request.method = "GET"; | 1993 request.method = "GET"; |
| 1993 request.url = GURL("http://www.example.org/"); | 1994 request.url = GURL("http://www.example.org/"); |
| 1994 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 1995 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 1995 | 1996 |
| 1996 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 1997 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 1997 scoped_ptr<HttpTransaction> trans( | 1998 scoped_ptr<HttpTransaction> trans( |
| 1998 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 1999 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 1999 | 2000 |
| 2000 MockWrite data_writes[] = { | 2001 MockWrite data_writes[] = { |
| 2001 MockWrite( | 2002 MockWrite( |
| 2002 "GET / HTTP/1.1\r\n" | 2003 "GET / HTTP/1.1\r\n" |
| 2003 "Host: www.example.org\r\n" | 2004 "Host: www.example.org\r\n" |
| 2004 "Connection: keep-alive\r\n\r\n"), | 2005 "Connection: keep-alive\r\n\r\n"), |
| 2005 }; | 2006 }; |
| 2006 | 2007 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 2035 // Test the request-challenge-retry sequence for basic auth, over a keep-alive | 2036 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
| 2036 // connection. | 2037 // connection. |
| 2037 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAlive) { | 2038 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAlive) { |
| 2038 HttpRequestInfo request; | 2039 HttpRequestInfo request; |
| 2039 request.method = "GET"; | 2040 request.method = "GET"; |
| 2040 request.url = GURL("http://www.example.org/"); | 2041 request.url = GURL("http://www.example.org/"); |
| 2041 request.load_flags = 0; | 2042 request.load_flags = 0; |
| 2042 | 2043 |
| 2043 TestNetLog log; | 2044 TestNetLog log; |
| 2044 session_deps_.net_log = &log; | 2045 session_deps_.net_log = &log; |
| 2045 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2046 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2046 | 2047 |
| 2047 MockWrite data_writes1[] = { | 2048 MockWrite data_writes1[] = { |
| 2048 MockWrite( | 2049 MockWrite( |
| 2049 "GET / HTTP/1.1\r\n" | 2050 "GET / HTTP/1.1\r\n" |
| 2050 "Host: www.example.org\r\n" | 2051 "Host: www.example.org\r\n" |
| 2051 "Connection: keep-alive\r\n\r\n"), | 2052 "Connection: keep-alive\r\n\r\n"), |
| 2052 | 2053 |
| 2053 // After calling trans->RestartWithAuth(), this is the request we should | 2054 // After calling trans->RestartWithAuth(), this is the request we should |
| 2054 // be issuing -- the final header line contains the credentials. | 2055 // be issuing -- the final header line contains the credentials. |
| 2055 MockWrite( | 2056 MockWrite( |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2135 } | 2136 } |
| 2136 | 2137 |
| 2137 // Test the request-challenge-retry sequence for basic auth, over a keep-alive | 2138 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
| 2138 // connection and with no response body to drain. | 2139 // connection and with no response body to drain. |
| 2139 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveNoBody) { | 2140 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveNoBody) { |
| 2140 HttpRequestInfo request; | 2141 HttpRequestInfo request; |
| 2141 request.method = "GET"; | 2142 request.method = "GET"; |
| 2142 request.url = GURL("http://www.example.org/"); | 2143 request.url = GURL("http://www.example.org/"); |
| 2143 request.load_flags = 0; | 2144 request.load_flags = 0; |
| 2144 | 2145 |
| 2145 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2146 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2146 | 2147 |
| 2147 MockWrite data_writes1[] = { | 2148 MockWrite data_writes1[] = { |
| 2148 MockWrite( | 2149 MockWrite( |
| 2149 "GET / HTTP/1.1\r\n" | 2150 "GET / HTTP/1.1\r\n" |
| 2150 "Host: www.example.org\r\n" | 2151 "Host: www.example.org\r\n" |
| 2151 "Connection: keep-alive\r\n\r\n"), | 2152 "Connection: keep-alive\r\n\r\n"), |
| 2152 | 2153 |
| 2153 // After calling trans->RestartWithAuth(), this is the request we should | 2154 // After calling trans->RestartWithAuth(), this is the request we should |
| 2154 // be issuing -- the final header line contains the credentials. | 2155 // be issuing -- the final header line contains the credentials. |
| 2155 MockWrite( | 2156 MockWrite( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2213 } | 2214 } |
| 2214 | 2215 |
| 2215 // Test the request-challenge-retry sequence for basic auth, over a keep-alive | 2216 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
| 2216 // connection and with a large response body to drain. | 2217 // connection and with a large response body to drain. |
| 2217 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveLargeBody) { | 2218 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveLargeBody) { |
| 2218 HttpRequestInfo request; | 2219 HttpRequestInfo request; |
| 2219 request.method = "GET"; | 2220 request.method = "GET"; |
| 2220 request.url = GURL("http://www.example.org/"); | 2221 request.url = GURL("http://www.example.org/"); |
| 2221 request.load_flags = 0; | 2222 request.load_flags = 0; |
| 2222 | 2223 |
| 2223 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2224 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2224 | 2225 |
| 2225 MockWrite data_writes1[] = { | 2226 MockWrite data_writes1[] = { |
| 2226 MockWrite( | 2227 MockWrite( |
| 2227 "GET / HTTP/1.1\r\n" | 2228 "GET / HTTP/1.1\r\n" |
| 2228 "Host: www.example.org\r\n" | 2229 "Host: www.example.org\r\n" |
| 2229 "Connection: keep-alive\r\n\r\n"), | 2230 "Connection: keep-alive\r\n\r\n"), |
| 2230 | 2231 |
| 2231 // After calling trans->RestartWithAuth(), this is the request we should | 2232 // After calling trans->RestartWithAuth(), this is the request we should |
| 2232 // be issuing -- the final header line contains the credentials. | 2233 // be issuing -- the final header line contains the credentials. |
| 2233 MockWrite( | 2234 MockWrite( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2299 } | 2300 } |
| 2300 | 2301 |
| 2301 // Test the request-challenge-retry sequence for basic auth, over a keep-alive | 2302 // Test the request-challenge-retry sequence for basic auth, over a keep-alive |
| 2302 // connection, but the server gets impatient and closes the connection. | 2303 // connection, but the server gets impatient and closes the connection. |
| 2303 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveImpatientServer) { | 2304 TEST_P(HttpNetworkTransactionTest, BasicAuthKeepAliveImpatientServer) { |
| 2304 HttpRequestInfo request; | 2305 HttpRequestInfo request; |
| 2305 request.method = "GET"; | 2306 request.method = "GET"; |
| 2306 request.url = GURL("http://www.example.org/"); | 2307 request.url = GURL("http://www.example.org/"); |
| 2307 request.load_flags = 0; | 2308 request.load_flags = 0; |
| 2308 | 2309 |
| 2309 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2310 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2310 | 2311 |
| 2311 MockWrite data_writes1[] = { | 2312 MockWrite data_writes1[] = { |
| 2312 MockWrite( | 2313 MockWrite( |
| 2313 "GET / HTTP/1.1\r\n" | 2314 "GET / HTTP/1.1\r\n" |
| 2314 "Host: www.example.org\r\n" | 2315 "Host: www.example.org\r\n" |
| 2315 "Connection: keep-alive\r\n\r\n"), | 2316 "Connection: keep-alive\r\n\r\n"), |
| 2316 // This simulates the seemingly successful write to a closed connection | 2317 // This simulates the seemingly successful write to a closed connection |
| 2317 // if the bug is not fixed. | 2318 // if the bug is not fixed. |
| 2318 MockWrite( | 2319 MockWrite( |
| 2319 "GET / HTTP/1.1\r\n" | 2320 "GET / HTTP/1.1\r\n" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2394 request.method = "GET"; | 2395 request.method = "GET"; |
| 2395 request.url = GURL("https://www.example.org/"); | 2396 request.url = GURL("https://www.example.org/"); |
| 2396 // when the no authentication data flag is set. | 2397 // when the no authentication data flag is set. |
| 2397 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2398 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2398 | 2399 |
| 2399 // Configure against proxy server "myproxy:70". | 2400 // Configure against proxy server "myproxy:70". |
| 2400 session_deps_.proxy_service.reset( | 2401 session_deps_.proxy_service.reset( |
| 2401 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 2402 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 2402 BoundTestNetLog log; | 2403 BoundTestNetLog log; |
| 2403 session_deps_.net_log = log.bound().net_log(); | 2404 session_deps_.net_log = log.bound().net_log(); |
| 2404 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2405 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2405 | 2406 |
| 2406 // Since we have proxy, should try to establish tunnel. | 2407 // Since we have proxy, should try to establish tunnel. |
| 2407 MockWrite data_writes1[] = { | 2408 MockWrite data_writes1[] = { |
| 2408 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" | 2409 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2409 "Host: www.example.org\r\n" | 2410 "Host: www.example.org\r\n" |
| 2410 "Proxy-Connection: keep-alive\r\n\r\n"), | 2411 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 2411 }; | 2412 }; |
| 2412 | 2413 |
| 2413 // The proxy responds to the connect with a 407, using a non-persistent | 2414 // The proxy responds to the connect with a 407, using a non-persistent |
| 2414 // connection. | 2415 // connection. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2518 request.method = "GET"; | 2519 request.method = "GET"; |
| 2519 request.url = GURL("https://www.example.org/"); | 2520 request.url = GURL("https://www.example.org/"); |
| 2520 // when the no authentication data flag is set. | 2521 // when the no authentication data flag is set. |
| 2521 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2522 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2522 | 2523 |
| 2523 // Configure against proxy server "myproxy:70". | 2524 // Configure against proxy server "myproxy:70". |
| 2524 session_deps_.proxy_service.reset( | 2525 session_deps_.proxy_service.reset( |
| 2525 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 2526 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 2526 BoundTestNetLog log; | 2527 BoundTestNetLog log; |
| 2527 session_deps_.net_log = log.bound().net_log(); | 2528 session_deps_.net_log = log.bound().net_log(); |
| 2528 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2529 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2529 | 2530 |
| 2530 // Since we have proxy, should try to establish tunnel. | 2531 // Since we have proxy, should try to establish tunnel. |
| 2531 MockWrite data_writes1[] = { | 2532 MockWrite data_writes1[] = { |
| 2532 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" | 2533 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2533 "Host: www.example.org\r\n" | 2534 "Host: www.example.org\r\n" |
| 2534 "Proxy-Connection: keep-alive\r\n\r\n"), | 2535 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 2535 }; | 2536 }; |
| 2536 | 2537 |
| 2537 // The proxy responds to the connect with a 407, using a non-persistent | 2538 // The proxy responds to the connect with a 407, using a non-persistent |
| 2538 // connection. | 2539 // connection. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2642 request.method = "GET"; | 2643 request.method = "GET"; |
| 2643 request.url = GURL("https://www.example.org/"); | 2644 request.url = GURL("https://www.example.org/"); |
| 2644 // Ensure that proxy authentication is attempted even | 2645 // Ensure that proxy authentication is attempted even |
| 2645 // when the no authentication data flag is set. | 2646 // when the no authentication data flag is set. |
| 2646 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2647 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2647 | 2648 |
| 2648 // Configure against proxy server "myproxy:70". | 2649 // Configure against proxy server "myproxy:70". |
| 2649 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2650 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 2650 BoundTestNetLog log; | 2651 BoundTestNetLog log; |
| 2651 session_deps_.net_log = log.bound().net_log(); | 2652 session_deps_.net_log = log.bound().net_log(); |
| 2652 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2653 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2653 | 2654 |
| 2654 scoped_ptr<HttpTransaction> trans( | 2655 scoped_ptr<HttpTransaction> trans( |
| 2655 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2656 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2656 | 2657 |
| 2657 // Since we have proxy, should try to establish tunnel. | 2658 // Since we have proxy, should try to establish tunnel. |
| 2658 MockWrite data_writes1[] = { | 2659 MockWrite data_writes1[] = { |
| 2659 MockWrite( | 2660 MockWrite( |
| 2660 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2661 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2661 "Host: www.example.org\r\n" | 2662 "Host: www.example.org\r\n" |
| 2662 "Proxy-Connection: keep-alive\r\n\r\n"), | 2663 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2749 request.method = "GET"; | 2750 request.method = "GET"; |
| 2750 request.url = GURL("https://www.example.org/"); | 2751 request.url = GURL("https://www.example.org/"); |
| 2751 // Ensure that proxy authentication is attempted even | 2752 // Ensure that proxy authentication is attempted even |
| 2752 // when the no authentication data flag is set. | 2753 // when the no authentication data flag is set. |
| 2753 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2754 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2754 | 2755 |
| 2755 // Configure against proxy server "myproxy:70". | 2756 // Configure against proxy server "myproxy:70". |
| 2756 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2757 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 2757 BoundTestNetLog log; | 2758 BoundTestNetLog log; |
| 2758 session_deps_.net_log = log.bound().net_log(); | 2759 session_deps_.net_log = log.bound().net_log(); |
| 2759 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2760 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2760 | 2761 |
| 2761 scoped_ptr<HttpTransaction> trans( | 2762 scoped_ptr<HttpTransaction> trans( |
| 2762 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2763 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2763 | 2764 |
| 2764 // Since we have proxy, should try to establish tunnel. | 2765 // Since we have proxy, should try to establish tunnel. |
| 2765 MockWrite data_writes1[] = { | 2766 MockWrite data_writes1[] = { |
| 2766 MockWrite( | 2767 MockWrite( |
| 2767 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2768 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2768 "Host: www.example.org\r\n" | 2769 "Host: www.example.org\r\n" |
| 2769 "Proxy-Connection: keep-alive\r\n\r\n"), | 2770 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2853 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHangupDuringBody) { | 2854 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyKeepAliveHangupDuringBody) { |
| 2854 HttpRequestInfo request; | 2855 HttpRequestInfo request; |
| 2855 request.method = "GET"; | 2856 request.method = "GET"; |
| 2856 request.url = GURL("https://www.example.org/"); | 2857 request.url = GURL("https://www.example.org/"); |
| 2857 // Ensure that proxy authentication is attempted even | 2858 // Ensure that proxy authentication is attempted even |
| 2858 // when the no authentication data flag is set. | 2859 // when the no authentication data flag is set. |
| 2859 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 2860 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 2860 | 2861 |
| 2861 // Configure against proxy server "myproxy:70". | 2862 // Configure against proxy server "myproxy:70". |
| 2862 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2863 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 2863 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2864 scoped_ptr<HttpNetworkSession> session = CreateSession(&session_deps_); |
| 2864 | 2865 |
| 2865 scoped_ptr<HttpTransaction> trans( | 2866 scoped_ptr<HttpTransaction> trans( |
| 2866 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2867 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2867 | 2868 |
| 2868 // Since we have proxy, should try to establish tunnel. | 2869 // Since we have proxy, should try to establish tunnel. |
| 2869 MockWrite data_writes1[] = { | 2870 MockWrite data_writes1[] = { |
| 2870 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" | 2871 MockWrite("CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2871 "Host: www.example.org\r\n" | 2872 "Host: www.example.org\r\n" |
| 2872 "Proxy-Connection: keep-alive\r\n\r\n"), | 2873 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 2873 }; | 2874 }; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2943 // even if the user cancels the proxy's auth attempt. | 2944 // even if the user cancels the proxy's auth attempt. |
| 2944 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) { | 2945 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyCancelTunnel) { |
| 2945 HttpRequestInfo request; | 2946 HttpRequestInfo request; |
| 2946 request.method = "GET"; | 2947 request.method = "GET"; |
| 2947 request.url = GURL("https://www.example.org/"); | 2948 request.url = GURL("https://www.example.org/"); |
| 2948 request.load_flags = 0; | 2949 request.load_flags = 0; |
| 2949 | 2950 |
| 2950 // Configure against proxy server "myproxy:70". | 2951 // Configure against proxy server "myproxy:70". |
| 2951 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 2952 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 2952 | 2953 |
| 2953 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 2954 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 2954 | 2955 |
| 2955 scoped_ptr<HttpTransaction> trans( | 2956 scoped_ptr<HttpTransaction> trans( |
| 2956 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 2957 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 2957 | 2958 |
| 2958 // Since we have proxy, should try to establish tunnel. | 2959 // Since we have proxy, should try to establish tunnel. |
| 2959 MockWrite data_writes[] = { | 2960 MockWrite data_writes[] = { |
| 2960 MockWrite( | 2961 MockWrite( |
| 2961 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 2962 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 2962 "Host: www.example.org\r\n" | 2963 "Host: www.example.org\r\n" |
| 2963 "Proxy-Connection: keep-alive\r\n\r\n"), | 2964 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3003 // caller when the proxy responds to CONNECT with 407. | 3004 // caller when the proxy responds to CONNECT with 407. |
| 3004 TEST_P(HttpNetworkTransactionTest, SanitizeProxyAuthHeaders) { | 3005 TEST_P(HttpNetworkTransactionTest, SanitizeProxyAuthHeaders) { |
| 3005 HttpRequestInfo request; | 3006 HttpRequestInfo request; |
| 3006 request.method = "GET"; | 3007 request.method = "GET"; |
| 3007 request.url = GURL("https://www.example.org/"); | 3008 request.url = GURL("https://www.example.org/"); |
| 3008 request.load_flags = 0; | 3009 request.load_flags = 0; |
| 3009 | 3010 |
| 3010 // Configure against proxy server "myproxy:70". | 3011 // Configure against proxy server "myproxy:70". |
| 3011 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 3012 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 3012 | 3013 |
| 3013 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3014 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3014 | 3015 |
| 3015 scoped_ptr<HttpTransaction> trans( | 3016 scoped_ptr<HttpTransaction> trans( |
| 3016 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3017 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3017 | 3018 |
| 3018 // Since we have proxy, should try to establish tunnel. | 3019 // Since we have proxy, should try to establish tunnel. |
| 3019 MockWrite data_writes[] = { | 3020 MockWrite data_writes[] = { |
| 3020 MockWrite( | 3021 MockWrite( |
| 3021 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3022 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3022 "Host: www.example.org\r\n" | 3023 "Host: www.example.org\r\n" |
| 3023 "Proxy-Connection: keep-alive\r\n\r\n"), | 3024 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3064 | 3065 |
| 3065 // Test when a server (non-proxy) returns a 407 (proxy-authenticate). | 3066 // Test when a server (non-proxy) returns a 407 (proxy-authenticate). |
| 3066 // The request should fail with ERR_UNEXPECTED_PROXY_AUTH. | 3067 // The request should fail with ERR_UNEXPECTED_PROXY_AUTH. |
| 3067 TEST_P(HttpNetworkTransactionTest, UnexpectedProxyAuth) { | 3068 TEST_P(HttpNetworkTransactionTest, UnexpectedProxyAuth) { |
| 3068 HttpRequestInfo request; | 3069 HttpRequestInfo request; |
| 3069 request.method = "GET"; | 3070 request.method = "GET"; |
| 3070 request.url = GURL("http://www.example.org/"); | 3071 request.url = GURL("http://www.example.org/"); |
| 3071 request.load_flags = 0; | 3072 request.load_flags = 0; |
| 3072 | 3073 |
| 3073 // We are using a DIRECT connection (i.e. no proxy) for this session. | 3074 // We are using a DIRECT connection (i.e. no proxy) for this session. |
| 3074 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3075 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3075 scoped_ptr<HttpTransaction> trans( | 3076 scoped_ptr<HttpTransaction> trans( |
| 3076 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3077 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3077 | 3078 |
| 3078 MockWrite data_writes1[] = { | 3079 MockWrite data_writes1[] = { |
| 3079 MockWrite( | 3080 MockWrite( |
| 3080 "GET / HTTP/1.1\r\n" | 3081 "GET / HTTP/1.1\r\n" |
| 3081 "Host: www.example.org\r\n" | 3082 "Host: www.example.org\r\n" |
| 3082 "Connection: keep-alive\r\n\r\n"), | 3083 "Connection: keep-alive\r\n\r\n"), |
| 3083 }; | 3084 }; |
| 3084 | 3085 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 3112 // issued the challenge. | 3113 // issued the challenge. |
| 3113 TEST_P(HttpNetworkTransactionTest, | 3114 TEST_P(HttpNetworkTransactionTest, |
| 3114 HttpsServerRequestsProxyAuthThroughProxy) { | 3115 HttpsServerRequestsProxyAuthThroughProxy) { |
| 3115 HttpRequestInfo request; | 3116 HttpRequestInfo request; |
| 3116 request.method = "GET"; | 3117 request.method = "GET"; |
| 3117 request.url = GURL("https://www.example.org/"); | 3118 request.url = GURL("https://www.example.org/"); |
| 3118 | 3119 |
| 3119 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 3120 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 3120 BoundTestNetLog log; | 3121 BoundTestNetLog log; |
| 3121 session_deps_.net_log = log.bound().net_log(); | 3122 session_deps_.net_log = log.bound().net_log(); |
| 3122 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3123 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3123 | 3124 |
| 3124 // Since we have proxy, should try to establish tunnel. | 3125 // Since we have proxy, should try to establish tunnel. |
| 3125 MockWrite data_writes1[] = { | 3126 MockWrite data_writes1[] = { |
| 3126 MockWrite( | 3127 MockWrite( |
| 3127 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3128 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3128 "Host: www.example.org\r\n" | 3129 "Host: www.example.org\r\n" |
| 3129 "Proxy-Connection: keep-alive\r\n\r\n"), | 3130 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 3130 | 3131 |
| 3131 MockWrite( | 3132 MockWrite( |
| 3132 "GET / HTTP/1.1\r\n" | 3133 "GET / HTTP/1.1\r\n" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3178 | 3179 |
| 3179 HttpRequestInfo request2; | 3180 HttpRequestInfo request2; |
| 3180 request2.method = "GET"; | 3181 request2.method = "GET"; |
| 3181 request2.url = GURL("https://www.example.org/2"); | 3182 request2.url = GURL("https://www.example.org/2"); |
| 3182 | 3183 |
| 3183 // Configure against proxy server "myproxy:70". | 3184 // Configure against proxy server "myproxy:70". |
| 3184 session_deps_.proxy_service.reset( | 3185 session_deps_.proxy_service.reset( |
| 3185 ProxyService::CreateFixed("PROXY myproxy:70")); | 3186 ProxyService::CreateFixed("PROXY myproxy:70")); |
| 3186 BoundTestNetLog log; | 3187 BoundTestNetLog log; |
| 3187 session_deps_.net_log = log.bound().net_log(); | 3188 session_deps_.net_log = log.bound().net_log(); |
| 3188 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3189 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3189 | 3190 |
| 3190 // Since we have proxy, should try to establish tunnel. | 3191 // Since we have proxy, should try to establish tunnel. |
| 3191 MockWrite data_writes1[] = { | 3192 MockWrite data_writes1[] = { |
| 3192 MockWrite( | 3193 MockWrite( |
| 3193 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3194 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3194 "Host: www.example.org\r\n" | 3195 "Host: www.example.org\r\n" |
| 3195 "Proxy-Connection: keep-alive\r\n\r\n"), | 3196 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 3196 | 3197 |
| 3197 MockWrite( | 3198 MockWrite( |
| 3198 "GET /1 HTTP/1.1\r\n" | 3199 "GET /1 HTTP/1.1\r\n" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3279 | 3280 |
| 3280 HttpRequestInfo request2; | 3281 HttpRequestInfo request2; |
| 3281 request2.method = "GET"; | 3282 request2.method = "GET"; |
| 3282 request2.url = GURL("https://www.example.org/2"); | 3283 request2.url = GURL("https://www.example.org/2"); |
| 3283 | 3284 |
| 3284 // Configure against proxy server "myproxy:70". | 3285 // Configure against proxy server "myproxy:70". |
| 3285 session_deps_.proxy_service.reset( | 3286 session_deps_.proxy_service.reset( |
| 3286 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 3287 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 3287 BoundTestNetLog log; | 3288 BoundTestNetLog log; |
| 3288 session_deps_.net_log = log.bound().net_log(); | 3289 session_deps_.net_log = log.bound().net_log(); |
| 3289 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3290 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3290 | 3291 |
| 3291 // Since we have proxy, should try to establish tunnel. | 3292 // Since we have proxy, should try to establish tunnel. |
| 3292 MockWrite data_writes1[] = { | 3293 MockWrite data_writes1[] = { |
| 3293 MockWrite( | 3294 MockWrite( |
| 3294 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 3295 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 3295 "Host: www.example.org\r\n" | 3296 "Host: www.example.org\r\n" |
| 3296 "Proxy-Connection: keep-alive\r\n\r\n"), | 3297 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 3297 | 3298 |
| 3298 MockWrite( | 3299 MockWrite( |
| 3299 "GET /1 HTTP/1.1\r\n" | 3300 "GET /1 HTTP/1.1\r\n" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3377 TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) { | 3378 TEST_P(HttpNetworkTransactionTest, HttpsProxyGet) { |
| 3378 HttpRequestInfo request; | 3379 HttpRequestInfo request; |
| 3379 request.method = "GET"; | 3380 request.method = "GET"; |
| 3380 request.url = GURL("http://www.example.org/"); | 3381 request.url = GURL("http://www.example.org/"); |
| 3381 | 3382 |
| 3382 // Configure against https proxy server "proxy:70". | 3383 // Configure against https proxy server "proxy:70". |
| 3383 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3384 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 3384 "https://proxy:70")); | 3385 "https://proxy:70")); |
| 3385 BoundTestNetLog log; | 3386 BoundTestNetLog log; |
| 3386 session_deps_.net_log = log.bound().net_log(); | 3387 session_deps_.net_log = log.bound().net_log(); |
| 3387 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3388 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3388 | 3389 |
| 3389 // Since we have proxy, should use full url | 3390 // Since we have proxy, should use full url |
| 3390 MockWrite data_writes1[] = { | 3391 MockWrite data_writes1[] = { |
| 3391 MockWrite( | 3392 MockWrite( |
| 3392 "GET http://www.example.org/ HTTP/1.1\r\n" | 3393 "GET http://www.example.org/ HTTP/1.1\r\n" |
| 3393 "Host: www.example.org\r\n" | 3394 "Host: www.example.org\r\n" |
| 3394 "Proxy-Connection: keep-alive\r\n\r\n"), | 3395 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 3395 }; | 3396 }; |
| 3396 | 3397 |
| 3397 MockRead data_reads1[] = { | 3398 MockRead data_reads1[] = { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3440 HttpRequestInfo request; | 3441 HttpRequestInfo request; |
| 3441 request.method = "GET"; | 3442 request.method = "GET"; |
| 3442 request.url = GURL("http://www.example.org/"); | 3443 request.url = GURL("http://www.example.org/"); |
| 3443 request.load_flags = 0; | 3444 request.load_flags = 0; |
| 3444 | 3445 |
| 3445 // Configure against https proxy server "proxy:70". | 3446 // Configure against https proxy server "proxy:70". |
| 3446 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3447 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 3447 "https://proxy:70")); | 3448 "https://proxy:70")); |
| 3448 BoundTestNetLog log; | 3449 BoundTestNetLog log; |
| 3449 session_deps_.net_log = log.bound().net_log(); | 3450 session_deps_.net_log = log.bound().net_log(); |
| 3450 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3451 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3451 | 3452 |
| 3452 // fetch http://www.example.org/ via SPDY | 3453 // fetch http://www.example.org/ via SPDY |
| 3453 scoped_ptr<SpdyFrame> req( | 3454 scoped_ptr<SpdyFrame> req( |
| 3454 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3455 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 3455 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; | 3456 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; |
| 3456 | 3457 |
| 3457 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 3458 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 3458 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); | 3459 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 3459 MockRead spdy_reads[] = { | 3460 MockRead spdy_reads[] = { |
| 3460 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), | 3461 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3501 HttpRequestInfo request; | 3502 HttpRequestInfo request; |
| 3502 request.method = "GET"; | 3503 request.method = "GET"; |
| 3503 request.url = GURL("http://www.example.org/"); | 3504 request.url = GURL("http://www.example.org/"); |
| 3504 request.load_flags = 0; | 3505 request.load_flags = 0; |
| 3505 | 3506 |
| 3506 // Configure SPDY proxy server "proxy:70". | 3507 // Configure SPDY proxy server "proxy:70". |
| 3507 session_deps_.proxy_service.reset( | 3508 session_deps_.proxy_service.reset( |
| 3508 ProxyService::CreateFixed("https://proxy:70")); | 3509 ProxyService::CreateFixed("https://proxy:70")); |
| 3509 BoundTestNetLog log; | 3510 BoundTestNetLog log; |
| 3510 session_deps_.net_log = log.bound().net_log(); | 3511 session_deps_.net_log = log.bound().net_log(); |
| 3511 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3512 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3512 | 3513 |
| 3513 // Fetch http://www.example.org/ through the SPDY proxy. | 3514 // Fetch http://www.example.org/ through the SPDY proxy. |
| 3514 scoped_ptr<SpdyFrame> req( | 3515 scoped_ptr<SpdyFrame> req( |
| 3515 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3516 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 3516 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; | 3517 MockWrite spdy_writes[] = {CreateMockWrite(*req, 0)}; |
| 3517 | 3518 |
| 3518 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 3519 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 3519 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); | 3520 scoped_ptr<SpdyFrame> data(spdy_util_.ConstructSpdyBodyFrame(1, true)); |
| 3520 MockRead spdy_reads[] = { | 3521 MockRead spdy_reads[] = { |
| 3521 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), | 3522 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3571 HttpRequestInfo request; | 3572 HttpRequestInfo request; |
| 3572 request.method = "GET"; | 3573 request.method = "GET"; |
| 3573 request.url = GURL("http://www.example.org/"); | 3574 request.url = GURL("http://www.example.org/"); |
| 3574 request.load_flags = 0; | 3575 request.load_flags = 0; |
| 3575 | 3576 |
| 3576 // Configure against https proxy server "myproxy:70". | 3577 // Configure against https proxy server "myproxy:70". |
| 3577 session_deps_.proxy_service.reset( | 3578 session_deps_.proxy_service.reset( |
| 3578 ProxyService::CreateFixed("https://myproxy:70")); | 3579 ProxyService::CreateFixed("https://myproxy:70")); |
| 3579 BoundTestNetLog log; | 3580 BoundTestNetLog log; |
| 3580 session_deps_.net_log = log.bound().net_log(); | 3581 session_deps_.net_log = log.bound().net_log(); |
| 3581 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3582 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3582 | 3583 |
| 3583 // The first request will be a bare GET, the second request will be a | 3584 // The first request will be a bare GET, the second request will be a |
| 3584 // GET with a Proxy-Authorization header. | 3585 // GET with a Proxy-Authorization header. |
| 3585 scoped_ptr<SpdyFrame> req_get( | 3586 scoped_ptr<SpdyFrame> req_get( |
| 3586 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 3587 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 3587 const char* const kExtraAuthorizationHeaders[] = { | 3588 const char* const kExtraAuthorizationHeaders[] = { |
| 3588 "proxy-authorization", "Basic Zm9vOmJhcg==" | 3589 "proxy-authorization", "Basic Zm9vOmJhcg==" |
| 3589 }; | 3590 }; |
| 3590 scoped_ptr<SpdyFrame> req_get_authorization( | 3591 scoped_ptr<SpdyFrame> req_get_authorization( |
| 3591 spdy_util_.ConstructSpdyGet(kExtraAuthorizationHeaders, | 3592 spdy_util_.ConstructSpdyGet(kExtraAuthorizationHeaders, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3672 HttpRequestInfo request; | 3673 HttpRequestInfo request; |
| 3673 request.method = "GET"; | 3674 request.method = "GET"; |
| 3674 request.url = GURL("https://www.example.org/"); | 3675 request.url = GURL("https://www.example.org/"); |
| 3675 request.load_flags = 0; | 3676 request.load_flags = 0; |
| 3676 | 3677 |
| 3677 // Configure against https proxy server "proxy:70". | 3678 // Configure against https proxy server "proxy:70". |
| 3678 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3679 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 3679 "https://proxy:70")); | 3680 "https://proxy:70")); |
| 3680 BoundTestNetLog log; | 3681 BoundTestNetLog log; |
| 3681 session_deps_.net_log = log.bound().net_log(); | 3682 session_deps_.net_log = log.bound().net_log(); |
| 3682 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3683 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3683 | 3684 |
| 3684 scoped_ptr<HttpTransaction> trans( | 3685 scoped_ptr<HttpTransaction> trans( |
| 3685 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3686 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3686 | 3687 |
| 3687 // CONNECT to www.example.org:443 via SPDY | 3688 // CONNECT to www.example.org:443 via SPDY |
| 3688 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3689 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
| 3689 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3690 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| 3690 // fetch https://www.example.org/ via HTTP | 3691 // fetch https://www.example.org/ via HTTP |
| 3691 | 3692 |
| 3692 const char get[] = | 3693 const char get[] = |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3757 HttpRequestInfo request; | 3758 HttpRequestInfo request; |
| 3758 request.method = "GET"; | 3759 request.method = "GET"; |
| 3759 request.url = GURL("https://www.example.org/"); | 3760 request.url = GURL("https://www.example.org/"); |
| 3760 request.load_flags = 0; | 3761 request.load_flags = 0; |
| 3761 | 3762 |
| 3762 // Configure against https proxy server "proxy:70". | 3763 // Configure against https proxy server "proxy:70". |
| 3763 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3764 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 3764 "https://proxy:70")); | 3765 "https://proxy:70")); |
| 3765 BoundTestNetLog log; | 3766 BoundTestNetLog log; |
| 3766 session_deps_.net_log = log.bound().net_log(); | 3767 session_deps_.net_log = log.bound().net_log(); |
| 3767 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3768 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3768 | 3769 |
| 3769 scoped_ptr<HttpTransaction> trans( | 3770 scoped_ptr<HttpTransaction> trans( |
| 3770 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3771 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3771 | 3772 |
| 3772 // CONNECT to www.example.org:443 via SPDY | 3773 // CONNECT to www.example.org:443 via SPDY |
| 3773 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3774 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
| 3774 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3775 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| 3775 // fetch https://www.example.org/ via SPDY | 3776 // fetch https://www.example.org/ via SPDY |
| 3776 const char kMyUrl[] = "https://www.example.org/"; | 3777 const char kMyUrl[] = "https://www.example.org/"; |
| 3777 scoped_ptr<SpdyFrame> get( | 3778 scoped_ptr<SpdyFrame> get( |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3849 HttpRequestInfo request; | 3850 HttpRequestInfo request; |
| 3850 request.method = "GET"; | 3851 request.method = "GET"; |
| 3851 request.url = GURL("https://www.example.org/"); | 3852 request.url = GURL("https://www.example.org/"); |
| 3852 request.load_flags = 0; | 3853 request.load_flags = 0; |
| 3853 | 3854 |
| 3854 // Configure against https proxy server "proxy:70". | 3855 // Configure against https proxy server "proxy:70". |
| 3855 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3856 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 3856 "https://proxy:70")); | 3857 "https://proxy:70")); |
| 3857 BoundTestNetLog log; | 3858 BoundTestNetLog log; |
| 3858 session_deps_.net_log = log.bound().net_log(); | 3859 session_deps_.net_log = log.bound().net_log(); |
| 3859 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 3860 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 3860 | 3861 |
| 3861 scoped_ptr<HttpTransaction> trans( | 3862 scoped_ptr<HttpTransaction> trans( |
| 3862 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 3863 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 3863 | 3864 |
| 3864 // CONNECT to www.example.org:443 via SPDY | 3865 // CONNECT to www.example.org:443 via SPDY |
| 3865 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( | 3866 scoped_ptr<SpdyFrame> connect(spdy_util_.ConstructSpdyConnect( |
| 3866 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 3867 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| 3867 scoped_ptr<SpdyFrame> get( | 3868 scoped_ptr<SpdyFrame> get( |
| 3868 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); | 3869 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); |
| 3869 | 3870 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3901 | 3902 |
| 3902 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY | 3903 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY |
| 3903 // HTTPS Proxy to different servers. | 3904 // HTTPS Proxy to different servers. |
| 3904 TEST_P(HttpNetworkTransactionTest, | 3905 TEST_P(HttpNetworkTransactionTest, |
| 3905 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) { | 3906 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsTwoServers) { |
| 3906 // Configure against https proxy server "proxy:70". | 3907 // Configure against https proxy server "proxy:70". |
| 3907 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 3908 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 3908 "https://proxy:70")); | 3909 "https://proxy:70")); |
| 3909 BoundTestNetLog log; | 3910 BoundTestNetLog log; |
| 3910 session_deps_.net_log = log.bound().net_log(); | 3911 session_deps_.net_log = log.bound().net_log(); |
| 3911 scoped_refptr<HttpNetworkSession> session( | 3912 scoped_ptr<HttpNetworkSession> session( |
| 3912 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 3913 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
| 3913 | 3914 |
| 3914 HttpRequestInfo request1; | 3915 HttpRequestInfo request1; |
| 3915 request1.method = "GET"; | 3916 request1.method = "GET"; |
| 3916 request1.url = GURL("https://www.example.org/"); | 3917 request1.url = GURL("https://www.example.org/"); |
| 3917 request1.load_flags = 0; | 3918 request1.load_flags = 0; |
| 3918 | 3919 |
| 3919 HttpRequestInfo request2; | 3920 HttpRequestInfo request2; |
| 3920 request2.method = "GET"; | 3921 request2.method = "GET"; |
| 3921 request2.url = GURL("https://mail.example.org/"); | 3922 request2.url = GURL("https://mail.example.org/"); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4044 | 4045 |
| 4045 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY | 4046 // Test load timing in the case of two HTTPS (non-SPDY) requests through a SPDY |
| 4046 // HTTPS Proxy to the same server. | 4047 // HTTPS Proxy to the same server. |
| 4047 TEST_P(HttpNetworkTransactionTest, | 4048 TEST_P(HttpNetworkTransactionTest, |
| 4048 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) { | 4049 HttpsProxySpdyConnectHttpsLoadTimingTwoRequestsSameServer) { |
| 4049 // Configure against https proxy server "proxy:70". | 4050 // Configure against https proxy server "proxy:70". |
| 4050 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 4051 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 4051 "https://proxy:70")); | 4052 "https://proxy:70")); |
| 4052 BoundTestNetLog log; | 4053 BoundTestNetLog log; |
| 4053 session_deps_.net_log = log.bound().net_log(); | 4054 session_deps_.net_log = log.bound().net_log(); |
| 4054 scoped_refptr<HttpNetworkSession> session( | 4055 scoped_ptr<HttpNetworkSession> session( |
| 4055 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 4056 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
| 4056 | 4057 |
| 4057 HttpRequestInfo request1; | 4058 HttpRequestInfo request1; |
| 4058 request1.method = "GET"; | 4059 request1.method = "GET"; |
| 4059 request1.url = GURL("https://www.example.org/"); | 4060 request1.url = GURL("https://www.example.org/"); |
| 4060 request1.load_flags = 0; | 4061 request1.load_flags = 0; |
| 4061 | 4062 |
| 4062 HttpRequestInfo request2; | 4063 HttpRequestInfo request2; |
| 4063 request2.method = "GET"; | 4064 request2.method = "GET"; |
| 4064 request2.url = GURL("https://www.example.org/2"); | 4065 request2.url = GURL("https://www.example.org/2"); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4168 } | 4169 } |
| 4169 | 4170 |
| 4170 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS | 4171 // Test load timing in the case of of two HTTP requests through a SPDY HTTPS |
| 4171 // Proxy to different servers. | 4172 // Proxy to different servers. |
| 4172 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyLoadTimingTwoHttpRequests) { | 4173 TEST_P(HttpNetworkTransactionTest, HttpsProxySpdyLoadTimingTwoHttpRequests) { |
| 4173 // Configure against https proxy server "proxy:70". | 4174 // Configure against https proxy server "proxy:70". |
| 4174 session_deps_.proxy_service.reset(ProxyService::CreateFixed( | 4175 session_deps_.proxy_service.reset(ProxyService::CreateFixed( |
| 4175 "https://proxy:70")); | 4176 "https://proxy:70")); |
| 4176 BoundTestNetLog log; | 4177 BoundTestNetLog log; |
| 4177 session_deps_.net_log = log.bound().net_log(); | 4178 session_deps_.net_log = log.bound().net_log(); |
| 4178 scoped_refptr<HttpNetworkSession> session( | 4179 scoped_ptr<HttpNetworkSession> session( |
| 4179 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 4180 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
| 4180 | 4181 |
| 4181 HttpRequestInfo request1; | 4182 HttpRequestInfo request1; |
| 4182 request1.method = "GET"; | 4183 request1.method = "GET"; |
| 4183 request1.url = GURL("http://www.example.org/"); | 4184 request1.url = GURL("http://www.example.org/"); |
| 4184 request1.load_flags = 0; | 4185 request1.load_flags = 0; |
| 4185 | 4186 |
| 4186 HttpRequestInfo request2; | 4187 HttpRequestInfo request2; |
| 4187 request2.method = "GET"; | 4188 request2.method = "GET"; |
| 4188 request2.url = GURL("http://mail.example.org/"); | 4189 request2.url = GURL("http://mail.example.org/"); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4275 request.method = "GET"; | 4276 request.method = "GET"; |
| 4276 request.url = GURL("http://www.example.org/"); | 4277 request.url = GURL("http://www.example.org/"); |
| 4277 // when the no authentication data flag is set. | 4278 // when the no authentication data flag is set. |
| 4278 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 4279 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 4279 | 4280 |
| 4280 // Configure against https proxy server "myproxy:70". | 4281 // Configure against https proxy server "myproxy:70". |
| 4281 session_deps_.proxy_service.reset( | 4282 session_deps_.proxy_service.reset( |
| 4282 ProxyService::CreateFixed("https://myproxy:70")); | 4283 ProxyService::CreateFixed("https://myproxy:70")); |
| 4283 BoundTestNetLog log; | 4284 BoundTestNetLog log; |
| 4284 session_deps_.net_log = log.bound().net_log(); | 4285 session_deps_.net_log = log.bound().net_log(); |
| 4285 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4286 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4286 | 4287 |
| 4287 // Since we have proxy, should use full url | 4288 // Since we have proxy, should use full url |
| 4288 MockWrite data_writes1[] = { | 4289 MockWrite data_writes1[] = { |
| 4289 MockWrite( | 4290 MockWrite( |
| 4290 "GET http://www.example.org/ HTTP/1.1\r\n" | 4291 "GET http://www.example.org/ HTTP/1.1\r\n" |
| 4291 "Host: www.example.org\r\n" | 4292 "Host: www.example.org\r\n" |
| 4292 "Proxy-Connection: keep-alive\r\n\r\n"), | 4293 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 4293 | 4294 |
| 4294 // After calling trans->RestartWithAuth(), this is the request we should | 4295 // After calling trans->RestartWithAuth(), this is the request we should |
| 4295 // be issuing -- the final header line contains the credentials. | 4296 // be issuing -- the final header line contains the credentials. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4372 | 4373 |
| 4373 void HttpNetworkTransactionTest::ConnectStatusHelperWithExpectedStatus( | 4374 void HttpNetworkTransactionTest::ConnectStatusHelperWithExpectedStatus( |
| 4374 const MockRead& status, int expected_status) { | 4375 const MockRead& status, int expected_status) { |
| 4375 HttpRequestInfo request; | 4376 HttpRequestInfo request; |
| 4376 request.method = "GET"; | 4377 request.method = "GET"; |
| 4377 request.url = GURL("https://www.example.org/"); | 4378 request.url = GURL("https://www.example.org/"); |
| 4378 request.load_flags = 0; | 4379 request.load_flags = 0; |
| 4379 | 4380 |
| 4380 // Configure against proxy server "myproxy:70". | 4381 // Configure against proxy server "myproxy:70". |
| 4381 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 4382 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 4382 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4383 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4383 | 4384 |
| 4384 // Since we have proxy, should try to establish tunnel. | 4385 // Since we have proxy, should try to establish tunnel. |
| 4385 MockWrite data_writes[] = { | 4386 MockWrite data_writes[] = { |
| 4386 MockWrite( | 4387 MockWrite( |
| 4387 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 4388 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 4388 "Host: www.example.org\r\n" | 4389 "Host: www.example.org\r\n" |
| 4389 "Proxy-Connection: keep-alive\r\n\r\n"), | 4390 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 4390 }; | 4391 }; |
| 4391 | 4392 |
| 4392 MockRead data_reads[] = { | 4393 MockRead data_reads[] = { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4590 // authentication. Again, this uses basic auth for both since that is | 4591 // authentication. Again, this uses basic auth for both since that is |
| 4591 // the simplest to mock. | 4592 // the simplest to mock. |
| 4592 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyThenServer) { | 4593 TEST_P(HttpNetworkTransactionTest, BasicAuthProxyThenServer) { |
| 4593 HttpRequestInfo request; | 4594 HttpRequestInfo request; |
| 4594 request.method = "GET"; | 4595 request.method = "GET"; |
| 4595 request.url = GURL("http://www.example.org/"); | 4596 request.url = GURL("http://www.example.org/"); |
| 4596 request.load_flags = 0; | 4597 request.load_flags = 0; |
| 4597 | 4598 |
| 4598 // Configure against proxy server "myproxy:70". | 4599 // Configure against proxy server "myproxy:70". |
| 4599 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 4600 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 4600 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4601 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4601 | 4602 |
| 4602 scoped_ptr<HttpTransaction> trans( | 4603 scoped_ptr<HttpTransaction> trans( |
| 4603 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 4604 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 4604 | 4605 |
| 4605 MockWrite data_writes1[] = { | 4606 MockWrite data_writes1[] = { |
| 4606 MockWrite( | 4607 MockWrite( |
| 4607 "GET http://www.example.org/ HTTP/1.1\r\n" | 4608 "GET http://www.example.org/ HTTP/1.1\r\n" |
| 4608 "Host: www.example.org\r\n" | 4609 "Host: www.example.org\r\n" |
| 4609 "Proxy-Connection: keep-alive\r\n\r\n"), | 4610 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 4610 }; | 4611 }; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4726 HttpRequestInfo request; | 4727 HttpRequestInfo request; |
| 4727 request.method = "GET"; | 4728 request.method = "GET"; |
| 4728 request.url = GURL("http://172.22.68.17/kids/login.aspx"); | 4729 request.url = GURL("http://172.22.68.17/kids/login.aspx"); |
| 4729 | 4730 |
| 4730 // Ensure load is not disrupted by flags which suppress behaviour specific | 4731 // Ensure load is not disrupted by flags which suppress behaviour specific |
| 4731 // to other auth schemes. | 4732 // to other auth schemes. |
| 4732 request.load_flags = LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; | 4733 request.load_flags = LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; |
| 4733 | 4734 |
| 4734 HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom1, | 4735 HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom1, |
| 4735 MockGetHostName); | 4736 MockGetHostName); |
| 4736 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4737 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4737 | 4738 |
| 4738 MockWrite data_writes1[] = { | 4739 MockWrite data_writes1[] = { |
| 4739 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" | 4740 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" |
| 4740 "Host: 172.22.68.17\r\n" | 4741 "Host: 172.22.68.17\r\n" |
| 4741 "Connection: keep-alive\r\n\r\n"), | 4742 "Connection: keep-alive\r\n\r\n"), |
| 4742 }; | 4743 }; |
| 4743 | 4744 |
| 4744 MockRead data_reads1[] = { | 4745 MockRead data_reads1[] = { |
| 4745 MockRead("HTTP/1.1 401 Access Denied\r\n"), | 4746 MockRead("HTTP/1.1 401 Access Denied\r\n"), |
| 4746 // Negotiate and NTLM are often requested together. However, we only want | 4747 // Negotiate and NTLM are often requested together. However, we only want |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4855 | 4856 |
| 4856 // Enter a wrong password, and then the correct one. | 4857 // Enter a wrong password, and then the correct one. |
| 4857 TEST_P(HttpNetworkTransactionTest, NTLMAuth2) { | 4858 TEST_P(HttpNetworkTransactionTest, NTLMAuth2) { |
| 4858 HttpRequestInfo request; | 4859 HttpRequestInfo request; |
| 4859 request.method = "GET"; | 4860 request.method = "GET"; |
| 4860 request.url = GURL("http://172.22.68.17/kids/login.aspx"); | 4861 request.url = GURL("http://172.22.68.17/kids/login.aspx"); |
| 4861 request.load_flags = 0; | 4862 request.load_flags = 0; |
| 4862 | 4863 |
| 4863 HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom2, | 4864 HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom2, |
| 4864 MockGetHostName); | 4865 MockGetHostName); |
| 4865 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 4866 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 4866 | 4867 |
| 4867 MockWrite data_writes1[] = { | 4868 MockWrite data_writes1[] = { |
| 4868 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" | 4869 MockWrite("GET /kids/login.aspx HTTP/1.1\r\n" |
| 4869 "Host: 172.22.68.17\r\n" | 4870 "Host: 172.22.68.17\r\n" |
| 4870 "Connection: keep-alive\r\n\r\n"), | 4871 "Connection: keep-alive\r\n\r\n"), |
| 4871 }; | 4872 }; |
| 4872 | 4873 |
| 4873 MockRead data_reads1[] = { | 4874 MockRead data_reads1[] = { |
| 4874 MockRead("HTTP/1.1 401 Access Denied\r\n"), | 4875 MockRead("HTTP/1.1 401 Access Denied\r\n"), |
| 4875 // Negotiate and NTLM are often requested together. However, we only want | 4876 // Negotiate and NTLM are often requested together. However, we only want |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5055 | 5056 |
| 5056 // Test reading a server response which has only headers, and no body. | 5057 // Test reading a server response which has only headers, and no body. |
| 5057 // After some maximum number of bytes is consumed, the transaction should | 5058 // After some maximum number of bytes is consumed, the transaction should |
| 5058 // fail with ERR_RESPONSE_HEADERS_TOO_BIG. | 5059 // fail with ERR_RESPONSE_HEADERS_TOO_BIG. |
| 5059 TEST_P(HttpNetworkTransactionTest, LargeHeadersNoBody) { | 5060 TEST_P(HttpNetworkTransactionTest, LargeHeadersNoBody) { |
| 5060 HttpRequestInfo request; | 5061 HttpRequestInfo request; |
| 5061 request.method = "GET"; | 5062 request.method = "GET"; |
| 5062 request.url = GURL("http://www.example.org/"); | 5063 request.url = GURL("http://www.example.org/"); |
| 5063 request.load_flags = 0; | 5064 request.load_flags = 0; |
| 5064 | 5065 |
| 5065 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5066 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5066 scoped_ptr<HttpTransaction> trans( | 5067 scoped_ptr<HttpTransaction> trans( |
| 5067 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5068 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5068 | 5069 |
| 5069 // Respond with 300 kb of headers (we should fail after 256 kb). | 5070 // Respond with 300 kb of headers (we should fail after 256 kb). |
| 5070 std::string large_headers_string; | 5071 std::string large_headers_string; |
| 5071 FillLargeHeadersString(&large_headers_string, 300 * 1024); | 5072 FillLargeHeadersString(&large_headers_string, 300 * 1024); |
| 5072 | 5073 |
| 5073 MockRead data_reads[] = { | 5074 MockRead data_reads[] = { |
| 5074 MockRead("HTTP/1.0 200 OK\r\n"), | 5075 MockRead("HTTP/1.0 200 OK\r\n"), |
| 5075 MockRead(ASYNC, large_headers_string.data(), large_headers_string.size()), | 5076 MockRead(ASYNC, large_headers_string.data(), large_headers_string.size()), |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 5094 TEST_P(HttpNetworkTransactionTest, | 5095 TEST_P(HttpNetworkTransactionTest, |
| 5095 DontRecycleTransportSocketForSSLTunnel) { | 5096 DontRecycleTransportSocketForSSLTunnel) { |
| 5096 HttpRequestInfo request; | 5097 HttpRequestInfo request; |
| 5097 request.method = "GET"; | 5098 request.method = "GET"; |
| 5098 request.url = GURL("https://www.example.org/"); | 5099 request.url = GURL("https://www.example.org/"); |
| 5099 request.load_flags = 0; | 5100 request.load_flags = 0; |
| 5100 | 5101 |
| 5101 // Configure against proxy server "myproxy:70". | 5102 // Configure against proxy server "myproxy:70". |
| 5102 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 5103 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 5103 | 5104 |
| 5104 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5105 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5105 | 5106 |
| 5106 scoped_ptr<HttpTransaction> trans( | 5107 scoped_ptr<HttpTransaction> trans( |
| 5107 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5108 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5108 | 5109 |
| 5109 // Since we have proxy, should try to establish tunnel. | 5110 // Since we have proxy, should try to establish tunnel. |
| 5110 MockWrite data_writes1[] = { | 5111 MockWrite data_writes1[] = { |
| 5111 MockWrite( | 5112 MockWrite( |
| 5112 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 5113 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 5113 "Host: www.example.org\r\n" | 5114 "Host: www.example.org\r\n" |
| 5114 "Proxy-Connection: keep-alive\r\n\r\n"), | 5115 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5148 EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); | 5149 EXPECT_EQ(0, GetIdleSocketCountInTransportSocketPool(session.get())); |
| 5149 } | 5150 } |
| 5150 | 5151 |
| 5151 // Make sure that we recycle a socket after reading all of the response body. | 5152 // Make sure that we recycle a socket after reading all of the response body. |
| 5152 TEST_P(HttpNetworkTransactionTest, RecycleSocket) { | 5153 TEST_P(HttpNetworkTransactionTest, RecycleSocket) { |
| 5153 HttpRequestInfo request; | 5154 HttpRequestInfo request; |
| 5154 request.method = "GET"; | 5155 request.method = "GET"; |
| 5155 request.url = GURL("http://www.example.org/"); | 5156 request.url = GURL("http://www.example.org/"); |
| 5156 request.load_flags = 0; | 5157 request.load_flags = 0; |
| 5157 | 5158 |
| 5158 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5159 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5159 | 5160 |
| 5160 scoped_ptr<HttpTransaction> trans( | 5161 scoped_ptr<HttpTransaction> trans( |
| 5161 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5162 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5162 | 5163 |
| 5163 MockRead data_reads[] = { | 5164 MockRead data_reads[] = { |
| 5164 // A part of the response body is received with the response headers. | 5165 // A part of the response body is received with the response headers. |
| 5165 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\nhel"), | 5166 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\nhel"), |
| 5166 // The rest of the response body is received in two parts. | 5167 // The rest of the response body is received in two parts. |
| 5167 MockRead("lo"), | 5168 MockRead("lo"), |
| 5168 MockRead(" world"), | 5169 MockRead(" world"), |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5227 | 5228 |
| 5228 SSLSocketDataProvider ssl(ASYNC, OK); | 5229 SSLSocketDataProvider ssl(ASYNC, OK); |
| 5229 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 5230 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 5230 | 5231 |
| 5231 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 5232 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 5232 data_writes, arraysize(data_writes)); | 5233 data_writes, arraysize(data_writes)); |
| 5233 session_deps_.socket_factory->AddSocketDataProvider(&data); | 5234 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 5234 | 5235 |
| 5235 TestCompletionCallback callback; | 5236 TestCompletionCallback callback; |
| 5236 | 5237 |
| 5237 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5238 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5238 scoped_ptr<HttpTransaction> trans( | 5239 scoped_ptr<HttpTransaction> trans( |
| 5239 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5240 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5240 | 5241 |
| 5241 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 5242 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 5242 | 5243 |
| 5243 EXPECT_EQ(ERR_IO_PENDING, rv); | 5244 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5244 EXPECT_EQ(OK, callback.WaitForResult()); | 5245 EXPECT_EQ(OK, callback.WaitForResult()); |
| 5245 | 5246 |
| 5246 const HttpResponseInfo* response = trans->GetResponseInfo(); | 5247 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 5247 ASSERT_TRUE(response != NULL); | 5248 ASSERT_TRUE(response != NULL); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5297 | 5298 |
| 5298 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 5299 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 5299 data_writes, arraysize(data_writes)); | 5300 data_writes, arraysize(data_writes)); |
| 5300 StaticSocketDataProvider data2(data_reads, arraysize(data_reads), | 5301 StaticSocketDataProvider data2(data_reads, arraysize(data_reads), |
| 5301 data_writes, arraysize(data_writes)); | 5302 data_writes, arraysize(data_writes)); |
| 5302 session_deps_.socket_factory->AddSocketDataProvider(&data); | 5303 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 5303 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 5304 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
| 5304 | 5305 |
| 5305 TestCompletionCallback callback; | 5306 TestCompletionCallback callback; |
| 5306 | 5307 |
| 5307 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5308 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5308 scoped_ptr<HttpTransaction> trans( | 5309 scoped_ptr<HttpTransaction> trans( |
| 5309 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5310 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5310 | 5311 |
| 5311 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 5312 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 5312 | 5313 |
| 5313 EXPECT_EQ(ERR_IO_PENDING, rv); | 5314 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 5314 EXPECT_EQ(OK, callback.WaitForResult()); | 5315 EXPECT_EQ(OK, callback.WaitForResult()); |
| 5315 | 5316 |
| 5316 const HttpResponseInfo* response = trans->GetResponseInfo(); | 5317 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 5317 ASSERT_TRUE(response != NULL); | 5318 ASSERT_TRUE(response != NULL); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5365 TEST_P(HttpNetworkTransactionTest, RecycleSocketAfterZeroContentLength) { | 5366 TEST_P(HttpNetworkTransactionTest, RecycleSocketAfterZeroContentLength) { |
| 5366 HttpRequestInfo request; | 5367 HttpRequestInfo request; |
| 5367 request.method = "GET"; | 5368 request.method = "GET"; |
| 5368 request.url = GURL( | 5369 request.url = GURL( |
| 5369 "http://www.example.org/csi?v=3&s=web&action=&" | 5370 "http://www.example.org/csi?v=3&s=web&action=&" |
| 5370 "tran=undefined&ei=mAXcSeegAo-SMurloeUN&" | 5371 "tran=undefined&ei=mAXcSeegAo-SMurloeUN&" |
| 5371 "e=17259,18167,19592,19773,19981,20133,20173,20233&" | 5372 "e=17259,18167,19592,19773,19981,20133,20173,20233&" |
| 5372 "rt=prt.2642,ol.2649,xjs.2951"); | 5373 "rt=prt.2642,ol.2649,xjs.2951"); |
| 5373 request.load_flags = 0; | 5374 request.load_flags = 0; |
| 5374 | 5375 |
| 5375 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5376 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5376 | 5377 |
| 5377 scoped_ptr<HttpTransaction> trans( | 5378 scoped_ptr<HttpTransaction> trans( |
| 5378 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5379 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5379 | 5380 |
| 5380 MockRead data_reads[] = { | 5381 MockRead data_reads[] = { |
| 5381 MockRead("HTTP/1.1 204 No Content\r\n" | 5382 MockRead("HTTP/1.1 204 No Content\r\n" |
| 5382 "Content-Length: 0\r\n" | 5383 "Content-Length: 0\r\n" |
| 5383 "Content-Type: text/html\r\n\r\n"), | 5384 "Content-Type: text/html\r\n\r\n"), |
| 5384 MockRead("junk"), // Should not be read!! | 5385 MockRead("junk"), // Should not be read!! |
| 5385 MockRead(SYNCHRONOUS, OK), | 5386 MockRead(SYNCHRONOUS, OK), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5431 request[0].load_flags = 0; | 5432 request[0].load_flags = 0; |
| 5432 // Transaction 2: a POST request. Reuses the socket kept alive from | 5433 // Transaction 2: a POST request. Reuses the socket kept alive from |
| 5433 // transaction 1. The first attempts fails when writing the POST data. | 5434 // transaction 1. The first attempts fails when writing the POST data. |
| 5434 // This causes the transaction to retry with a new socket. The second | 5435 // This causes the transaction to retry with a new socket. The second |
| 5435 // attempt succeeds. | 5436 // attempt succeeds. |
| 5436 request[1].method = "POST"; | 5437 request[1].method = "POST"; |
| 5437 request[1].url = GURL("http://www.google.com/login.cgi"); | 5438 request[1].url = GURL("http://www.google.com/login.cgi"); |
| 5438 request[1].upload_data_stream = &upload_data_stream; | 5439 request[1].upload_data_stream = &upload_data_stream; |
| 5439 request[1].load_flags = 0; | 5440 request[1].load_flags = 0; |
| 5440 | 5441 |
| 5441 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5442 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5442 | 5443 |
| 5443 // The first socket is used for transaction 1 and the first attempt of | 5444 // The first socket is used for transaction 1 and the first attempt of |
| 5444 // transaction 2. | 5445 // transaction 2. |
| 5445 | 5446 |
| 5446 // The response of transaction 1. | 5447 // The response of transaction 1. |
| 5447 MockRead data_reads1[] = { | 5448 MockRead data_reads1[] = { |
| 5448 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\n"), | 5449 MockRead("HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\n"), |
| 5449 MockRead("hello world"), | 5450 MockRead("hello world"), |
| 5450 MockRead(SYNCHRONOUS, OK), | 5451 MockRead(SYNCHRONOUS, OK), |
| 5451 }; | 5452 }; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5509 | 5510 |
| 5510 // Test the request-challenge-retry sequence for basic auth when there is | 5511 // Test the request-challenge-retry sequence for basic auth when there is |
| 5511 // an identity in the URL. The request should be sent as normal, but when | 5512 // an identity in the URL. The request should be sent as normal, but when |
| 5512 // it fails the identity from the URL is used to answer the challenge. | 5513 // it fails the identity from the URL is used to answer the challenge. |
| 5513 TEST_P(HttpNetworkTransactionTest, AuthIdentityInURL) { | 5514 TEST_P(HttpNetworkTransactionTest, AuthIdentityInURL) { |
| 5514 HttpRequestInfo request; | 5515 HttpRequestInfo request; |
| 5515 request.method = "GET"; | 5516 request.method = "GET"; |
| 5516 request.url = GURL("http://foo:b@r@www.example.org/"); | 5517 request.url = GURL("http://foo:b@r@www.example.org/"); |
| 5517 request.load_flags = LOAD_NORMAL; | 5518 request.load_flags = LOAD_NORMAL; |
| 5518 | 5519 |
| 5519 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5520 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5520 scoped_ptr<HttpTransaction> trans( | 5521 scoped_ptr<HttpTransaction> trans( |
| 5521 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5522 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5522 | 5523 |
| 5523 // The password contains an escaped character -- for this test to pass it | 5524 // The password contains an escaped character -- for this test to pass it |
| 5524 // will need to be unescaped by HttpNetworkTransaction. | 5525 // will need to be unescaped by HttpNetworkTransaction. |
| 5525 EXPECT_EQ("b%40r", request.url.password()); | 5526 EXPECT_EQ("b%40r", request.url.password()); |
| 5526 | 5527 |
| 5527 MockWrite data_writes1[] = { | 5528 MockWrite data_writes1[] = { |
| 5528 MockWrite( | 5529 MockWrite( |
| 5529 "GET / HTTP/1.1\r\n" | 5530 "GET / HTTP/1.1\r\n" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5592 // once. | 5593 // once. |
| 5593 TEST_P(HttpNetworkTransactionTest, WrongAuthIdentityInURL) { | 5594 TEST_P(HttpNetworkTransactionTest, WrongAuthIdentityInURL) { |
| 5594 HttpRequestInfo request; | 5595 HttpRequestInfo request; |
| 5595 request.method = "GET"; | 5596 request.method = "GET"; |
| 5596 // Note: the URL has a username:password in it. The password "baz" is | 5597 // Note: the URL has a username:password in it. The password "baz" is |
| 5597 // wrong (should be "bar"). | 5598 // wrong (should be "bar"). |
| 5598 request.url = GURL("http://foo:baz@www.example.org/"); | 5599 request.url = GURL("http://foo:baz@www.example.org/"); |
| 5599 | 5600 |
| 5600 request.load_flags = LOAD_NORMAL; | 5601 request.load_flags = LOAD_NORMAL; |
| 5601 | 5602 |
| 5602 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5603 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5603 scoped_ptr<HttpTransaction> trans( | 5604 scoped_ptr<HttpTransaction> trans( |
| 5604 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5605 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5605 | 5606 |
| 5606 MockWrite data_writes1[] = { | 5607 MockWrite data_writes1[] = { |
| 5607 MockWrite( | 5608 MockWrite( |
| 5608 "GET / HTTP/1.1\r\n" | 5609 "GET / HTTP/1.1\r\n" |
| 5609 "Host: www.example.org\r\n" | 5610 "Host: www.example.org\r\n" |
| 5610 "Connection: keep-alive\r\n\r\n"), | 5611 "Connection: keep-alive\r\n\r\n"), |
| 5611 }; | 5612 }; |
| 5612 | 5613 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5703 | 5704 |
| 5704 // Test the request-challenge-retry sequence for basic auth when there is a | 5705 // Test the request-challenge-retry sequence for basic auth when there is a |
| 5705 // correct identity in the URL, but its use is being suppressed. The identity | 5706 // correct identity in the URL, but its use is being suppressed. The identity |
| 5706 // from the URL should never be used. | 5707 // from the URL should never be used. |
| 5707 TEST_P(HttpNetworkTransactionTest, AuthIdentityInURLSuppressed) { | 5708 TEST_P(HttpNetworkTransactionTest, AuthIdentityInURLSuppressed) { |
| 5708 HttpRequestInfo request; | 5709 HttpRequestInfo request; |
| 5709 request.method = "GET"; | 5710 request.method = "GET"; |
| 5710 request.url = GURL("http://foo:bar@www.example.org/"); | 5711 request.url = GURL("http://foo:bar@www.example.org/"); |
| 5711 request.load_flags = LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; | 5712 request.load_flags = LOAD_DO_NOT_USE_EMBEDDED_IDENTITY; |
| 5712 | 5713 |
| 5713 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5714 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5714 scoped_ptr<HttpTransaction> trans( | 5715 scoped_ptr<HttpTransaction> trans( |
| 5715 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5716 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 5716 | 5717 |
| 5717 MockWrite data_writes1[] = { | 5718 MockWrite data_writes1[] = { |
| 5718 MockWrite( | 5719 MockWrite( |
| 5719 "GET / HTTP/1.1\r\n" | 5720 "GET / HTTP/1.1\r\n" |
| 5720 "Host: www.example.org\r\n" | 5721 "Host: www.example.org\r\n" |
| 5721 "Connection: keep-alive\r\n\r\n"), | 5722 "Connection: keep-alive\r\n\r\n"), |
| 5722 }; | 5723 }; |
| 5723 | 5724 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5777 // There is no challenge info, since the identity worked. | 5778 // There is no challenge info, since the identity worked. |
| 5778 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 5779 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 5779 EXPECT_EQ(100, response->headers->GetContentLength()); | 5780 EXPECT_EQ(100, response->headers->GetContentLength()); |
| 5780 | 5781 |
| 5781 // Empty the current queue. | 5782 // Empty the current queue. |
| 5782 base::MessageLoop::current()->RunUntilIdle(); | 5783 base::MessageLoop::current()->RunUntilIdle(); |
| 5783 } | 5784 } |
| 5784 | 5785 |
| 5785 // Test that previously tried username/passwords for a realm get re-used. | 5786 // Test that previously tried username/passwords for a realm get re-used. |
| 5786 TEST_P(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) { | 5787 TEST_P(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) { |
| 5787 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 5788 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 5788 | 5789 |
| 5789 // Transaction 1: authenticate (foo, bar) on MyRealm1 | 5790 // Transaction 1: authenticate (foo, bar) on MyRealm1 |
| 5790 { | 5791 { |
| 5791 HttpRequestInfo request; | 5792 HttpRequestInfo request; |
| 5792 request.method = "GET"; | 5793 request.method = "GET"; |
| 5793 request.url = GURL("http://www.example.org/x/y/z"); | 5794 request.url = GURL("http://www.example.org/x/y/z"); |
| 5794 request.load_flags = 0; | 5795 request.load_flags = 0; |
| 5795 | 5796 |
| 5796 scoped_ptr<HttpTransaction> trans( | 5797 scoped_ptr<HttpTransaction> trans( |
| 5797 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 5798 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6177 | 6178 |
| 6178 // Tests that nonce count increments when multiple auth attempts | 6179 // Tests that nonce count increments when multiple auth attempts |
| 6179 // are started with the same nonce. | 6180 // are started with the same nonce. |
| 6180 TEST_P(HttpNetworkTransactionTest, DigestPreAuthNonceCount) { | 6181 TEST_P(HttpNetworkTransactionTest, DigestPreAuthNonceCount) { |
| 6181 HttpAuthHandlerDigest::Factory* digest_factory = | 6182 HttpAuthHandlerDigest::Factory* digest_factory = |
| 6182 new HttpAuthHandlerDigest::Factory(); | 6183 new HttpAuthHandlerDigest::Factory(); |
| 6183 HttpAuthHandlerDigest::FixedNonceGenerator* nonce_generator = | 6184 HttpAuthHandlerDigest::FixedNonceGenerator* nonce_generator = |
| 6184 new HttpAuthHandlerDigest::FixedNonceGenerator("0123456789abcdef"); | 6185 new HttpAuthHandlerDigest::FixedNonceGenerator("0123456789abcdef"); |
| 6185 digest_factory->set_nonce_generator(nonce_generator); | 6186 digest_factory->set_nonce_generator(nonce_generator); |
| 6186 session_deps_.http_auth_handler_factory.reset(digest_factory); | 6187 session_deps_.http_auth_handler_factory.reset(digest_factory); |
| 6187 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6188 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6188 | 6189 |
| 6189 // Transaction 1: authenticate (foo, bar) on MyRealm1 | 6190 // Transaction 1: authenticate (foo, bar) on MyRealm1 |
| 6190 { | 6191 { |
| 6191 HttpRequestInfo request; | 6192 HttpRequestInfo request; |
| 6192 request.method = "GET"; | 6193 request.method = "GET"; |
| 6193 request.url = GURL("http://www.example.org/x/y/z"); | 6194 request.url = GURL("http://www.example.org/x/y/z"); |
| 6194 request.load_flags = 0; | 6195 request.load_flags = 0; |
| 6195 | 6196 |
| 6196 scoped_ptr<HttpTransaction> trans( | 6197 scoped_ptr<HttpTransaction> trans( |
| 6197 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6198 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6309 | 6310 |
| 6310 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6311 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6311 ASSERT_TRUE(response != NULL); | 6312 ASSERT_TRUE(response != NULL); |
| 6312 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 6313 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
| 6313 } | 6314 } |
| 6314 } | 6315 } |
| 6315 | 6316 |
| 6316 // Test the ResetStateForRestart() private method. | 6317 // Test the ResetStateForRestart() private method. |
| 6317 TEST_P(HttpNetworkTransactionTest, ResetStateForRestart) { | 6318 TEST_P(HttpNetworkTransactionTest, ResetStateForRestart) { |
| 6318 // Create a transaction (the dependencies aren't important). | 6319 // Create a transaction (the dependencies aren't important). |
| 6319 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6320 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6320 scoped_ptr<HttpNetworkTransaction> trans( | 6321 scoped_ptr<HttpNetworkTransaction> trans( |
| 6321 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6322 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6322 | 6323 |
| 6323 // Setup some state (which we expect ResetStateForRestart() will clear). | 6324 // Setup some state (which we expect ResetStateForRestart() will clear). |
| 6324 trans->read_buf_ = new IOBuffer(15); | 6325 trans->read_buf_ = new IOBuffer(15); |
| 6325 trans->read_buf_len_ = 15; | 6326 trans->read_buf_len_ = 15; |
| 6326 trans->request_headers_.SetHeader("Authorization", "NTLM"); | 6327 trans->request_headers_.SetHeader("Authorization", "NTLM"); |
| 6327 | 6328 |
| 6328 // Setup state in response_ | 6329 // Setup state in response_ |
| 6329 HttpResponseInfo* response = &trans->response_; | 6330 HttpResponseInfo* response = &trans->response_; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 6356 EXPECT_FALSE(response->vary_data.is_valid()); | 6357 EXPECT_FALSE(response->vary_data.is_valid()); |
| 6357 } | 6358 } |
| 6358 | 6359 |
| 6359 // Test HTTPS connections to a site with a bad certificate | 6360 // Test HTTPS connections to a site with a bad certificate |
| 6360 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificate) { | 6361 TEST_P(HttpNetworkTransactionTest, HTTPSBadCertificate) { |
| 6361 HttpRequestInfo request; | 6362 HttpRequestInfo request; |
| 6362 request.method = "GET"; | 6363 request.method = "GET"; |
| 6363 request.url = GURL("https://www.example.org/"); | 6364 request.url = GURL("https://www.example.org/"); |
| 6364 request.load_flags = 0; | 6365 request.load_flags = 0; |
| 6365 | 6366 |
| 6366 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6367 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6367 scoped_ptr<HttpTransaction> trans( | 6368 scoped_ptr<HttpTransaction> trans( |
| 6368 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6369 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6369 | 6370 |
| 6370 MockWrite data_writes[] = { | 6371 MockWrite data_writes[] = { |
| 6371 MockWrite( | 6372 MockWrite( |
| 6372 "GET / HTTP/1.1\r\n" | 6373 "GET / HTTP/1.1\r\n" |
| 6373 "Host: www.example.org\r\n" | 6374 "Host: www.example.org\r\n" |
| 6374 "Connection: keep-alive\r\n\r\n"), | 6375 "Connection: keep-alive\r\n\r\n"), |
| 6375 }; | 6376 }; |
| 6376 | 6377 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6464 session_deps_.socket_factory->AddSocketDataProvider(&ssl_bad_certificate); | 6465 session_deps_.socket_factory->AddSocketDataProvider(&ssl_bad_certificate); |
| 6465 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6466 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6466 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_bad); | 6467 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_bad); |
| 6467 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 6468 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 6468 | 6469 |
| 6469 TestCompletionCallback callback; | 6470 TestCompletionCallback callback; |
| 6470 | 6471 |
| 6471 for (int i = 0; i < 2; i++) { | 6472 for (int i = 0; i < 2; i++) { |
| 6472 session_deps_.socket_factory->ResetNextMockIndexes(); | 6473 session_deps_.socket_factory->ResetNextMockIndexes(); |
| 6473 | 6474 |
| 6474 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6475 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6475 scoped_ptr<HttpTransaction> trans( | 6476 scoped_ptr<HttpTransaction> trans( |
| 6476 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6477 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6477 | 6478 |
| 6478 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6479 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6479 EXPECT_EQ(ERR_IO_PENDING, rv); | 6480 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6480 | 6481 |
| 6481 rv = callback.WaitForResult(); | 6482 rv = callback.WaitForResult(); |
| 6482 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); | 6483 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); |
| 6483 | 6484 |
| 6484 rv = trans->RestartIgnoringLastError(callback.callback()); | 6485 rv = trans->RestartIgnoringLastError(callback.callback()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6530 data_writes, arraysize(data_writes)); | 6531 data_writes, arraysize(data_writes)); |
| 6531 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 6532 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 6532 SSLSocketDataProvider tunnel_ssl(ASYNC, OK); // SSL through the tunnel | 6533 SSLSocketDataProvider tunnel_ssl(ASYNC, OK); // SSL through the tunnel |
| 6533 | 6534 |
| 6534 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6535 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6535 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); | 6536 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); |
| 6536 session_deps_.socket_factory->AddSSLSocketDataProvider(&tunnel_ssl); | 6537 session_deps_.socket_factory->AddSSLSocketDataProvider(&tunnel_ssl); |
| 6537 | 6538 |
| 6538 TestCompletionCallback callback; | 6539 TestCompletionCallback callback; |
| 6539 | 6540 |
| 6540 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6541 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6541 scoped_ptr<HttpTransaction> trans( | 6542 scoped_ptr<HttpTransaction> trans( |
| 6542 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6543 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6543 | 6544 |
| 6544 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6545 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6545 EXPECT_EQ(ERR_IO_PENDING, rv); | 6546 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6546 | 6547 |
| 6547 rv = callback.WaitForResult(); | 6548 rv = callback.WaitForResult(); |
| 6548 EXPECT_EQ(OK, rv); | 6549 EXPECT_EQ(OK, rv); |
| 6549 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6550 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6550 | 6551 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6589 | 6590 |
| 6590 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 6591 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 6591 data_writes, arraysize(data_writes)); | 6592 data_writes, arraysize(data_writes)); |
| 6592 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 6593 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 6593 | 6594 |
| 6594 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6595 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6595 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); | 6596 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); |
| 6596 | 6597 |
| 6597 TestCompletionCallback callback; | 6598 TestCompletionCallback callback; |
| 6598 | 6599 |
| 6599 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6600 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6600 scoped_ptr<HttpTransaction> trans( | 6601 scoped_ptr<HttpTransaction> trans( |
| 6601 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6602 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6602 | 6603 |
| 6603 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6604 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6604 EXPECT_EQ(ERR_IO_PENDING, rv); | 6605 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6605 | 6606 |
| 6606 rv = callback.WaitForResult(); | 6607 rv = callback.WaitForResult(); |
| 6607 EXPECT_EQ(OK, rv); | 6608 EXPECT_EQ(OK, rv); |
| 6608 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6609 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6609 | 6610 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6671 SequencedSocketData data(data_reads, arraysize(data_reads), data_writes, | 6672 SequencedSocketData data(data_reads, arraysize(data_reads), data_writes, |
| 6672 arraysize(data_writes)); | 6673 arraysize(data_writes)); |
| 6673 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 6674 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 6674 proxy_ssl.SetNextProto(GetParam()); | 6675 proxy_ssl.SetNextProto(GetParam()); |
| 6675 | 6676 |
| 6676 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6677 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6677 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); | 6678 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); |
| 6678 | 6679 |
| 6679 TestCompletionCallback callback; | 6680 TestCompletionCallback callback; |
| 6680 | 6681 |
| 6681 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6682 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6682 scoped_ptr<HttpTransaction> trans( | 6683 scoped_ptr<HttpTransaction> trans( |
| 6683 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6684 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6684 | 6685 |
| 6685 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6686 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6686 EXPECT_EQ(ERR_IO_PENDING, rv); | 6687 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6687 | 6688 |
| 6688 rv = callback.WaitForResult(); | 6689 rv = callback.WaitForResult(); |
| 6689 EXPECT_EQ(OK, rv); | 6690 EXPECT_EQ(OK, rv); |
| 6690 const HttpResponseInfo* response = trans->GetResponseInfo(); | 6691 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 6691 | 6692 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6724 | 6725 |
| 6725 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 6726 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 6726 data_writes, arraysize(data_writes)); | 6727 data_writes, arraysize(data_writes)); |
| 6727 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 6728 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 6728 | 6729 |
| 6729 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6730 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6730 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); | 6731 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); |
| 6731 | 6732 |
| 6732 TestCompletionCallback callback; | 6733 TestCompletionCallback callback; |
| 6733 | 6734 |
| 6734 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6735 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6735 scoped_ptr<HttpTransaction> trans( | 6736 scoped_ptr<HttpTransaction> trans( |
| 6736 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6737 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6737 | 6738 |
| 6738 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6739 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6739 EXPECT_EQ(ERR_IO_PENDING, rv); | 6740 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6740 | 6741 |
| 6741 rv = callback.WaitForResult(); | 6742 rv = callback.WaitForResult(); |
| 6742 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 6743 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 6743 | 6744 |
| 6744 // TODO(ttuttle): Anything else to check here? | 6745 // TODO(ttuttle): Anything else to check here? |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6782 SequencedSocketData data(data_reads, arraysize(data_reads), data_writes, | 6783 SequencedSocketData data(data_reads, arraysize(data_reads), data_writes, |
| 6783 arraysize(data_writes)); | 6784 arraysize(data_writes)); |
| 6784 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy | 6785 SSLSocketDataProvider proxy_ssl(ASYNC, OK); // SSL to the proxy |
| 6785 proxy_ssl.SetNextProto(GetParam()); | 6786 proxy_ssl.SetNextProto(GetParam()); |
| 6786 | 6787 |
| 6787 session_deps_.socket_factory->AddSocketDataProvider(&data); | 6788 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 6788 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); | 6789 session_deps_.socket_factory->AddSSLSocketDataProvider(&proxy_ssl); |
| 6789 | 6790 |
| 6790 TestCompletionCallback callback; | 6791 TestCompletionCallback callback; |
| 6791 | 6792 |
| 6792 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6793 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6793 scoped_ptr<HttpTransaction> trans( | 6794 scoped_ptr<HttpTransaction> trans( |
| 6794 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 6795 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 6795 | 6796 |
| 6796 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 6797 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 6797 EXPECT_EQ(ERR_IO_PENDING, rv); | 6798 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 6798 | 6799 |
| 6799 rv = callback.WaitForResult(); | 6800 rv = callback.WaitForResult(); |
| 6800 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 6801 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 6801 | 6802 |
| 6802 // TODO(ttuttle): Anything else to check here? | 6803 // TODO(ttuttle): Anything else to check here? |
| 6803 } | 6804 } |
| 6804 | 6805 |
| 6805 // Test the request-challenge-retry sequence for basic auth, through | 6806 // Test the request-challenge-retry sequence for basic auth, through |
| 6806 // a SPDY proxy over a single SPDY session. | 6807 // a SPDY proxy over a single SPDY session. |
| 6807 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { | 6808 TEST_P(HttpNetworkTransactionTest, BasicAuthSpdyProxy) { |
| 6808 HttpRequestInfo request; | 6809 HttpRequestInfo request; |
| 6809 request.method = "GET"; | 6810 request.method = "GET"; |
| 6810 request.url = GURL("https://www.example.org/"); | 6811 request.url = GURL("https://www.example.org/"); |
| 6811 // when the no authentication data flag is set. | 6812 // when the no authentication data flag is set. |
| 6812 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; | 6813 request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA; |
| 6813 | 6814 |
| 6814 // Configure against https proxy server "myproxy:70". | 6815 // Configure against https proxy server "myproxy:70". |
| 6815 session_deps_.proxy_service.reset( | 6816 session_deps_.proxy_service.reset( |
| 6816 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); | 6817 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); |
| 6817 BoundTestNetLog log; | 6818 BoundTestNetLog log; |
| 6818 session_deps_.net_log = log.bound().net_log(); | 6819 session_deps_.net_log = log.bound().net_log(); |
| 6819 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6820 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6820 | 6821 |
| 6821 // Since we have proxy, should try to establish tunnel. | 6822 // Since we have proxy, should try to establish tunnel. |
| 6822 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect( | 6823 scoped_ptr<SpdyFrame> req(spdy_util_.ConstructSpdyConnect( |
| 6823 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); | 6824 NULL, 0, 1, LOWEST, HostPortPair("www.example.org", 443))); |
| 6824 scoped_ptr<SpdyFrame> rst( | 6825 scoped_ptr<SpdyFrame> rst( |
| 6825 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); | 6826 spdy_util_.ConstructSpdyRstStream(1, RST_STREAM_CANCEL)); |
| 6826 | 6827 |
| 6827 // After calling trans->RestartWithAuth(), this is the request we should | 6828 // After calling trans->RestartWithAuth(), this is the request we should |
| 6828 // be issuing -- the final header line contains the credentials. | 6829 // be issuing -- the final header line contains the credentials. |
| 6829 const char* const kAuthCredentials[] = { | 6830 const char* const kAuthCredentials[] = { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6954 | 6955 |
| 6955 // Configure against https proxy server "myproxy:70". | 6956 // Configure against https proxy server "myproxy:70". |
| 6956 session_deps_.proxy_service.reset( | 6957 session_deps_.proxy_service.reset( |
| 6957 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); | 6958 ProxyService::CreateFixedFromPacResult("HTTPS myproxy:70")); |
| 6958 BoundTestNetLog log; | 6959 BoundTestNetLog log; |
| 6959 session_deps_.net_log = log.bound().net_log(); | 6960 session_deps_.net_log = log.bound().net_log(); |
| 6960 | 6961 |
| 6961 // Enable cross-origin push. | 6962 // Enable cross-origin push. |
| 6962 session_deps_.trusted_spdy_proxy = "myproxy:70"; | 6963 session_deps_.trusted_spdy_proxy = "myproxy:70"; |
| 6963 | 6964 |
| 6964 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 6965 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 6965 | 6966 |
| 6966 scoped_ptr<SpdyFrame> stream1_syn( | 6967 scoped_ptr<SpdyFrame> stream1_syn( |
| 6967 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 6968 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 6968 | 6969 |
| 6969 MockWrite spdy_writes[] = { | 6970 MockWrite spdy_writes[] = { |
| 6970 CreateMockWrite(*stream1_syn, 0, ASYNC), | 6971 CreateMockWrite(*stream1_syn, 0, ASYNC), |
| 6971 }; | 6972 }; |
| 6972 | 6973 |
| 6973 scoped_ptr<SpdyFrame> | 6974 scoped_ptr<SpdyFrame> |
| 6974 stream1_reply(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); | 6975 stream1_reply(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7068 | 7069 |
| 7069 // Configure against https proxy server "myproxy:70". | 7070 // Configure against https proxy server "myproxy:70". |
| 7070 session_deps_.proxy_service.reset( | 7071 session_deps_.proxy_service.reset( |
| 7071 ProxyService::CreateFixed("https://myproxy:70")); | 7072 ProxyService::CreateFixed("https://myproxy:70")); |
| 7072 BoundTestNetLog log; | 7073 BoundTestNetLog log; |
| 7073 session_deps_.net_log = log.bound().net_log(); | 7074 session_deps_.net_log = log.bound().net_log(); |
| 7074 | 7075 |
| 7075 // Enable cross-origin push. | 7076 // Enable cross-origin push. |
| 7076 session_deps_.trusted_spdy_proxy = "myproxy:70"; | 7077 session_deps_.trusted_spdy_proxy = "myproxy:70"; |
| 7077 | 7078 |
| 7078 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7079 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7079 | 7080 |
| 7080 scoped_ptr<SpdyFrame> stream1_syn( | 7081 scoped_ptr<SpdyFrame> stream1_syn( |
| 7081 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); | 7082 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, false)); |
| 7082 | 7083 |
| 7083 scoped_ptr<SpdyFrame> push_rst( | 7084 scoped_ptr<SpdyFrame> push_rst( |
| 7084 spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); | 7085 spdy_util_.ConstructSpdyRstStream(2, RST_STREAM_REFUSED_STREAM)); |
| 7085 | 7086 |
| 7086 MockWrite spdy_writes[] = { | 7087 MockWrite spdy_writes[] = { |
| 7087 CreateMockWrite(*stream1_syn, 0, ASYNC), CreateMockWrite(*push_rst, 3), | 7088 CreateMockWrite(*stream1_syn, 0, ASYNC), CreateMockWrite(*push_rst, 3), |
| 7088 }; | 7089 }; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7197 session_deps_.socket_factory->AddSocketDataProvider(&ssl_bad_certificate); | 7198 session_deps_.socket_factory->AddSocketDataProvider(&ssl_bad_certificate); |
| 7198 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_bad); | 7199 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_bad); |
| 7199 | 7200 |
| 7200 // SSL to the proxy, then CONNECT request, then valid SSL certificate | 7201 // SSL to the proxy, then CONNECT request, then valid SSL certificate |
| 7201 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 7202 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 7202 session_deps_.socket_factory->AddSocketDataProvider(&data); | 7203 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 7203 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 7204 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 7204 | 7205 |
| 7205 TestCompletionCallback callback; | 7206 TestCompletionCallback callback; |
| 7206 | 7207 |
| 7207 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7208 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7208 scoped_ptr<HttpTransaction> trans( | 7209 scoped_ptr<HttpTransaction> trans( |
| 7209 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7210 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7210 | 7211 |
| 7211 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 7212 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 7212 EXPECT_EQ(ERR_IO_PENDING, rv); | 7213 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 7213 | 7214 |
| 7214 rv = callback.WaitForResult(); | 7215 rv = callback.WaitForResult(); |
| 7215 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); | 7216 EXPECT_EQ(ERR_CERT_AUTHORITY_INVALID, rv); |
| 7216 | 7217 |
| 7217 rv = trans->RestartIgnoringLastError(callback.callback()); | 7218 rv = trans->RestartIgnoringLastError(callback.callback()); |
| 7218 EXPECT_EQ(ERR_IO_PENDING, rv); | 7219 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 7219 | 7220 |
| 7220 rv = callback.WaitForResult(); | 7221 rv = callback.WaitForResult(); |
| 7221 EXPECT_EQ(OK, rv); | 7222 EXPECT_EQ(OK, rv); |
| 7222 | 7223 |
| 7223 const HttpResponseInfo* response = trans->GetResponseInfo(); | 7224 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 7224 | 7225 |
| 7225 ASSERT_TRUE(response != NULL); | 7226 ASSERT_TRUE(response != NULL); |
| 7226 EXPECT_EQ(100, response->headers->GetContentLength()); | 7227 EXPECT_EQ(100, response->headers->GetContentLength()); |
| 7227 } | 7228 } |
| 7228 | 7229 |
| 7229 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgent) { | 7230 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgent) { |
| 7230 HttpRequestInfo request; | 7231 HttpRequestInfo request; |
| 7231 request.method = "GET"; | 7232 request.method = "GET"; |
| 7232 request.url = GURL("http://www.example.org/"); | 7233 request.url = GURL("http://www.example.org/"); |
| 7233 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, | 7234 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, |
| 7234 "Chromium Ultra Awesome X Edition"); | 7235 "Chromium Ultra Awesome X Edition"); |
| 7235 | 7236 |
| 7236 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7237 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7237 scoped_ptr<HttpTransaction> trans( | 7238 scoped_ptr<HttpTransaction> trans( |
| 7238 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7239 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7239 | 7240 |
| 7240 MockWrite data_writes[] = { | 7241 MockWrite data_writes[] = { |
| 7241 MockWrite( | 7242 MockWrite( |
| 7242 "GET / HTTP/1.1\r\n" | 7243 "GET / HTTP/1.1\r\n" |
| 7243 "Host: www.example.org\r\n" | 7244 "Host: www.example.org\r\n" |
| 7244 "Connection: keep-alive\r\n" | 7245 "Connection: keep-alive\r\n" |
| 7245 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), | 7246 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), |
| 7246 }; | 7247 }; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 7267 } | 7268 } |
| 7268 | 7269 |
| 7269 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgentOverTunnel) { | 7270 TEST_P(HttpNetworkTransactionTest, BuildRequest_UserAgentOverTunnel) { |
| 7270 HttpRequestInfo request; | 7271 HttpRequestInfo request; |
| 7271 request.method = "GET"; | 7272 request.method = "GET"; |
| 7272 request.url = GURL("https://www.example.org/"); | 7273 request.url = GURL("https://www.example.org/"); |
| 7273 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, | 7274 request.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, |
| 7274 "Chromium Ultra Awesome X Edition"); | 7275 "Chromium Ultra Awesome X Edition"); |
| 7275 | 7276 |
| 7276 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 7277 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 7277 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7278 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7278 scoped_ptr<HttpTransaction> trans( | 7279 scoped_ptr<HttpTransaction> trans( |
| 7279 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7280 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7280 | 7281 |
| 7281 MockWrite data_writes[] = { | 7282 MockWrite data_writes[] = { |
| 7282 MockWrite( | 7283 MockWrite( |
| 7283 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 7284 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 7284 "Host: www.example.org\r\n" | 7285 "Host: www.example.org\r\n" |
| 7285 "Proxy-Connection: keep-alive\r\n" | 7286 "Proxy-Connection: keep-alive\r\n" |
| 7286 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), | 7287 "User-Agent: Chromium Ultra Awesome X Edition\r\n\r\n"), |
| 7287 }; | 7288 }; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 7307 } | 7308 } |
| 7308 | 7309 |
| 7309 TEST_P(HttpNetworkTransactionTest, BuildRequest_Referer) { | 7310 TEST_P(HttpNetworkTransactionTest, BuildRequest_Referer) { |
| 7310 HttpRequestInfo request; | 7311 HttpRequestInfo request; |
| 7311 request.method = "GET"; | 7312 request.method = "GET"; |
| 7312 request.url = GURL("http://www.example.org/"); | 7313 request.url = GURL("http://www.example.org/"); |
| 7313 request.load_flags = 0; | 7314 request.load_flags = 0; |
| 7314 request.extra_headers.SetHeader(HttpRequestHeaders::kReferer, | 7315 request.extra_headers.SetHeader(HttpRequestHeaders::kReferer, |
| 7315 "http://the.previous.site.com/"); | 7316 "http://the.previous.site.com/"); |
| 7316 | 7317 |
| 7317 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7318 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7318 scoped_ptr<HttpTransaction> trans( | 7319 scoped_ptr<HttpTransaction> trans( |
| 7319 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7320 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7320 | 7321 |
| 7321 MockWrite data_writes[] = { | 7322 MockWrite data_writes[] = { |
| 7322 MockWrite( | 7323 MockWrite( |
| 7323 "GET / HTTP/1.1\r\n" | 7324 "GET / HTTP/1.1\r\n" |
| 7324 "Host: www.example.org\r\n" | 7325 "Host: www.example.org\r\n" |
| 7325 "Connection: keep-alive\r\n" | 7326 "Connection: keep-alive\r\n" |
| 7326 "Referer: http://the.previous.site.com/\r\n\r\n"), | 7327 "Referer: http://the.previous.site.com/\r\n\r\n"), |
| 7327 }; | 7328 }; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 7345 | 7346 |
| 7346 rv = callback.WaitForResult(); | 7347 rv = callback.WaitForResult(); |
| 7347 EXPECT_EQ(OK, rv); | 7348 EXPECT_EQ(OK, rv); |
| 7348 } | 7349 } |
| 7349 | 7350 |
| 7350 TEST_P(HttpNetworkTransactionTest, BuildRequest_PostContentLengthZero) { | 7351 TEST_P(HttpNetworkTransactionTest, BuildRequest_PostContentLengthZero) { |
| 7351 HttpRequestInfo request; | 7352 HttpRequestInfo request; |
| 7352 request.method = "POST"; | 7353 request.method = "POST"; |
| 7353 request.url = GURL("http://www.example.org/"); | 7354 request.url = GURL("http://www.example.org/"); |
| 7354 | 7355 |
| 7355 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7356 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7356 scoped_ptr<HttpTransaction> trans( | 7357 scoped_ptr<HttpTransaction> trans( |
| 7357 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7358 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7358 | 7359 |
| 7359 MockWrite data_writes[] = { | 7360 MockWrite data_writes[] = { |
| 7360 MockWrite( | 7361 MockWrite( |
| 7361 "POST / HTTP/1.1\r\n" | 7362 "POST / HTTP/1.1\r\n" |
| 7362 "Host: www.example.org\r\n" | 7363 "Host: www.example.org\r\n" |
| 7363 "Connection: keep-alive\r\n" | 7364 "Connection: keep-alive\r\n" |
| 7364 "Content-Length: 0\r\n\r\n"), | 7365 "Content-Length: 0\r\n\r\n"), |
| 7365 }; | 7366 }; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 7383 | 7384 |
| 7384 rv = callback.WaitForResult(); | 7385 rv = callback.WaitForResult(); |
| 7385 EXPECT_EQ(OK, rv); | 7386 EXPECT_EQ(OK, rv); |
| 7386 } | 7387 } |
| 7387 | 7388 |
| 7388 TEST_P(HttpNetworkTransactionTest, BuildRequest_PutContentLengthZero) { | 7389 TEST_P(HttpNetworkTransactionTest, BuildRequest_PutContentLengthZero) { |
| 7389 HttpRequestInfo request; | 7390 HttpRequestInfo request; |
| 7390 request.method = "PUT"; | 7391 request.method = "PUT"; |
| 7391 request.url = GURL("http://www.example.org/"); | 7392 request.url = GURL("http://www.example.org/"); |
| 7392 | 7393 |
| 7393 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7394 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7394 scoped_ptr<HttpTransaction> trans( | 7395 scoped_ptr<HttpTransaction> trans( |
| 7395 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7396 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7396 | 7397 |
| 7397 MockWrite data_writes[] = { | 7398 MockWrite data_writes[] = { |
| 7398 MockWrite( | 7399 MockWrite( |
| 7399 "PUT / HTTP/1.1\r\n" | 7400 "PUT / HTTP/1.1\r\n" |
| 7400 "Host: www.example.org\r\n" | 7401 "Host: www.example.org\r\n" |
| 7401 "Connection: keep-alive\r\n" | 7402 "Connection: keep-alive\r\n" |
| 7402 "Content-Length: 0\r\n\r\n"), | 7403 "Content-Length: 0\r\n\r\n"), |
| 7403 }; | 7404 }; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 7421 | 7422 |
| 7422 rv = callback.WaitForResult(); | 7423 rv = callback.WaitForResult(); |
| 7423 EXPECT_EQ(OK, rv); | 7424 EXPECT_EQ(OK, rv); |
| 7424 } | 7425 } |
| 7425 | 7426 |
| 7426 TEST_P(HttpNetworkTransactionTest, BuildRequest_HeadContentLengthZero) { | 7427 TEST_P(HttpNetworkTransactionTest, BuildRequest_HeadContentLengthZero) { |
| 7427 HttpRequestInfo request; | 7428 HttpRequestInfo request; |
| 7428 request.method = "HEAD"; | 7429 request.method = "HEAD"; |
| 7429 request.url = GURL("http://www.example.org/"); | 7430 request.url = GURL("http://www.example.org/"); |
| 7430 | 7431 |
| 7431 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7432 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7432 scoped_ptr<HttpTransaction> trans( | 7433 scoped_ptr<HttpTransaction> trans( |
| 7433 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7434 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7434 | 7435 |
| 7435 MockWrite data_writes[] = { | 7436 MockWrite data_writes[] = { |
| 7436 MockWrite("HEAD / HTTP/1.1\r\n" | 7437 MockWrite("HEAD / HTTP/1.1\r\n" |
| 7437 "Host: www.example.org\r\n" | 7438 "Host: www.example.org\r\n" |
| 7438 "Connection: keep-alive\r\n\r\n"), | 7439 "Connection: keep-alive\r\n\r\n"), |
| 7439 }; | 7440 }; |
| 7440 | 7441 |
| 7441 // Lastly, the server responds with the actual content. | 7442 // Lastly, the server responds with the actual content. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 7458 rv = callback.WaitForResult(); | 7459 rv = callback.WaitForResult(); |
| 7459 EXPECT_EQ(OK, rv); | 7460 EXPECT_EQ(OK, rv); |
| 7460 } | 7461 } |
| 7461 | 7462 |
| 7462 TEST_P(HttpNetworkTransactionTest, BuildRequest_CacheControlNoCache) { | 7463 TEST_P(HttpNetworkTransactionTest, BuildRequest_CacheControlNoCache) { |
| 7463 HttpRequestInfo request; | 7464 HttpRequestInfo request; |
| 7464 request.method = "GET"; | 7465 request.method = "GET"; |
| 7465 request.url = GURL("http://www.example.org/"); | 7466 request.url = GURL("http://www.example.org/"); |
| 7466 request.load_flags = LOAD_BYPASS_CACHE; | 7467 request.load_flags = LOAD_BYPASS_CACHE; |
| 7467 | 7468 |
| 7468 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7469 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7469 scoped_ptr<HttpTransaction> trans( | 7470 scoped_ptr<HttpTransaction> trans( |
| 7470 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7471 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7471 | 7472 |
| 7472 MockWrite data_writes[] = { | 7473 MockWrite data_writes[] = { |
| 7473 MockWrite( | 7474 MockWrite( |
| 7474 "GET / HTTP/1.1\r\n" | 7475 "GET / HTTP/1.1\r\n" |
| 7475 "Host: www.example.org\r\n" | 7476 "Host: www.example.org\r\n" |
| 7476 "Connection: keep-alive\r\n" | 7477 "Connection: keep-alive\r\n" |
| 7477 "Pragma: no-cache\r\n" | 7478 "Pragma: no-cache\r\n" |
| 7478 "Cache-Control: no-cache\r\n\r\n"), | 7479 "Cache-Control: no-cache\r\n\r\n"), |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 7499 EXPECT_EQ(OK, rv); | 7500 EXPECT_EQ(OK, rv); |
| 7500 } | 7501 } |
| 7501 | 7502 |
| 7502 TEST_P(HttpNetworkTransactionTest, | 7503 TEST_P(HttpNetworkTransactionTest, |
| 7503 BuildRequest_CacheControlValidateCache) { | 7504 BuildRequest_CacheControlValidateCache) { |
| 7504 HttpRequestInfo request; | 7505 HttpRequestInfo request; |
| 7505 request.method = "GET"; | 7506 request.method = "GET"; |
| 7506 request.url = GURL("http://www.example.org/"); | 7507 request.url = GURL("http://www.example.org/"); |
| 7507 request.load_flags = LOAD_VALIDATE_CACHE; | 7508 request.load_flags = LOAD_VALIDATE_CACHE; |
| 7508 | 7509 |
| 7509 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7510 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7510 scoped_ptr<HttpTransaction> trans( | 7511 scoped_ptr<HttpTransaction> trans( |
| 7511 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7512 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7512 | 7513 |
| 7513 MockWrite data_writes[] = { | 7514 MockWrite data_writes[] = { |
| 7514 MockWrite( | 7515 MockWrite( |
| 7515 "GET / HTTP/1.1\r\n" | 7516 "GET / HTTP/1.1\r\n" |
| 7516 "Host: www.example.org\r\n" | 7517 "Host: www.example.org\r\n" |
| 7517 "Connection: keep-alive\r\n" | 7518 "Connection: keep-alive\r\n" |
| 7518 "Cache-Control: max-age=0\r\n\r\n"), | 7519 "Cache-Control: max-age=0\r\n\r\n"), |
| 7519 }; | 7520 }; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 7538 rv = callback.WaitForResult(); | 7539 rv = callback.WaitForResult(); |
| 7539 EXPECT_EQ(OK, rv); | 7540 EXPECT_EQ(OK, rv); |
| 7540 } | 7541 } |
| 7541 | 7542 |
| 7542 TEST_P(HttpNetworkTransactionTest, BuildRequest_ExtraHeaders) { | 7543 TEST_P(HttpNetworkTransactionTest, BuildRequest_ExtraHeaders) { |
| 7543 HttpRequestInfo request; | 7544 HttpRequestInfo request; |
| 7544 request.method = "GET"; | 7545 request.method = "GET"; |
| 7545 request.url = GURL("http://www.example.org/"); | 7546 request.url = GURL("http://www.example.org/"); |
| 7546 request.extra_headers.SetHeader("FooHeader", "Bar"); | 7547 request.extra_headers.SetHeader("FooHeader", "Bar"); |
| 7547 | 7548 |
| 7548 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7549 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7549 scoped_ptr<HttpTransaction> trans( | 7550 scoped_ptr<HttpTransaction> trans( |
| 7550 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7551 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7551 | 7552 |
| 7552 MockWrite data_writes[] = { | 7553 MockWrite data_writes[] = { |
| 7553 MockWrite( | 7554 MockWrite( |
| 7554 "GET / HTTP/1.1\r\n" | 7555 "GET / HTTP/1.1\r\n" |
| 7555 "Host: www.example.org\r\n" | 7556 "Host: www.example.org\r\n" |
| 7556 "Connection: keep-alive\r\n" | 7557 "Connection: keep-alive\r\n" |
| 7557 "FooHeader: Bar\r\n\r\n"), | 7558 "FooHeader: Bar\r\n\r\n"), |
| 7558 }; | 7559 }; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 7579 } | 7580 } |
| 7580 | 7581 |
| 7581 TEST_P(HttpNetworkTransactionTest, BuildRequest_ExtraHeadersStripped) { | 7582 TEST_P(HttpNetworkTransactionTest, BuildRequest_ExtraHeadersStripped) { |
| 7582 HttpRequestInfo request; | 7583 HttpRequestInfo request; |
| 7583 request.method = "GET"; | 7584 request.method = "GET"; |
| 7584 request.url = GURL("http://www.example.org/"); | 7585 request.url = GURL("http://www.example.org/"); |
| 7585 request.extra_headers.SetHeader("referer", "www.foo.com"); | 7586 request.extra_headers.SetHeader("referer", "www.foo.com"); |
| 7586 request.extra_headers.SetHeader("hEllo", "Kitty"); | 7587 request.extra_headers.SetHeader("hEllo", "Kitty"); |
| 7587 request.extra_headers.SetHeader("FoO", "bar"); | 7588 request.extra_headers.SetHeader("FoO", "bar"); |
| 7588 | 7589 |
| 7589 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7590 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7590 scoped_ptr<HttpTransaction> trans( | 7591 scoped_ptr<HttpTransaction> trans( |
| 7591 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7592 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7592 | 7593 |
| 7593 MockWrite data_writes[] = { | 7594 MockWrite data_writes[] = { |
| 7594 MockWrite( | 7595 MockWrite( |
| 7595 "GET / HTTP/1.1\r\n" | 7596 "GET / HTTP/1.1\r\n" |
| 7596 "Host: www.example.org\r\n" | 7597 "Host: www.example.org\r\n" |
| 7597 "Connection: keep-alive\r\n" | 7598 "Connection: keep-alive\r\n" |
| 7598 "referer: www.foo.com\r\n" | 7599 "referer: www.foo.com\r\n" |
| 7599 "hEllo: Kitty\r\n" | 7600 "hEllo: Kitty\r\n" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 7625 HttpRequestInfo request; | 7626 HttpRequestInfo request; |
| 7626 request.method = "GET"; | 7627 request.method = "GET"; |
| 7627 request.url = GURL("http://www.example.org/"); | 7628 request.url = GURL("http://www.example.org/"); |
| 7628 request.load_flags = 0; | 7629 request.load_flags = 0; |
| 7629 | 7630 |
| 7630 session_deps_.proxy_service.reset( | 7631 session_deps_.proxy_service.reset( |
| 7631 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); | 7632 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); |
| 7632 TestNetLog net_log; | 7633 TestNetLog net_log; |
| 7633 session_deps_.net_log = &net_log; | 7634 session_deps_.net_log = &net_log; |
| 7634 | 7635 |
| 7635 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7636 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7636 scoped_ptr<HttpTransaction> trans( | 7637 scoped_ptr<HttpTransaction> trans( |
| 7637 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7638 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7638 | 7639 |
| 7639 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; | 7640 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
| 7640 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7641 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7641 | 7642 |
| 7642 MockWrite data_writes[] = { | 7643 MockWrite data_writes[] = { |
| 7643 MockWrite(ASYNC, write_buffer, arraysize(write_buffer)), | 7644 MockWrite(ASYNC, write_buffer, arraysize(write_buffer)), |
| 7644 MockWrite( | 7645 MockWrite( |
| 7645 "GET / HTTP/1.1\r\n" | 7646 "GET / HTTP/1.1\r\n" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7684 HttpRequestInfo request; | 7685 HttpRequestInfo request; |
| 7685 request.method = "GET"; | 7686 request.method = "GET"; |
| 7686 request.url = GURL("https://www.example.org/"); | 7687 request.url = GURL("https://www.example.org/"); |
| 7687 request.load_flags = 0; | 7688 request.load_flags = 0; |
| 7688 | 7689 |
| 7689 session_deps_.proxy_service.reset( | 7690 session_deps_.proxy_service.reset( |
| 7690 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); | 7691 ProxyService::CreateFixedFromPacResult("SOCKS myproxy:1080")); |
| 7691 TestNetLog net_log; | 7692 TestNetLog net_log; |
| 7692 session_deps_.net_log = &net_log; | 7693 session_deps_.net_log = &net_log; |
| 7693 | 7694 |
| 7694 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7695 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7695 scoped_ptr<HttpTransaction> trans( | 7696 scoped_ptr<HttpTransaction> trans( |
| 7696 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7697 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7697 | 7698 |
| 7698 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; | 7699 unsigned char write_buffer[] = { 0x04, 0x01, 0x01, 0xBB, 127, 0, 0, 1, 0 }; |
| 7699 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7700 unsigned char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7700 | 7701 |
| 7701 MockWrite data_writes[] = { | 7702 MockWrite data_writes[] = { |
| 7702 MockWrite(ASYNC, reinterpret_cast<char*>(write_buffer), | 7703 MockWrite(ASYNC, reinterpret_cast<char*>(write_buffer), |
| 7703 arraysize(write_buffer)), | 7704 arraysize(write_buffer)), |
| 7704 MockWrite( | 7705 MockWrite( |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7748 HttpRequestInfo request; | 7749 HttpRequestInfo request; |
| 7749 request.method = "GET"; | 7750 request.method = "GET"; |
| 7750 request.url = GURL("http://www.example.org/"); | 7751 request.url = GURL("http://www.example.org/"); |
| 7751 request.load_flags = 0; | 7752 request.load_flags = 0; |
| 7752 | 7753 |
| 7753 session_deps_.proxy_service.reset( | 7754 session_deps_.proxy_service.reset( |
| 7754 ProxyService::CreateFixed("socks4://myproxy:1080")); | 7755 ProxyService::CreateFixed("socks4://myproxy:1080")); |
| 7755 TestNetLog net_log; | 7756 TestNetLog net_log; |
| 7756 session_deps_.net_log = &net_log; | 7757 session_deps_.net_log = &net_log; |
| 7757 | 7758 |
| 7758 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7759 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7759 scoped_ptr<HttpTransaction> trans( | 7760 scoped_ptr<HttpTransaction> trans( |
| 7760 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7761 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7761 | 7762 |
| 7762 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; | 7763 char write_buffer[] = { 0x04, 0x01, 0x00, 0x50, 127, 0, 0, 1, 0 }; |
| 7763 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; | 7764 char read_buffer[] = { 0x00, 0x5A, 0x00, 0x00, 0, 0, 0, 0 }; |
| 7764 | 7765 |
| 7765 MockWrite data_writes[] = { | 7766 MockWrite data_writes[] = { |
| 7766 MockWrite(ASYNC, write_buffer, arraysize(write_buffer)), | 7767 MockWrite(ASYNC, write_buffer, arraysize(write_buffer)), |
| 7767 MockWrite( | 7768 MockWrite( |
| 7768 "GET / HTTP/1.1\r\n" | 7769 "GET / HTTP/1.1\r\n" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7807 HttpRequestInfo request; | 7808 HttpRequestInfo request; |
| 7808 request.method = "GET"; | 7809 request.method = "GET"; |
| 7809 request.url = GURL("http://www.example.org/"); | 7810 request.url = GURL("http://www.example.org/"); |
| 7810 request.load_flags = 0; | 7811 request.load_flags = 0; |
| 7811 | 7812 |
| 7812 session_deps_.proxy_service.reset( | 7813 session_deps_.proxy_service.reset( |
| 7813 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); | 7814 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); |
| 7814 TestNetLog net_log; | 7815 TestNetLog net_log; |
| 7815 session_deps_.net_log = &net_log; | 7816 session_deps_.net_log = &net_log; |
| 7816 | 7817 |
| 7817 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7818 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7818 scoped_ptr<HttpTransaction> trans( | 7819 scoped_ptr<HttpTransaction> trans( |
| 7819 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7820 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7820 | 7821 |
| 7821 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; | 7822 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
| 7822 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; | 7823 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
| 7823 const char kSOCKS5OkRequest[] = { | 7824 const char kSOCKS5OkRequest[] = { |
| 7824 0x05, // Version | 7825 0x05, // Version |
| 7825 0x01, // Command (CONNECT) | 7826 0x01, // Command (CONNECT) |
| 7826 0x00, // Reserved. | 7827 0x00, // Reserved. |
| 7827 0x03, // Address type (DOMAINNAME). | 7828 0x03, // Address type (DOMAINNAME). |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7879 HttpRequestInfo request; | 7880 HttpRequestInfo request; |
| 7880 request.method = "GET"; | 7881 request.method = "GET"; |
| 7881 request.url = GURL("https://www.example.org/"); | 7882 request.url = GURL("https://www.example.org/"); |
| 7882 request.load_flags = 0; | 7883 request.load_flags = 0; |
| 7883 | 7884 |
| 7884 session_deps_.proxy_service.reset( | 7885 session_deps_.proxy_service.reset( |
| 7885 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); | 7886 ProxyService::CreateFixedFromPacResult("SOCKS5 myproxy:1080")); |
| 7886 TestNetLog net_log; | 7887 TestNetLog net_log; |
| 7887 session_deps_.net_log = &net_log; | 7888 session_deps_.net_log = &net_log; |
| 7888 | 7889 |
| 7889 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 7890 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 7890 scoped_ptr<HttpTransaction> trans( | 7891 scoped_ptr<HttpTransaction> trans( |
| 7891 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7892 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7892 | 7893 |
| 7893 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; | 7894 const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |
| 7894 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; | 7895 const char kSOCKS5GreetResponse[] = { 0x05, 0x00 }; |
| 7895 const unsigned char kSOCKS5OkRequest[] = { | 7896 const unsigned char kSOCKS5OkRequest[] = { |
| 7896 0x05, // Version | 7897 0x05, // Version |
| 7897 0x01, // Command (CONNECT) | 7898 0x01, // Command (CONNECT) |
| 7898 0x00, // Reserved. | 7899 0x00, // Reserved. |
| 7899 0x03, // Address type (DOMAINNAME). | 7900 0x03, // Address type (DOMAINNAME). |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7956 | 7957 |
| 7957 // Tests that for connection endpoints the group names are correctly set. | 7958 // Tests that for connection endpoints the group names are correctly set. |
| 7958 | 7959 |
| 7959 struct GroupNameTest { | 7960 struct GroupNameTest { |
| 7960 std::string proxy_server; | 7961 std::string proxy_server; |
| 7961 std::string url; | 7962 std::string url; |
| 7962 std::string expected_group_name; | 7963 std::string expected_group_name; |
| 7963 bool ssl; | 7964 bool ssl; |
| 7964 }; | 7965 }; |
| 7965 | 7966 |
| 7966 scoped_refptr<HttpNetworkSession> SetupSessionForGroupNameTests( | 7967 scoped_ptr<HttpNetworkSession> SetupSessionForGroupNameTests( |
| 7967 NextProto next_proto, | 7968 NextProto next_proto, |
| 7968 SpdySessionDependencies* session_deps_) { | 7969 SpdySessionDependencies* session_deps_) { |
| 7969 scoped_refptr<HttpNetworkSession> session(CreateSession(session_deps_)); | 7970 scoped_ptr<HttpNetworkSession> session(CreateSession(session_deps_)); |
| 7970 | 7971 |
| 7971 base::WeakPtr<HttpServerProperties> http_server_properties = | 7972 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 7972 session->http_server_properties(); | 7973 session->http_server_properties(); |
| 7973 AlternativeService alternative_service( | 7974 AlternativeService alternative_service( |
| 7974 AlternateProtocolFromNextProto(next_proto), "", 443); | 7975 AlternateProtocolFromNextProto(next_proto), "", 443); |
| 7975 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 7976 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 7976 http_server_properties->SetAlternativeService( | 7977 http_server_properties->SetAlternativeService( |
| 7977 HostPortPair("host.with.alternate", 80), alternative_service, 1.0, | 7978 HostPortPair("host.with.alternate", 80), alternative_service, 1.0, |
| 7978 expiration); | 7979 expiration); |
| 7979 | 7980 |
| 7980 return session; | 7981 return session; |
| 7981 } | 7982 } |
| 7982 | 7983 |
| 7983 int GroupNameTransactionHelper( | 7984 int GroupNameTransactionHelper(const std::string& url, |
| 7984 const std::string& url, | 7985 const scoped_ptr<HttpNetworkSession>& session) { |
|
pauljensen
2015/09/02 14:32:29
This should be a raw pointer. Passing scoped_ptr'
mmenke
2015/09/02 16:29:34
Yikes! That was a careless mistake when doing mas
| |
| 7985 const scoped_refptr<HttpNetworkSession>& session) { | |
| 7986 HttpRequestInfo request; | 7986 HttpRequestInfo request; |
| 7987 request.method = "GET"; | 7987 request.method = "GET"; |
| 7988 request.url = GURL(url); | 7988 request.url = GURL(url); |
| 7989 request.load_flags = 0; | 7989 request.load_flags = 0; |
| 7990 | 7990 |
| 7991 scoped_ptr<HttpTransaction> trans( | 7991 scoped_ptr<HttpTransaction> trans( |
| 7992 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 7992 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 7993 | 7993 |
| 7994 TestCompletionCallback callback; | 7994 TestCompletionCallback callback; |
| 7995 | 7995 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8033 "ssl/host.with.alternate:443", | 8033 "ssl/host.with.alternate:443", |
| 8034 true, | 8034 true, |
| 8035 }, | 8035 }, |
| 8036 }; | 8036 }; |
| 8037 | 8037 |
| 8038 session_deps_.use_alternative_services = true; | 8038 session_deps_.use_alternative_services = true; |
| 8039 | 8039 |
| 8040 for (size_t i = 0; i < arraysize(tests); ++i) { | 8040 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 8041 session_deps_.proxy_service.reset( | 8041 session_deps_.proxy_service.reset( |
| 8042 ProxyService::CreateFixed(tests[i].proxy_server)); | 8042 ProxyService::CreateFixed(tests[i].proxy_server)); |
| 8043 scoped_refptr<HttpNetworkSession> session( | 8043 scoped_ptr<HttpNetworkSession> session( |
| 8044 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 8044 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 8045 | 8045 |
| 8046 HttpNetworkSessionPeer peer(session); | 8046 HttpNetworkSessionPeer peer(session.get()); |
| 8047 CaptureGroupNameTransportSocketPool* transport_conn_pool = | 8047 CaptureGroupNameTransportSocketPool* transport_conn_pool = |
| 8048 new CaptureGroupNameTransportSocketPool(NULL, NULL); | 8048 new CaptureGroupNameTransportSocketPool(NULL, NULL); |
| 8049 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 8049 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 8050 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 8050 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| 8051 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( | 8051 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( |
| 8052 new MockClientSocketPoolManager); | 8052 new MockClientSocketPoolManager); |
| 8053 mock_pool_manager->SetTransportSocketPool(transport_conn_pool); | 8053 mock_pool_manager->SetTransportSocketPool(transport_conn_pool); |
| 8054 mock_pool_manager->SetSSLSocketPool(ssl_conn_pool); | 8054 mock_pool_manager->SetSSLSocketPool(ssl_conn_pool); |
| 8055 peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); | 8055 peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); |
| 8056 | 8056 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8095 "ftp/ftp.google.com:21", | 8095 "ftp/ftp.google.com:21", |
| 8096 false, | 8096 false, |
| 8097 }, | 8097 }, |
| 8098 }; | 8098 }; |
| 8099 | 8099 |
| 8100 session_deps_.use_alternative_services = true; | 8100 session_deps_.use_alternative_services = true; |
| 8101 | 8101 |
| 8102 for (size_t i = 0; i < arraysize(tests); ++i) { | 8102 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 8103 session_deps_.proxy_service.reset( | 8103 session_deps_.proxy_service.reset( |
| 8104 ProxyService::CreateFixed(tests[i].proxy_server)); | 8104 ProxyService::CreateFixed(tests[i].proxy_server)); |
| 8105 scoped_refptr<HttpNetworkSession> session( | 8105 scoped_ptr<HttpNetworkSession> session( |
| 8106 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 8106 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 8107 | 8107 |
| 8108 HttpNetworkSessionPeer peer(session); | 8108 HttpNetworkSessionPeer peer(session.get()); |
| 8109 | 8109 |
| 8110 HostPortPair proxy_host("http_proxy", 80); | 8110 HostPortPair proxy_host("http_proxy", 80); |
| 8111 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = | 8111 CaptureGroupNameHttpProxySocketPool* http_proxy_pool = |
| 8112 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); | 8112 new CaptureGroupNameHttpProxySocketPool(NULL, NULL); |
| 8113 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 8113 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 8114 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 8114 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| 8115 | 8115 |
| 8116 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( | 8116 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( |
| 8117 new MockClientSocketPoolManager); | 8117 new MockClientSocketPoolManager); |
| 8118 mock_pool_manager->SetSocketPoolForHTTPProxy(proxy_host, http_proxy_pool); | 8118 mock_pool_manager->SetSocketPoolForHTTPProxy(proxy_host, http_proxy_pool); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8165 "socks4/ssl/host.with.alternate:443", | 8165 "socks4/ssl/host.with.alternate:443", |
| 8166 true, | 8166 true, |
| 8167 }, | 8167 }, |
| 8168 }; | 8168 }; |
| 8169 | 8169 |
| 8170 session_deps_.use_alternative_services = true; | 8170 session_deps_.use_alternative_services = true; |
| 8171 | 8171 |
| 8172 for (size_t i = 0; i < arraysize(tests); ++i) { | 8172 for (size_t i = 0; i < arraysize(tests); ++i) { |
| 8173 session_deps_.proxy_service.reset( | 8173 session_deps_.proxy_service.reset( |
| 8174 ProxyService::CreateFixed(tests[i].proxy_server)); | 8174 ProxyService::CreateFixed(tests[i].proxy_server)); |
| 8175 scoped_refptr<HttpNetworkSession> session( | 8175 scoped_ptr<HttpNetworkSession> session( |
| 8176 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); | 8176 SetupSessionForGroupNameTests(GetParam(), &session_deps_)); |
| 8177 | 8177 |
| 8178 HttpNetworkSessionPeer peer(session); | 8178 HttpNetworkSessionPeer peer(session.get()); |
| 8179 | 8179 |
| 8180 HostPortPair proxy_host("socks_proxy", 1080); | 8180 HostPortPair proxy_host("socks_proxy", 1080); |
| 8181 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = | 8181 CaptureGroupNameSOCKSSocketPool* socks_conn_pool = |
| 8182 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); | 8182 new CaptureGroupNameSOCKSSocketPool(NULL, NULL); |
| 8183 CaptureGroupNameSSLSocketPool* ssl_conn_pool = | 8183 CaptureGroupNameSSLSocketPool* ssl_conn_pool = |
| 8184 new CaptureGroupNameSSLSocketPool(NULL, NULL); | 8184 new CaptureGroupNameSSLSocketPool(NULL, NULL); |
| 8185 | 8185 |
| 8186 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( | 8186 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( |
| 8187 new MockClientSocketPoolManager); | 8187 new MockClientSocketPoolManager); |
| 8188 mock_pool_manager->SetSocketPoolForSOCKSProxy(proxy_host, socks_conn_pool); | 8188 mock_pool_manager->SetSocketPoolForSOCKSProxy(proxy_host, socks_conn_pool); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 8208 request.method = "GET"; | 8208 request.method = "GET"; |
| 8209 request.url = GURL("http://www.example.org/"); | 8209 request.url = GURL("http://www.example.org/"); |
| 8210 | 8210 |
| 8211 session_deps_.proxy_service.reset( | 8211 session_deps_.proxy_service.reset( |
| 8212 ProxyService::CreateFixed("myproxy:70;foobar:80")); | 8212 ProxyService::CreateFixed("myproxy:70;foobar:80")); |
| 8213 | 8213 |
| 8214 // This simulates failure resolving all hostnames; that means we will fail | 8214 // This simulates failure resolving all hostnames; that means we will fail |
| 8215 // connecting to both proxies (myproxy:70 and foobar:80). | 8215 // connecting to both proxies (myproxy:70 and foobar:80). |
| 8216 session_deps_.host_resolver->rules()->AddSimulatedFailure("*"); | 8216 session_deps_.host_resolver->rules()->AddSimulatedFailure("*"); |
| 8217 | 8217 |
| 8218 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8218 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8219 scoped_ptr<HttpTransaction> trans( | 8219 scoped_ptr<HttpTransaction> trans( |
| 8220 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8220 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8221 | 8221 |
| 8222 TestCompletionCallback callback; | 8222 TestCompletionCallback callback; |
| 8223 | 8223 |
| 8224 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8224 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8225 EXPECT_EQ(ERR_IO_PENDING, rv); | 8225 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8226 | 8226 |
| 8227 rv = callback.WaitForResult(); | 8227 rv = callback.WaitForResult(); |
| 8228 EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, rv); | 8228 EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, rv); |
| 8229 } | 8229 } |
| 8230 | 8230 |
| 8231 // Base test to make sure that when the load flags for a request specify to | 8231 // Base test to make sure that when the load flags for a request specify to |
| 8232 // bypass the cache, the DNS cache is not used. | 8232 // bypass the cache, the DNS cache is not used. |
| 8233 void HttpNetworkTransactionTest::BypassHostCacheOnRefreshHelper( | 8233 void HttpNetworkTransactionTest::BypassHostCacheOnRefreshHelper( |
| 8234 int load_flags) { | 8234 int load_flags) { |
| 8235 // Issue a request, asking to bypass the cache(s). | 8235 // Issue a request, asking to bypass the cache(s). |
| 8236 HttpRequestInfo request; | 8236 HttpRequestInfo request; |
| 8237 request.method = "GET"; | 8237 request.method = "GET"; |
| 8238 request.load_flags = load_flags; | 8238 request.load_flags = load_flags; |
| 8239 request.url = GURL("http://www.example.org/"); | 8239 request.url = GURL("http://www.example.org/"); |
| 8240 | 8240 |
| 8241 // Select a host resolver that does caching. | 8241 // Select a host resolver that does caching. |
| 8242 session_deps_.host_resolver.reset(new MockCachingHostResolver); | 8242 session_deps_.host_resolver.reset(new MockCachingHostResolver); |
| 8243 | 8243 |
| 8244 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8244 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8245 scoped_ptr<HttpTransaction> trans( | 8245 scoped_ptr<HttpTransaction> trans( |
| 8246 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8246 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8247 | 8247 |
| 8248 // Warm up the host cache so it has an entry for "www.example.org". | 8248 // Warm up the host cache so it has an entry for "www.example.org". |
| 8249 AddressList addrlist; | 8249 AddressList addrlist; |
| 8250 TestCompletionCallback callback; | 8250 TestCompletionCallback callback; |
| 8251 int rv = session_deps_.host_resolver->Resolve( | 8251 int rv = session_deps_.host_resolver->Resolve( |
| 8252 HostResolver::RequestInfo(HostPortPair("www.example.org", 80)), | 8252 HostResolver::RequestInfo(HostPortPair("www.example.org", 80)), |
| 8253 DEFAULT_PRIORITY, &addrlist, callback.callback(), NULL, BoundNetLog()); | 8253 DEFAULT_PRIORITY, &addrlist, callback.callback(), NULL, BoundNetLog()); |
| 8254 EXPECT_EQ(ERR_IO_PENDING, rv); | 8254 EXPECT_EQ(ERR_IO_PENDING, rv); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8303 request.method = "GET"; | 8303 request.method = "GET"; |
| 8304 request.url = GURL("http://www.foo.com/"); | 8304 request.url = GURL("http://www.foo.com/"); |
| 8305 request.load_flags = 0; | 8305 request.load_flags = 0; |
| 8306 | 8306 |
| 8307 MockWrite write_failure[] = { | 8307 MockWrite write_failure[] = { |
| 8308 MockWrite(ASYNC, ERR_CONNECTION_RESET), | 8308 MockWrite(ASYNC, ERR_CONNECTION_RESET), |
| 8309 }; | 8309 }; |
| 8310 StaticSocketDataProvider data(NULL, 0, | 8310 StaticSocketDataProvider data(NULL, 0, |
| 8311 write_failure, arraysize(write_failure)); | 8311 write_failure, arraysize(write_failure)); |
| 8312 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8312 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8313 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8313 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8314 | 8314 |
| 8315 TestCompletionCallback callback; | 8315 TestCompletionCallback callback; |
| 8316 | 8316 |
| 8317 scoped_ptr<HttpTransaction> trans( | 8317 scoped_ptr<HttpTransaction> trans( |
| 8318 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8318 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8319 | 8319 |
| 8320 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8320 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8321 EXPECT_EQ(ERR_IO_PENDING, rv); | 8321 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8322 | 8322 |
| 8323 rv = callback.WaitForResult(); | 8323 rv = callback.WaitForResult(); |
| 8324 EXPECT_EQ(ERR_CONNECTION_RESET, rv); | 8324 EXPECT_EQ(ERR_CONNECTION_RESET, rv); |
| 8325 } | 8325 } |
| 8326 | 8326 |
| 8327 // Check that a connection closed after the start of the headers finishes ok. | 8327 // Check that a connection closed after the start of the headers finishes ok. |
| 8328 TEST_P(HttpNetworkTransactionTest, ConnectionClosedAfterStartOfHeaders) { | 8328 TEST_P(HttpNetworkTransactionTest, ConnectionClosedAfterStartOfHeaders) { |
| 8329 HttpRequestInfo request; | 8329 HttpRequestInfo request; |
| 8330 request.method = "GET"; | 8330 request.method = "GET"; |
| 8331 request.url = GURL("http://www.foo.com/"); | 8331 request.url = GURL("http://www.foo.com/"); |
| 8332 request.load_flags = 0; | 8332 request.load_flags = 0; |
| 8333 | 8333 |
| 8334 MockRead data_reads[] = { | 8334 MockRead data_reads[] = { |
| 8335 MockRead("HTTP/1."), | 8335 MockRead("HTTP/1."), |
| 8336 MockRead(SYNCHRONOUS, OK), | 8336 MockRead(SYNCHRONOUS, OK), |
| 8337 }; | 8337 }; |
| 8338 | 8338 |
| 8339 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 8339 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 8340 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8340 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8341 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8341 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8342 | 8342 |
| 8343 TestCompletionCallback callback; | 8343 TestCompletionCallback callback; |
| 8344 | 8344 |
| 8345 scoped_ptr<HttpTransaction> trans( | 8345 scoped_ptr<HttpTransaction> trans( |
| 8346 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8346 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8347 | 8347 |
| 8348 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8348 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8349 EXPECT_EQ(ERR_IO_PENDING, rv); | 8349 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8350 | 8350 |
| 8351 rv = callback.WaitForResult(); | 8351 rv = callback.WaitForResult(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8405 MockRead data_reads2[] = { | 8405 MockRead data_reads2[] = { |
| 8406 MockRead("HTTP/1.1 200 OK\r\n"), | 8406 MockRead("HTTP/1.1 200 OK\r\n"), |
| 8407 MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"), | 8407 MockRead("Content-Type: text/html; charset=iso-8859-1\r\n"), |
| 8408 MockRead("Content-Length: 100\r\n\r\n"), | 8408 MockRead("Content-Length: 100\r\n\r\n"), |
| 8409 MockRead(SYNCHRONOUS, OK), | 8409 MockRead(SYNCHRONOUS, OK), |
| 8410 }; | 8410 }; |
| 8411 | 8411 |
| 8412 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), | 8412 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), |
| 8413 data_writes2, arraysize(data_writes2)); | 8413 data_writes2, arraysize(data_writes2)); |
| 8414 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 8414 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
| 8415 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8415 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8416 | 8416 |
| 8417 TestCompletionCallback callback1; | 8417 TestCompletionCallback callback1; |
| 8418 | 8418 |
| 8419 scoped_ptr<HttpTransaction> trans( | 8419 scoped_ptr<HttpTransaction> trans( |
| 8420 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8420 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8421 | 8421 |
| 8422 int rv = trans->Start(&request, callback1.callback(), BoundNetLog()); | 8422 int rv = trans->Start(&request, callback1.callback(), BoundNetLog()); |
| 8423 EXPECT_EQ(ERR_IO_PENDING, rv); | 8423 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8424 | 8424 |
| 8425 rv = callback1.WaitForResult(); | 8425 rv = callback1.WaitForResult(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8461 StaticSocketDataProvider data(proxy_reads, arraysize(proxy_reads), NULL, 0); | 8461 StaticSocketDataProvider data(proxy_reads, arraysize(proxy_reads), NULL, 0); |
| 8462 SSLSocketDataProvider ssl(ASYNC, OK); | 8462 SSLSocketDataProvider ssl(ASYNC, OK); |
| 8463 | 8463 |
| 8464 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8464 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8465 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 8465 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 8466 | 8466 |
| 8467 TestCompletionCallback callback; | 8467 TestCompletionCallback callback; |
| 8468 | 8468 |
| 8469 session_deps_.socket_factory->ResetNextMockIndexes(); | 8469 session_deps_.socket_factory->ResetNextMockIndexes(); |
| 8470 | 8470 |
| 8471 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8471 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8472 scoped_ptr<HttpTransaction> trans( | 8472 scoped_ptr<HttpTransaction> trans( |
| 8473 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8473 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8474 | 8474 |
| 8475 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8475 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8476 EXPECT_EQ(ERR_IO_PENDING, rv); | 8476 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8477 | 8477 |
| 8478 rv = callback.WaitForResult(); | 8478 rv = callback.WaitForResult(); |
| 8479 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | 8479 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 8480 } | 8480 } |
| 8481 | 8481 |
| 8482 TEST_P(HttpNetworkTransactionTest, LargeContentLengthThenClose) { | 8482 TEST_P(HttpNetworkTransactionTest, LargeContentLengthThenClose) { |
| 8483 HttpRequestInfo request; | 8483 HttpRequestInfo request; |
| 8484 request.method = "GET"; | 8484 request.method = "GET"; |
| 8485 request.url = GURL("http://www.example.org/"); | 8485 request.url = GURL("http://www.example.org/"); |
| 8486 request.load_flags = 0; | 8486 request.load_flags = 0; |
| 8487 | 8487 |
| 8488 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8488 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8489 scoped_ptr<HttpTransaction> trans( | 8489 scoped_ptr<HttpTransaction> trans( |
| 8490 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8490 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8491 | 8491 |
| 8492 MockRead data_reads[] = { | 8492 MockRead data_reads[] = { |
| 8493 MockRead("HTTP/1.0 200 OK\r\nContent-Length:6719476739\r\n\r\n"), | 8493 MockRead("HTTP/1.0 200 OK\r\nContent-Length:6719476739\r\n\r\n"), |
| 8494 MockRead(SYNCHRONOUS, OK), | 8494 MockRead(SYNCHRONOUS, OK), |
| 8495 }; | 8495 }; |
| 8496 | 8496 |
| 8497 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 8497 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 8498 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8498 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 8527 new UploadFileElementReader(base::ThreadTaskRunnerHandle::Get().get(), | 8527 new UploadFileElementReader(base::ThreadTaskRunnerHandle::Get().get(), |
| 8528 temp_file_path, 0, kuint64max, base::Time())); | 8528 temp_file_path, 0, kuint64max, base::Time())); |
| 8529 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 8529 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 8530 | 8530 |
| 8531 HttpRequestInfo request; | 8531 HttpRequestInfo request; |
| 8532 request.method = "POST"; | 8532 request.method = "POST"; |
| 8533 request.url = GURL("http://www.example.org/upload"); | 8533 request.url = GURL("http://www.example.org/upload"); |
| 8534 request.upload_data_stream = &upload_data_stream; | 8534 request.upload_data_stream = &upload_data_stream; |
| 8535 request.load_flags = 0; | 8535 request.load_flags = 0; |
| 8536 | 8536 |
| 8537 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8537 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8538 scoped_ptr<HttpTransaction> trans( | 8538 scoped_ptr<HttpTransaction> trans( |
| 8539 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8539 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8540 | 8540 |
| 8541 MockRead data_reads[] = { | 8541 MockRead data_reads[] = { |
| 8542 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 8542 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
| 8543 MockRead("hello world"), | 8543 MockRead("hello world"), |
| 8544 MockRead(SYNCHRONOUS, OK), | 8544 MockRead(SYNCHRONOUS, OK), |
| 8545 }; | 8545 }; |
| 8546 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 8546 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 8547 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8547 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8582 temp_file, 0, kuint64max, base::Time())); | 8582 temp_file, 0, kuint64max, base::Time())); |
| 8583 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 8583 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 8584 | 8584 |
| 8585 HttpRequestInfo request; | 8585 HttpRequestInfo request; |
| 8586 request.method = "POST"; | 8586 request.method = "POST"; |
| 8587 request.url = GURL("http://www.example.org/upload"); | 8587 request.url = GURL("http://www.example.org/upload"); |
| 8588 request.upload_data_stream = &upload_data_stream; | 8588 request.upload_data_stream = &upload_data_stream; |
| 8589 request.load_flags = 0; | 8589 request.load_flags = 0; |
| 8590 | 8590 |
| 8591 // If we try to upload an unreadable file, the transaction should fail. | 8591 // If we try to upload an unreadable file, the transaction should fail. |
| 8592 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8592 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8593 scoped_ptr<HttpTransaction> trans( | 8593 scoped_ptr<HttpTransaction> trans( |
| 8594 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8594 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8595 | 8595 |
| 8596 StaticSocketDataProvider data(NULL, 0, NULL, 0); | 8596 StaticSocketDataProvider data(NULL, 0, NULL, 0); |
| 8597 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8597 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8598 | 8598 |
| 8599 TestCompletionCallback callback; | 8599 TestCompletionCallback callback; |
| 8600 | 8600 |
| 8601 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8601 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8602 EXPECT_EQ(ERR_IO_PENDING, rv); | 8602 EXPECT_EQ(ERR_IO_PENDING, rv); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8636 ScopedVector<UploadElementReader> element_readers; | 8636 ScopedVector<UploadElementReader> element_readers; |
| 8637 element_readers.push_back(fake_reader); | 8637 element_readers.push_back(fake_reader); |
| 8638 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 8638 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 8639 | 8639 |
| 8640 HttpRequestInfo request; | 8640 HttpRequestInfo request; |
| 8641 request.method = "POST"; | 8641 request.method = "POST"; |
| 8642 request.url = GURL("http://www.example.org/upload"); | 8642 request.url = GURL("http://www.example.org/upload"); |
| 8643 request.upload_data_stream = &upload_data_stream; | 8643 request.upload_data_stream = &upload_data_stream; |
| 8644 request.load_flags = 0; | 8644 request.load_flags = 0; |
| 8645 | 8645 |
| 8646 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8646 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8647 scoped_ptr<HttpTransaction> trans( | 8647 scoped_ptr<HttpTransaction> trans( |
| 8648 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8648 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8649 | 8649 |
| 8650 StaticSocketDataProvider data; | 8650 StaticSocketDataProvider data; |
| 8651 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8651 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8652 | 8652 |
| 8653 TestCompletionCallback callback; | 8653 TestCompletionCallback callback; |
| 8654 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8654 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8655 EXPECT_EQ(ERR_IO_PENDING, rv); | 8655 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8656 base::MessageLoop::current()->RunUntilIdle(); | 8656 base::MessageLoop::current()->RunUntilIdle(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8743 data_writes3, arraysize(data_writes3)); | 8743 data_writes3, arraysize(data_writes3)); |
| 8744 StaticSocketDataProvider data4(data_reads4, arraysize(data_reads4), | 8744 StaticSocketDataProvider data4(data_reads4, arraysize(data_reads4), |
| 8745 data_writes4, arraysize(data_writes4)); | 8745 data_writes4, arraysize(data_writes4)); |
| 8746 session_deps_.socket_factory->AddSocketDataProvider(&data1); | 8746 session_deps_.socket_factory->AddSocketDataProvider(&data1); |
| 8747 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 8747 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
| 8748 session_deps_.socket_factory->AddSocketDataProvider(&data3); | 8748 session_deps_.socket_factory->AddSocketDataProvider(&data3); |
| 8749 session_deps_.socket_factory->AddSocketDataProvider(&data4); | 8749 session_deps_.socket_factory->AddSocketDataProvider(&data4); |
| 8750 | 8750 |
| 8751 TestCompletionCallback callback1; | 8751 TestCompletionCallback callback1; |
| 8752 | 8752 |
| 8753 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8753 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8754 scoped_ptr<HttpTransaction> trans( | 8754 scoped_ptr<HttpTransaction> trans( |
| 8755 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8755 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8756 | 8756 |
| 8757 // Issue the first request with Authorize headers. There should be a | 8757 // Issue the first request with Authorize headers. There should be a |
| 8758 // password prompt for first_realm waiting to be filled in after the | 8758 // password prompt for first_realm waiting to be filled in after the |
| 8759 // transaction completes. | 8759 // transaction completes. |
| 8760 int rv = trans->Start(&request, callback1.callback(), BoundNetLog()); | 8760 int rv = trans->Start(&request, callback1.callback(), BoundNetLog()); |
| 8761 EXPECT_EQ(ERR_IO_PENDING, rv); | 8761 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8762 rv = callback1.WaitForResult(); | 8762 rv = callback1.WaitForResult(); |
| 8763 EXPECT_EQ(OK, rv); | 8763 EXPECT_EQ(OK, rv); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8838 request.method = "GET"; | 8838 request.method = "GET"; |
| 8839 request.url = GURL("http://www.example.org/"); | 8839 request.url = GURL("http://www.example.org/"); |
| 8840 request.load_flags = 0; | 8840 request.load_flags = 0; |
| 8841 | 8841 |
| 8842 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 8842 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 8843 | 8843 |
| 8844 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8844 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8845 | 8845 |
| 8846 TestCompletionCallback callback; | 8846 TestCompletionCallback callback; |
| 8847 | 8847 |
| 8848 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8848 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8849 scoped_ptr<HttpTransaction> trans( | 8849 scoped_ptr<HttpTransaction> trans( |
| 8850 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8850 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8851 | 8851 |
| 8852 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8852 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8853 EXPECT_EQ(ERR_IO_PENDING, rv); | 8853 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8854 | 8854 |
| 8855 HostPortPair http_host_port_pair("www.example.org", 80); | 8855 HostPortPair http_host_port_pair("www.example.org", 80); |
| 8856 HttpServerProperties& http_server_properties = | 8856 HttpServerProperties& http_server_properties = |
| 8857 *session->http_server_properties(); | 8857 *session->http_server_properties(); |
| 8858 AlternativeServiceVector alternative_service_vector = | 8858 AlternativeServiceVector alternative_service_vector = |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8902 request.method = "GET"; | 8902 request.method = "GET"; |
| 8903 request.url = GURL("http://www.example.org/"); | 8903 request.url = GURL("http://www.example.org/"); |
| 8904 request.load_flags = 0; | 8904 request.load_flags = 0; |
| 8905 | 8905 |
| 8906 StaticSocketDataProvider data(data_reads, arraysize(data_reads), nullptr, 0); | 8906 StaticSocketDataProvider data(data_reads, arraysize(data_reads), nullptr, 0); |
| 8907 | 8907 |
| 8908 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8908 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8909 | 8909 |
| 8910 TestCompletionCallback callback; | 8910 TestCompletionCallback callback; |
| 8911 | 8911 |
| 8912 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8912 scoped_ptr<HttpNetworkSession> session = CreateSession(&session_deps_); |
| 8913 scoped_ptr<HttpTransaction> trans( | 8913 scoped_ptr<HttpTransaction> trans( |
| 8914 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8914 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8915 | 8915 |
| 8916 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8916 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8917 EXPECT_EQ(ERR_IO_PENDING, rv); | 8917 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8918 | 8918 |
| 8919 HostPortPair http_host_port_pair("www.example.org", 80); | 8919 HostPortPair http_host_port_pair("www.example.org", 80); |
| 8920 HttpServerProperties& http_server_properties = | 8920 HttpServerProperties& http_server_properties = |
| 8921 *session->http_server_properties(); | 8921 *session->http_server_properties(); |
| 8922 AlternativeServiceVector alternative_service_vector = | 8922 AlternativeServiceVector alternative_service_vector = |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8959 request.method = "GET"; | 8959 request.method = "GET"; |
| 8960 request.url = GURL("http://www.example.org/"); | 8960 request.url = GURL("http://www.example.org/"); |
| 8961 request.load_flags = 0; | 8961 request.load_flags = 0; |
| 8962 | 8962 |
| 8963 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 8963 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 8964 | 8964 |
| 8965 session_deps_.socket_factory->AddSocketDataProvider(&data); | 8965 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 8966 | 8966 |
| 8967 TestCompletionCallback callback; | 8967 TestCompletionCallback callback; |
| 8968 | 8968 |
| 8969 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 8969 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 8970 scoped_ptr<HttpTransaction> trans( | 8970 scoped_ptr<HttpTransaction> trans( |
| 8971 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 8971 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 8972 | 8972 |
| 8973 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 8973 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 8974 EXPECT_EQ(ERR_IO_PENDING, rv); | 8974 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 8975 | 8975 |
| 8976 HostPortPair http_host_port_pair("www.example.org", 80); | 8976 HostPortPair http_host_port_pair("www.example.org", 80); |
| 8977 HttpServerProperties& http_server_properties = | 8977 HttpServerProperties& http_server_properties = |
| 8978 *session->http_server_properties(); | 8978 *session->http_server_properties(); |
| 8979 AlternativeServiceVector alternative_service_vector = | 8979 AlternativeServiceVector alternative_service_vector = |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9026 request.method = "GET"; | 9026 request.method = "GET"; |
| 9027 request.url = GURL("http://www.example.org/"); | 9027 request.url = GURL("http://www.example.org/"); |
| 9028 request.load_flags = 0; | 9028 request.load_flags = 0; |
| 9029 | 9029 |
| 9030 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 9030 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 9031 | 9031 |
| 9032 session_deps_.socket_factory->AddSocketDataProvider(&data); | 9032 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 9033 | 9033 |
| 9034 TestCompletionCallback callback; | 9034 TestCompletionCallback callback; |
| 9035 | 9035 |
| 9036 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9036 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9037 scoped_ptr<HttpTransaction> trans( | 9037 scoped_ptr<HttpTransaction> trans( |
| 9038 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9038 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9039 | 9039 |
| 9040 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 9040 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 9041 EXPECT_EQ(ERR_IO_PENDING, rv); | 9041 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9042 | 9042 |
| 9043 HostPortPair http_host_port_pair("www.example.org", 80); | 9043 HostPortPair http_host_port_pair("www.example.org", 80); |
| 9044 HttpServerProperties& http_server_properties = | 9044 HttpServerProperties& http_server_properties = |
| 9045 *session->http_server_properties(); | 9045 *session->http_server_properties(); |
| 9046 AlternativeServiceVector alternative_service_vector = | 9046 AlternativeServiceVector alternative_service_vector = |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9083 request.method = "GET"; | 9083 request.method = "GET"; |
| 9084 request.url = GURL("http://www.example.org/"); | 9084 request.url = GURL("http://www.example.org/"); |
| 9085 request.load_flags = 0; | 9085 request.load_flags = 0; |
| 9086 | 9086 |
| 9087 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 9087 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 9088 | 9088 |
| 9089 session_deps_.socket_factory->AddSocketDataProvider(&data); | 9089 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 9090 | 9090 |
| 9091 TestCompletionCallback callback; | 9091 TestCompletionCallback callback; |
| 9092 | 9092 |
| 9093 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9093 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9094 | 9094 |
| 9095 HostPortPair http_host_port_pair("www.example.org", 80); | 9095 HostPortPair http_host_port_pair("www.example.org", 80); |
| 9096 HttpServerProperties& http_server_properties = | 9096 HttpServerProperties& http_server_properties = |
| 9097 *session->http_server_properties(); | 9097 *session->http_server_properties(); |
| 9098 AlternativeService alternative_service(QUIC, "", 80); | 9098 AlternativeService alternative_service(QUIC, "", 80); |
| 9099 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9099 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9100 http_server_properties.SetAlternativeService( | 9100 http_server_properties.SetAlternativeService( |
| 9101 http_host_port_pair, alternative_service, 1.0, expiration); | 9101 http_host_port_pair, alternative_service, 1.0, expiration); |
| 9102 | 9102 |
| 9103 AlternativeServiceVector alternative_service_vector = | 9103 AlternativeServiceVector alternative_service_vector = |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9150 request.method = "GET"; | 9150 request.method = "GET"; |
| 9151 request.url = GURL("http://www.example.org/"); | 9151 request.url = GURL("http://www.example.org/"); |
| 9152 request.load_flags = 0; | 9152 request.load_flags = 0; |
| 9153 | 9153 |
| 9154 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 9154 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 9155 | 9155 |
| 9156 session_deps_.socket_factory->AddSocketDataProvider(&data); | 9156 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 9157 | 9157 |
| 9158 TestCompletionCallback callback; | 9158 TestCompletionCallback callback; |
| 9159 | 9159 |
| 9160 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9160 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9161 scoped_ptr<HttpTransaction> trans( | 9161 scoped_ptr<HttpTransaction> trans( |
| 9162 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9162 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9163 | 9163 |
| 9164 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 9164 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 9165 EXPECT_EQ(ERR_IO_PENDING, rv); | 9165 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9166 | 9166 |
| 9167 HostPortPair http_host_port_pair("www.example.org", 80); | 9167 HostPortPair http_host_port_pair("www.example.org", 80); |
| 9168 HttpServerProperties& http_server_properties = | 9168 HttpServerProperties& http_server_properties = |
| 9169 *session->http_server_properties(); | 9169 *session->http_server_properties(); |
| 9170 AlternativeServiceVector alternative_service_vector = | 9170 AlternativeServiceVector alternative_service_vector = |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9209 session_deps_.socket_factory->AddSocketDataProvider(&first_data); | 9209 session_deps_.socket_factory->AddSocketDataProvider(&first_data); |
| 9210 | 9210 |
| 9211 MockRead data_reads[] = { | 9211 MockRead data_reads[] = { |
| 9212 MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello world"), | 9212 MockRead("HTTP/1.1 200 OK\r\n\r\n"), MockRead("hello world"), |
| 9213 MockRead(ASYNC, OK), | 9213 MockRead(ASYNC, OK), |
| 9214 }; | 9214 }; |
| 9215 StaticSocketDataProvider second_data(data_reads, arraysize(data_reads), | 9215 StaticSocketDataProvider second_data(data_reads, arraysize(data_reads), |
| 9216 nullptr, 0); | 9216 nullptr, 0); |
| 9217 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9217 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9218 | 9218 |
| 9219 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9219 scoped_ptr<HttpNetworkSession> session = CreateSession(&session_deps_); |
| 9220 | 9220 |
| 9221 base::WeakPtr<HttpServerProperties> http_server_properties = | 9221 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9222 session->http_server_properties(); | 9222 session->http_server_properties(); |
| 9223 AlternativeService alternative_service( | 9223 AlternativeService alternative_service( |
| 9224 AlternateProtocolFromNextProto(GetParam()), "different.example.org", 80); | 9224 AlternateProtocolFromNextProto(GetParam()), "different.example.org", 80); |
| 9225 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9225 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9226 http_server_properties->SetAlternativeService( | 9226 http_server_properties->SetAlternativeService( |
| 9227 HostPortPair::FromURL(request.url), alternative_service, 1.0, expiration); | 9227 HostPortPair::FromURL(request.url), alternative_service, 1.0, expiration); |
| 9228 | 9228 |
| 9229 scoped_ptr<HttpTransaction> trans( | 9229 scoped_ptr<HttpTransaction> trans( |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 9253 | 9253 |
| 9254 MockRead data_reads[] = { | 9254 MockRead data_reads[] = { |
| 9255 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9255 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9256 MockRead("hello world"), | 9256 MockRead("hello world"), |
| 9257 MockRead(ASYNC, OK), | 9257 MockRead(ASYNC, OK), |
| 9258 }; | 9258 }; |
| 9259 StaticSocketDataProvider second_data( | 9259 StaticSocketDataProvider second_data( |
| 9260 data_reads, arraysize(data_reads), NULL, 0); | 9260 data_reads, arraysize(data_reads), NULL, 0); |
| 9261 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9261 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9262 | 9262 |
| 9263 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9263 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9264 | 9264 |
| 9265 base::WeakPtr<HttpServerProperties> http_server_properties = | 9265 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9266 session->http_server_properties(); | 9266 session->http_server_properties(); |
| 9267 const HostPortPair host_port_pair = HostPortPair::FromURL(request.url); | 9267 const HostPortPair host_port_pair = HostPortPair::FromURL(request.url); |
| 9268 // Port must be < 1024, or the header will be ignored (since initial port was | 9268 // Port must be < 1024, or the header will be ignored (since initial port was |
| 9269 // port 80 (another restricted port). | 9269 // port 80 (another restricted port). |
| 9270 const AlternativeService alternative_service( | 9270 const AlternativeService alternative_service( |
| 9271 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9271 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9272 666); // Port is ignored by MockConnect anyway. | 9272 666); // Port is ignored by MockConnect anyway. |
| 9273 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9273 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9319 | 9319 |
| 9320 MockRead data_reads[] = { | 9320 MockRead data_reads[] = { |
| 9321 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9321 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9322 MockRead("hello world"), | 9322 MockRead("hello world"), |
| 9323 MockRead(ASYNC, OK), | 9323 MockRead(ASYNC, OK), |
| 9324 }; | 9324 }; |
| 9325 StaticSocketDataProvider second_data( | 9325 StaticSocketDataProvider second_data( |
| 9326 data_reads, arraysize(data_reads), NULL, 0); | 9326 data_reads, arraysize(data_reads), NULL, 0); |
| 9327 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9327 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9328 | 9328 |
| 9329 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9329 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9330 | 9330 |
| 9331 base::WeakPtr<HttpServerProperties> http_server_properties = | 9331 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9332 session->http_server_properties(); | 9332 session->http_server_properties(); |
| 9333 const int kUnrestrictedAlternatePort = 1024; | 9333 const int kUnrestrictedAlternatePort = 1024; |
| 9334 AlternativeService alternative_service( | 9334 AlternativeService alternative_service( |
| 9335 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9335 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9336 kUnrestrictedAlternatePort); | 9336 kUnrestrictedAlternatePort); |
| 9337 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9337 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9338 http_server_properties->SetAlternativeService( | 9338 http_server_properties->SetAlternativeService( |
| 9339 HostPortPair::FromURL(restricted_port_request.url), alternative_service, | 9339 HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9371 | 9371 |
| 9372 MockRead data_reads[] = { | 9372 MockRead data_reads[] = { |
| 9373 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9373 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9374 MockRead("hello world"), | 9374 MockRead("hello world"), |
| 9375 MockRead(ASYNC, OK), | 9375 MockRead(ASYNC, OK), |
| 9376 }; | 9376 }; |
| 9377 StaticSocketDataProvider second_data( | 9377 StaticSocketDataProvider second_data( |
| 9378 data_reads, arraysize(data_reads), NULL, 0); | 9378 data_reads, arraysize(data_reads), NULL, 0); |
| 9379 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9379 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9380 | 9380 |
| 9381 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9381 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9382 | 9382 |
| 9383 base::WeakPtr<HttpServerProperties> http_server_properties = | 9383 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9384 session->http_server_properties(); | 9384 session->http_server_properties(); |
| 9385 const int kUnrestrictedAlternatePort = 1024; | 9385 const int kUnrestrictedAlternatePort = 1024; |
| 9386 AlternativeService alternative_service( | 9386 AlternativeService alternative_service( |
| 9387 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9387 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9388 kUnrestrictedAlternatePort); | 9388 kUnrestrictedAlternatePort); |
| 9389 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9389 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9390 http_server_properties->SetAlternativeService( | 9390 http_server_properties->SetAlternativeService( |
| 9391 HostPortPair::FromURL(restricted_port_request.url), alternative_service, | 9391 HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 9422 | 9422 |
| 9423 MockRead data_reads[] = { | 9423 MockRead data_reads[] = { |
| 9424 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9424 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9425 MockRead("hello world"), | 9425 MockRead("hello world"), |
| 9426 MockRead(ASYNC, OK), | 9426 MockRead(ASYNC, OK), |
| 9427 }; | 9427 }; |
| 9428 StaticSocketDataProvider second_data( | 9428 StaticSocketDataProvider second_data( |
| 9429 data_reads, arraysize(data_reads), NULL, 0); | 9429 data_reads, arraysize(data_reads), NULL, 0); |
| 9430 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9430 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9431 | 9431 |
| 9432 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9432 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9433 | 9433 |
| 9434 base::WeakPtr<HttpServerProperties> http_server_properties = | 9434 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9435 session->http_server_properties(); | 9435 session->http_server_properties(); |
| 9436 const int kRestrictedAlternatePort = 80; | 9436 const int kRestrictedAlternatePort = 80; |
| 9437 AlternativeService alternative_service( | 9437 AlternativeService alternative_service( |
| 9438 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9438 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9439 kRestrictedAlternatePort); | 9439 kRestrictedAlternatePort); |
| 9440 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9440 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9441 http_server_properties->SetAlternativeService( | 9441 http_server_properties->SetAlternativeService( |
| 9442 HostPortPair::FromURL(restricted_port_request.url), alternative_service, | 9442 HostPortPair::FromURL(restricted_port_request.url), alternative_service, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9474 | 9474 |
| 9475 MockRead data_reads[] = { | 9475 MockRead data_reads[] = { |
| 9476 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9476 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9477 MockRead("hello world"), | 9477 MockRead("hello world"), |
| 9478 MockRead(ASYNC, OK), | 9478 MockRead(ASYNC, OK), |
| 9479 }; | 9479 }; |
| 9480 StaticSocketDataProvider second_data( | 9480 StaticSocketDataProvider second_data( |
| 9481 data_reads, arraysize(data_reads), NULL, 0); | 9481 data_reads, arraysize(data_reads), NULL, 0); |
| 9482 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9482 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9483 | 9483 |
| 9484 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9484 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9485 | 9485 |
| 9486 base::WeakPtr<HttpServerProperties> http_server_properties = | 9486 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9487 session->http_server_properties(); | 9487 session->http_server_properties(); |
| 9488 const int kRestrictedAlternatePort = 80; | 9488 const int kRestrictedAlternatePort = 80; |
| 9489 AlternativeService alternative_service( | 9489 AlternativeService alternative_service( |
| 9490 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9490 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9491 kRestrictedAlternatePort); | 9491 kRestrictedAlternatePort); |
| 9492 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9492 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9493 http_server_properties->SetAlternativeService( | 9493 http_server_properties->SetAlternativeService( |
| 9494 HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, | 9494 HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 9525 | 9525 |
| 9526 MockRead data_reads[] = { | 9526 MockRead data_reads[] = { |
| 9527 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9527 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9528 MockRead("hello world"), | 9528 MockRead("hello world"), |
| 9529 MockRead(ASYNC, OK), | 9529 MockRead(ASYNC, OK), |
| 9530 }; | 9530 }; |
| 9531 StaticSocketDataProvider second_data( | 9531 StaticSocketDataProvider second_data( |
| 9532 data_reads, arraysize(data_reads), NULL, 0); | 9532 data_reads, arraysize(data_reads), NULL, 0); |
| 9533 session_deps_.socket_factory->AddSocketDataProvider(&second_data); | 9533 session_deps_.socket_factory->AddSocketDataProvider(&second_data); |
| 9534 | 9534 |
| 9535 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9535 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9536 | 9536 |
| 9537 base::WeakPtr<HttpServerProperties> http_server_properties = | 9537 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9538 session->http_server_properties(); | 9538 session->http_server_properties(); |
| 9539 const int kUnrestrictedAlternatePort = 1025; | 9539 const int kUnrestrictedAlternatePort = 1025; |
| 9540 AlternativeService alternative_service( | 9540 AlternativeService alternative_service( |
| 9541 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9541 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9542 kUnrestrictedAlternatePort); | 9542 kUnrestrictedAlternatePort); |
| 9543 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9543 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9544 http_server_properties->SetAlternativeService( | 9544 http_server_properties->SetAlternativeService( |
| 9545 HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, | 9545 HostPortPair::FromURL(unrestricted_port_request.url), alternative_service, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 9571 // so only the standard HTTP request will try to connect. | 9571 // so only the standard HTTP request will try to connect. |
| 9572 MockRead data_reads[] = { | 9572 MockRead data_reads[] = { |
| 9573 MockRead("HTTP/1.1 200 OK\r\n\r\n"), | 9573 MockRead("HTTP/1.1 200 OK\r\n\r\n"), |
| 9574 MockRead("hello world"), | 9574 MockRead("hello world"), |
| 9575 MockRead(ASYNC, OK), | 9575 MockRead(ASYNC, OK), |
| 9576 }; | 9576 }; |
| 9577 StaticSocketDataProvider data( | 9577 StaticSocketDataProvider data( |
| 9578 data_reads, arraysize(data_reads), NULL, 0); | 9578 data_reads, arraysize(data_reads), NULL, 0); |
| 9579 session_deps_.socket_factory->AddSocketDataProvider(&data); | 9579 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 9580 | 9580 |
| 9581 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9581 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9582 | 9582 |
| 9583 base::WeakPtr<HttpServerProperties> http_server_properties = | 9583 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 9584 session->http_server_properties(); | 9584 session->http_server_properties(); |
| 9585 const int kUnsafePort = 7; | 9585 const int kUnsafePort = 7; |
| 9586 AlternativeService alternative_service( | 9586 AlternativeService alternative_service( |
| 9587 AlternateProtocolFromNextProto(GetParam()), "www.example.org", | 9587 AlternateProtocolFromNextProto(GetParam()), "www.example.org", |
| 9588 kUnsafePort); | 9588 kUnsafePort); |
| 9589 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 9589 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 9590 http_server_properties->SetAlternativeService( | 9590 http_server_properties->SetAlternativeService( |
| 9591 HostPortPair::FromURL(request.url), alternative_service, 1.0, expiration); | 9591 HostPortPair::FromURL(request.url), alternative_service, 1.0, expiration); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9656 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); | 9656 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); |
| 9657 StaticSocketDataProvider hanging_non_alternate_protocol_socket( | 9657 StaticSocketDataProvider hanging_non_alternate_protocol_socket( |
| 9658 NULL, 0, NULL, 0); | 9658 NULL, 0, NULL, 0); |
| 9659 hanging_non_alternate_protocol_socket.set_connect_data( | 9659 hanging_non_alternate_protocol_socket.set_connect_data( |
| 9660 never_finishing_connect); | 9660 never_finishing_connect); |
| 9661 session_deps_.socket_factory->AddSocketDataProvider( | 9661 session_deps_.socket_factory->AddSocketDataProvider( |
| 9662 &hanging_non_alternate_protocol_socket); | 9662 &hanging_non_alternate_protocol_socket); |
| 9663 | 9663 |
| 9664 TestCompletionCallback callback; | 9664 TestCompletionCallback callback; |
| 9665 | 9665 |
| 9666 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9666 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9667 scoped_ptr<HttpTransaction> trans( | 9667 scoped_ptr<HttpTransaction> trans( |
| 9668 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9668 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9669 | 9669 |
| 9670 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 9670 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 9671 EXPECT_EQ(ERR_IO_PENDING, rv); | 9671 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9672 EXPECT_EQ(OK, callback.WaitForResult()); | 9672 EXPECT_EQ(OK, callback.WaitForResult()); |
| 9673 | 9673 |
| 9674 const HttpResponseInfo* response = trans->GetResponseInfo(); | 9674 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 9675 ASSERT_TRUE(response != NULL); | 9675 ASSERT_TRUE(response != NULL); |
| 9676 ASSERT_TRUE(response->headers.get() != NULL); | 9676 ASSERT_TRUE(response->headers.get() != NULL); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9758 }; | 9758 }; |
| 9759 | 9759 |
| 9760 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, | 9760 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, |
| 9761 arraysize(spdy_writes)); | 9761 arraysize(spdy_writes)); |
| 9762 // Socket 4 is the successful Alternate-Protocol for transaction 3. | 9762 // Socket 4 is the successful Alternate-Protocol for transaction 3. |
| 9763 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); | 9763 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); |
| 9764 | 9764 |
| 9765 // Socket 5 is the unsuccessful non-Alternate-Protocol for transaction 3. | 9765 // Socket 5 is the unsuccessful non-Alternate-Protocol for transaction 3. |
| 9766 session_deps_.socket_factory->AddSocketDataProvider(&hanging_socket); | 9766 session_deps_.socket_factory->AddSocketDataProvider(&hanging_socket); |
| 9767 | 9767 |
| 9768 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9768 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9769 TestCompletionCallback callback1; | 9769 TestCompletionCallback callback1; |
| 9770 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get()); | 9770 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get()); |
| 9771 | 9771 |
| 9772 int rv = trans1.Start(&request, callback1.callback(), BoundNetLog()); | 9772 int rv = trans1.Start(&request, callback1.callback(), BoundNetLog()); |
| 9773 EXPECT_EQ(ERR_IO_PENDING, rv); | 9773 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9774 EXPECT_EQ(OK, callback1.WaitForResult()); | 9774 EXPECT_EQ(OK, callback1.WaitForResult()); |
| 9775 | 9775 |
| 9776 const HttpResponseInfo* response = trans1.GetResponseInfo(); | 9776 const HttpResponseInfo* response = trans1.GetResponseInfo(); |
| 9777 ASSERT_TRUE(response != NULL); | 9777 ASSERT_TRUE(response != NULL); |
| 9778 ASSERT_TRUE(response->headers.get() != NULL); | 9778 ASSERT_TRUE(response->headers.get() != NULL); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9849 hanging_alternate_protocol_socket.set_connect_data( | 9849 hanging_alternate_protocol_socket.set_connect_data( |
| 9850 never_finishing_connect); | 9850 never_finishing_connect); |
| 9851 session_deps_.socket_factory->AddSocketDataProvider( | 9851 session_deps_.socket_factory->AddSocketDataProvider( |
| 9852 &hanging_alternate_protocol_socket); | 9852 &hanging_alternate_protocol_socket); |
| 9853 | 9853 |
| 9854 // 2nd request is just a copy of the first one, over HTTP again. | 9854 // 2nd request is just a copy of the first one, over HTTP again. |
| 9855 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); | 9855 session_deps_.socket_factory->AddSocketDataProvider(&first_transaction); |
| 9856 | 9856 |
| 9857 TestCompletionCallback callback; | 9857 TestCompletionCallback callback; |
| 9858 | 9858 |
| 9859 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 9859 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 9860 scoped_ptr<HttpTransaction> trans( | 9860 scoped_ptr<HttpTransaction> trans( |
| 9861 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 9861 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 9862 | 9862 |
| 9863 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 9863 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 9864 EXPECT_EQ(ERR_IO_PENDING, rv); | 9864 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 9865 EXPECT_EQ(OK, callback.WaitForResult()); | 9865 EXPECT_EQ(OK, callback.WaitForResult()); |
| 9866 | 9866 |
| 9867 const HttpResponseInfo* response = trans->GetResponseInfo(); | 9867 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 9868 ASSERT_TRUE(response != NULL); | 9868 ASSERT_TRUE(response != NULL); |
| 9869 ASSERT_TRUE(response->headers.get() != NULL); | 9869 ASSERT_TRUE(response->headers.get() != NULL); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10013 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); | 10013 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); |
| 10014 StaticSocketDataProvider hanging_non_alternate_protocol_socket( | 10014 StaticSocketDataProvider hanging_non_alternate_protocol_socket( |
| 10015 NULL, 0, NULL, 0); | 10015 NULL, 0, NULL, 0); |
| 10016 hanging_non_alternate_protocol_socket.set_connect_data( | 10016 hanging_non_alternate_protocol_socket.set_connect_data( |
| 10017 never_finishing_connect); | 10017 never_finishing_connect); |
| 10018 session_deps_.socket_factory->AddSocketDataProvider( | 10018 session_deps_.socket_factory->AddSocketDataProvider( |
| 10019 &hanging_non_alternate_protocol_socket); | 10019 &hanging_non_alternate_protocol_socket); |
| 10020 | 10020 |
| 10021 TestCompletionCallback callback; | 10021 TestCompletionCallback callback; |
| 10022 | 10022 |
| 10023 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10023 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10024 scoped_ptr<HttpTransaction> trans( | 10024 scoped_ptr<HttpTransaction> trans( |
| 10025 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10025 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10026 | 10026 |
| 10027 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 10027 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 10028 EXPECT_EQ(ERR_IO_PENDING, rv); | 10028 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10029 EXPECT_EQ(OK, callback.WaitForResult()); | 10029 EXPECT_EQ(OK, callback.WaitForResult()); |
| 10030 | 10030 |
| 10031 const HttpResponseInfo* response = trans->GetResponseInfo(); | 10031 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 10032 ASSERT_TRUE(response != NULL); | 10032 ASSERT_TRUE(response != NULL); |
| 10033 ASSERT_TRUE(response->headers.get() != NULL); | 10033 ASSERT_TRUE(response->headers.get() != NULL); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10106 MockRead spdy_reads[] = { | 10106 MockRead spdy_reads[] = { |
| 10107 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), | 10107 CreateMockRead(*resp, 1), CreateMockRead(*data, 2), MockRead(ASYNC, 0, 3), |
| 10108 }; | 10108 }; |
| 10109 | 10109 |
| 10110 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, | 10110 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, |
| 10111 arraysize(spdy_writes)); | 10111 arraysize(spdy_writes)); |
| 10112 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); | 10112 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); |
| 10113 | 10113 |
| 10114 TestCompletionCallback callback; | 10114 TestCompletionCallback callback; |
| 10115 | 10115 |
| 10116 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10116 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10117 | 10117 |
| 10118 scoped_ptr<HttpTransaction> trans( | 10118 scoped_ptr<HttpTransaction> trans( |
| 10119 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10119 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10120 | 10120 |
| 10121 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 10121 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 10122 EXPECT_EQ(ERR_IO_PENDING, rv); | 10122 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10123 EXPECT_EQ(OK, callback.WaitForResult()); | 10123 EXPECT_EQ(OK, callback.WaitForResult()); |
| 10124 | 10124 |
| 10125 const HttpResponseInfo* response = trans->GetResponseInfo(); | 10125 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 10126 ASSERT_TRUE(response != NULL); | 10126 ASSERT_TRUE(response != NULL); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10498 ProxyService::CreateFixed(test_config.proxy_url)); | 10498 ProxyService::CreateFixed(test_config.proxy_url)); |
| 10499 } else { | 10499 } else { |
| 10500 session_deps_.proxy_service.reset(ProxyService::CreateDirect()); | 10500 session_deps_.proxy_service.reset(ProxyService::CreateDirect()); |
| 10501 } | 10501 } |
| 10502 | 10502 |
| 10503 HttpRequestInfo request; | 10503 HttpRequestInfo request; |
| 10504 request.method = "GET"; | 10504 request.method = "GET"; |
| 10505 request.url = GURL(test_config.server_url); | 10505 request.url = GURL(test_config.server_url); |
| 10506 request.load_flags = 0; | 10506 request.load_flags = 0; |
| 10507 | 10507 |
| 10508 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10508 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10509 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); | 10509 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); |
| 10510 | 10510 |
| 10511 SSLSocketDataProvider ssl_socket_data_provider(SYNCHRONOUS, OK); | 10511 SSLSocketDataProvider ssl_socket_data_provider(SYNCHRONOUS, OK); |
| 10512 | 10512 |
| 10513 std::vector<std::vector<MockRead>> mock_reads(1); | 10513 std::vector<std::vector<MockRead>> mock_reads(1); |
| 10514 std::vector<std::vector<MockWrite>> mock_writes(1); | 10514 std::vector<std::vector<MockWrite>> mock_writes(1); |
| 10515 for (int round = 0; round < test_config.num_auth_rounds; ++round) { | 10515 for (int round = 0; round < test_config.num_auth_rounds; ++round) { |
| 10516 const TestRound& read_write_round = test_config.rounds[round]; | 10516 const TestRound& read_write_round = test_config.rounds[round]; |
| 10517 | 10517 |
| 10518 // Set up expected reads and writes. | 10518 // Set up expected reads and writes. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10597 origin, BoundNetLog()); | 10597 origin, BoundNetLog()); |
| 10598 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER); | 10598 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER); |
| 10599 | 10599 |
| 10600 int rv = OK; | 10600 int rv = OK; |
| 10601 const HttpResponseInfo* response = NULL; | 10601 const HttpResponseInfo* response = NULL; |
| 10602 HttpRequestInfo request; | 10602 HttpRequestInfo request; |
| 10603 request.method = "GET"; | 10603 request.method = "GET"; |
| 10604 request.url = origin; | 10604 request.url = origin; |
| 10605 request.load_flags = 0; | 10605 request.load_flags = 0; |
| 10606 | 10606 |
| 10607 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10607 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10608 | 10608 |
| 10609 // Use a TCP Socket Pool with only one connection per group. This is used | 10609 // Use a TCP Socket Pool with only one connection per group. This is used |
| 10610 // to validate that the TCP socket is not released to the pool between | 10610 // to validate that the TCP socket is not released to the pool between |
| 10611 // each round of multi-round authentication. | 10611 // each round of multi-round authentication. |
| 10612 HttpNetworkSessionPeer session_peer(session); | 10612 HttpNetworkSessionPeer session_peer(session.get()); |
| 10613 TransportClientSocketPool* transport_pool = new TransportClientSocketPool( | 10613 TransportClientSocketPool* transport_pool = new TransportClientSocketPool( |
| 10614 50, // Max sockets for pool | 10614 50, // Max sockets for pool |
| 10615 1, // Max sockets per group | 10615 1, // Max sockets per group |
| 10616 session_deps_.host_resolver.get(), | 10616 session_deps_.host_resolver.get(), |
| 10617 session_deps_.socket_factory.get(), | 10617 session_deps_.socket_factory.get(), |
| 10618 session_deps_.net_log); | 10618 session_deps_.net_log); |
| 10619 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( | 10619 scoped_ptr<MockClientSocketPoolManager> mock_pool_manager( |
| 10620 new MockClientSocketPoolManager); | 10620 new MockClientSocketPoolManager); |
| 10621 mock_pool_manager->SetTransportSocketPool(transport_pool); | 10621 mock_pool_manager->SetTransportSocketPool(transport_pool); |
| 10622 session_peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); | 10622 session_peer.SetClientSocketPoolManager(mock_pool_manager.Pass()); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10797 ssl.SetNextProto(kProtoHTTP11); | 10797 ssl.SetNextProto(kProtoHTTP11); |
| 10798 | 10798 |
| 10799 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 10799 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 10800 | 10800 |
| 10801 StaticSocketDataProvider data(data_reads, arraysize(data_reads), | 10801 StaticSocketDataProvider data(data_reads, arraysize(data_reads), |
| 10802 data_writes, arraysize(data_writes)); | 10802 data_writes, arraysize(data_writes)); |
| 10803 session_deps_.socket_factory->AddSocketDataProvider(&data); | 10803 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 10804 | 10804 |
| 10805 TestCompletionCallback callback; | 10805 TestCompletionCallback callback; |
| 10806 | 10806 |
| 10807 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10807 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10808 scoped_ptr<HttpTransaction> trans( | 10808 scoped_ptr<HttpTransaction> trans( |
| 10809 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10809 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10810 | 10810 |
| 10811 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 10811 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 10812 | 10812 |
| 10813 EXPECT_EQ(ERR_IO_PENDING, rv); | 10813 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10814 EXPECT_EQ(OK, callback.WaitForResult()); | 10814 EXPECT_EQ(OK, callback.WaitForResult()); |
| 10815 | 10815 |
| 10816 const HttpResponseInfo* response = trans->GetResponseInfo(); | 10816 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 10817 ASSERT_TRUE(response != NULL); | 10817 ASSERT_TRUE(response != NULL); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10849 MockRead spdy_reads[] = { | 10849 MockRead spdy_reads[] = { |
| 10850 MockRead(SYNCHRONOUS, 0, 0) // Not async - return 0 immediately. | 10850 MockRead(SYNCHRONOUS, 0, 0) // Not async - return 0 immediately. |
| 10851 }; | 10851 }; |
| 10852 | 10852 |
| 10853 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, | 10853 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, |
| 10854 arraysize(spdy_writes)); | 10854 arraysize(spdy_writes)); |
| 10855 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); | 10855 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); |
| 10856 | 10856 |
| 10857 TestCompletionCallback callback; | 10857 TestCompletionCallback callback; |
| 10858 | 10858 |
| 10859 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 10859 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 10860 scoped_ptr<HttpTransaction> trans( | 10860 scoped_ptr<HttpTransaction> trans( |
| 10861 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 10861 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 10862 | 10862 |
| 10863 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); | 10863 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 10864 EXPECT_EQ(ERR_IO_PENDING, rv); | 10864 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 10865 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); | 10865 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback.WaitForResult()); |
| 10866 } | 10866 } |
| 10867 | 10867 |
| 10868 // A subclass of HttpAuthHandlerMock that records the request URL when | 10868 // A subclass of HttpAuthHandlerMock that records the request URL when |
| 10869 // it gets it. This is needed since the auth handler may get destroyed | 10869 // it gets it. This is needed since the auth handler may get destroyed |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11003 StaticSocketDataProvider hanging_non_alternate_protocol_socket( | 11003 StaticSocketDataProvider hanging_non_alternate_protocol_socket( |
| 11004 NULL, 0, NULL, 0); | 11004 NULL, 0, NULL, 0); |
| 11005 hanging_non_alternate_protocol_socket.set_connect_data( | 11005 hanging_non_alternate_protocol_socket.set_connect_data( |
| 11006 never_finishing_connect); | 11006 never_finishing_connect); |
| 11007 | 11007 |
| 11008 session_deps_.socket_factory->AddSocketDataProvider(&data_1); | 11008 session_deps_.socket_factory->AddSocketDataProvider(&data_1); |
| 11009 session_deps_.socket_factory->AddSocketDataProvider(&data_2); | 11009 session_deps_.socket_factory->AddSocketDataProvider(&data_2); |
| 11010 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 11010 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 11011 session_deps_.socket_factory->AddSocketDataProvider( | 11011 session_deps_.socket_factory->AddSocketDataProvider( |
| 11012 &hanging_non_alternate_protocol_socket); | 11012 &hanging_non_alternate_protocol_socket); |
| 11013 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11013 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11014 | 11014 |
| 11015 // First round should work and provide the Alternate-Protocol state. | 11015 // First round should work and provide the Alternate-Protocol state. |
| 11016 TestCompletionCallback callback_1; | 11016 TestCompletionCallback callback_1; |
| 11017 scoped_ptr<HttpTransaction> trans_1( | 11017 scoped_ptr<HttpTransaction> trans_1( |
| 11018 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11018 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11019 int rv = trans_1->Start(&request, callback_1.callback(), BoundNetLog()); | 11019 int rv = trans_1->Start(&request, callback_1.callback(), BoundNetLog()); |
| 11020 EXPECT_EQ(ERR_IO_PENDING, rv); | 11020 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 11021 EXPECT_EQ(OK, callback_1.WaitForResult()); | 11021 EXPECT_EQ(OK, callback_1.WaitForResult()); |
| 11022 | 11022 |
| 11023 // Second round should attempt a tunnel connect and get an auth challenge. | 11023 // 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... | |
| 11063 MockRead(SYNCHRONOUS, "hello world"), | 11063 MockRead(SYNCHRONOUS, "hello world"), |
| 11064 MockRead(SYNCHRONOUS, OK), | 11064 MockRead(SYNCHRONOUS, OK), |
| 11065 }; | 11065 }; |
| 11066 | 11066 |
| 11067 HttpRequestInfo request; | 11067 HttpRequestInfo request; |
| 11068 request.method = "GET"; | 11068 request.method = "GET"; |
| 11069 request.url = GURL("http://www.example.org/"); | 11069 request.url = GURL("http://www.example.org/"); |
| 11070 request.load_flags = 0; | 11070 request.load_flags = 0; |
| 11071 | 11071 |
| 11072 session_deps_.host_resolver->set_synchronous_mode(true); | 11072 session_deps_.host_resolver->set_synchronous_mode(true); |
| 11073 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11073 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11074 scoped_ptr<HttpTransaction> trans( | 11074 scoped_ptr<HttpTransaction> trans( |
| 11075 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11075 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11076 | 11076 |
| 11077 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 11077 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 11078 data.set_connect_data(mock_connect); | 11078 data.set_connect_data(mock_connect); |
| 11079 session_deps_.socket_factory->AddSocketDataProvider(&data); | 11079 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 11080 | 11080 |
| 11081 TestCompletionCallback callback; | 11081 TestCompletionCallback callback; |
| 11082 | 11082 |
| 11083 BoundTestNetLog log; | 11083 BoundTestNetLog log; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 11101 MockRead(ASYNC, "Connection: Keep-Alive\r\n\r\n"), | 11101 MockRead(ASYNC, "Connection: Keep-Alive\r\n\r\n"), |
| 11102 MockRead(ASYNC, "1"), | 11102 MockRead(ASYNC, "1"), |
| 11103 // 2 async reads are necessary to trigger a ReadResponseBody call after the | 11103 // 2 async reads are necessary to trigger a ReadResponseBody call after the |
| 11104 // HttpNetworkTransaction has been deleted. | 11104 // HttpNetworkTransaction has been deleted. |
| 11105 MockRead(ASYNC, "2"), | 11105 MockRead(ASYNC, "2"), |
| 11106 MockRead(SYNCHRONOUS, ERR_IO_PENDING), // Should never read this. | 11106 MockRead(SYNCHRONOUS, ERR_IO_PENDING), // Should never read this. |
| 11107 }; | 11107 }; |
| 11108 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 11108 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 11109 session_deps_.socket_factory->AddSocketDataProvider(&data); | 11109 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 11110 | 11110 |
| 11111 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11111 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11112 | 11112 |
| 11113 { | 11113 { |
| 11114 HttpRequestInfo request; | 11114 HttpRequestInfo request; |
| 11115 request.method = "GET"; | 11115 request.method = "GET"; |
| 11116 request.url = GURL("http://www.example.org/"); | 11116 request.url = GURL("http://www.example.org/"); |
| 11117 request.load_flags = 0; | 11117 request.load_flags = 0; |
| 11118 | 11118 |
| 11119 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); | 11119 HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); |
| 11120 TestCompletionCallback callback; | 11120 TestCompletionCallback callback; |
| 11121 | 11121 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 11137 // Socket should now be idle, waiting to be reused. | 11137 // Socket should now be idle, waiting to be reused. |
| 11138 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session.get())); | 11138 EXPECT_EQ(1, GetIdleSocketCountInTransportSocketPool(session.get())); |
| 11139 } | 11139 } |
| 11140 | 11140 |
| 11141 // Test a basic GET request through a proxy. | 11141 // Test a basic GET request through a proxy. |
| 11142 TEST_P(HttpNetworkTransactionTest, ProxyGet) { | 11142 TEST_P(HttpNetworkTransactionTest, ProxyGet) { |
| 11143 session_deps_.proxy_service.reset( | 11143 session_deps_.proxy_service.reset( |
| 11144 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 11144 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 11145 BoundTestNetLog log; | 11145 BoundTestNetLog log; |
| 11146 session_deps_.net_log = log.bound().net_log(); | 11146 session_deps_.net_log = log.bound().net_log(); |
| 11147 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11147 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11148 | 11148 |
| 11149 HttpRequestInfo request; | 11149 HttpRequestInfo request; |
| 11150 request.method = "GET"; | 11150 request.method = "GET"; |
| 11151 request.url = GURL("http://www.example.org/"); | 11151 request.url = GURL("http://www.example.org/"); |
| 11152 | 11152 |
| 11153 MockWrite data_writes1[] = { | 11153 MockWrite data_writes1[] = { |
| 11154 MockWrite( | 11154 MockWrite( |
| 11155 "GET http://www.example.org/ HTTP/1.1\r\n" | 11155 "GET http://www.example.org/ HTTP/1.1\r\n" |
| 11156 "Host: www.example.org\r\n" | 11156 "Host: www.example.org\r\n" |
| 11157 "Proxy-Connection: keep-alive\r\n\r\n"), | 11157 "Proxy-Connection: keep-alive\r\n\r\n"), |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11201 TestLoadTimingNotReusedWithPac(load_timing_info, | 11201 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 11202 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); | 11202 CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY); |
| 11203 } | 11203 } |
| 11204 | 11204 |
| 11205 // Test a basic HTTPS GET request through a proxy. | 11205 // Test a basic HTTPS GET request through a proxy. |
| 11206 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { | 11206 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGet) { |
| 11207 session_deps_.proxy_service.reset( | 11207 session_deps_.proxy_service.reset( |
| 11208 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 11208 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 11209 BoundTestNetLog log; | 11209 BoundTestNetLog log; |
| 11210 session_deps_.net_log = log.bound().net_log(); | 11210 session_deps_.net_log = log.bound().net_log(); |
| 11211 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11211 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11212 | 11212 |
| 11213 HttpRequestInfo request; | 11213 HttpRequestInfo request; |
| 11214 request.method = "GET"; | 11214 request.method = "GET"; |
| 11215 request.url = GURL("https://www.example.org/"); | 11215 request.url = GURL("https://www.example.org/"); |
| 11216 | 11216 |
| 11217 // Since we have proxy, should try to establish tunnel. | 11217 // Since we have proxy, should try to establish tunnel. |
| 11218 MockWrite data_writes1[] = { | 11218 MockWrite data_writes1[] = { |
| 11219 MockWrite( | 11219 MockWrite( |
| 11220 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 11220 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 11221 "Host: www.example.org\r\n" | 11221 "Host: www.example.org\r\n" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11278 TestLoadTimingNotReusedWithPac(load_timing_info, | 11278 TestLoadTimingNotReusedWithPac(load_timing_info, |
| 11279 CONNECT_TIMING_HAS_SSL_TIMES); | 11279 CONNECT_TIMING_HAS_SSL_TIMES); |
| 11280 } | 11280 } |
| 11281 | 11281 |
| 11282 // Test a basic HTTPS GET request through a proxy, but the server hangs up | 11282 // Test a basic HTTPS GET request through a proxy, but the server hangs up |
| 11283 // while establishing the tunnel. | 11283 // while establishing the tunnel. |
| 11284 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) { | 11284 TEST_P(HttpNetworkTransactionTest, ProxyTunnelGetHangup) { |
| 11285 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); | 11285 session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70")); |
| 11286 BoundTestNetLog log; | 11286 BoundTestNetLog log; |
| 11287 session_deps_.net_log = log.bound().net_log(); | 11287 session_deps_.net_log = log.bound().net_log(); |
| 11288 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11288 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11289 | 11289 |
| 11290 HttpRequestInfo request; | 11290 HttpRequestInfo request; |
| 11291 request.method = "GET"; | 11291 request.method = "GET"; |
| 11292 request.url = GURL("https://www.example.org/"); | 11292 request.url = GURL("https://www.example.org/"); |
| 11293 | 11293 |
| 11294 // Since we have proxy, should try to establish tunnel. | 11294 // Since we have proxy, should try to establish tunnel. |
| 11295 MockWrite data_writes1[] = { | 11295 MockWrite data_writes1[] = { |
| 11296 MockWrite( | 11296 MockWrite( |
| 11297 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 11297 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 11298 "Host: www.example.org\r\n" | 11298 "Host: www.example.org\r\n" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11350 }; | 11350 }; |
| 11351 | 11351 |
| 11352 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, | 11352 SequencedSocketData spdy_data(spdy_reads, arraysize(spdy_reads), spdy_writes, |
| 11353 arraysize(spdy_writes)); | 11353 arraysize(spdy_writes)); |
| 11354 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); | 11354 session_deps_.socket_factory->AddSocketDataProvider(&spdy_data); |
| 11355 | 11355 |
| 11356 SSLSocketDataProvider ssl(ASYNC, OK); | 11356 SSLSocketDataProvider ssl(ASYNC, OK); |
| 11357 ssl.SetNextProto(GetParam()); | 11357 ssl.SetNextProto(GetParam()); |
| 11358 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 11358 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 11359 | 11359 |
| 11360 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11360 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11361 | 11361 |
| 11362 // Set up an initial SpdySession in the pool to reuse. | 11362 // Set up an initial SpdySession in the pool to reuse. |
| 11363 HostPortPair host_port_pair("www.example.org", 443); | 11363 HostPortPair host_port_pair("www.example.org", 443); |
| 11364 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | 11364 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
| 11365 PRIVACY_MODE_DISABLED); | 11365 PRIVACY_MODE_DISABLED); |
| 11366 base::WeakPtr<SpdySession> spdy_session = | 11366 base::WeakPtr<SpdySession> spdy_session = |
| 11367 CreateInsecureSpdySession(session, key, BoundNetLog()); | 11367 CreateInsecureSpdySession(session, key, BoundNetLog()); |
| 11368 | 11368 |
| 11369 HttpRequestInfo request; | 11369 HttpRequestInfo request; |
| 11370 request.method = "GET"; | 11370 request.method = "GET"; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 11393 request_info.load_flags = LOAD_NORMAL; | 11393 request_info.load_flags = LOAD_NORMAL; |
| 11394 | 11394 |
| 11395 SSLSocketDataProvider ssl_data(mode, OK); | 11395 SSLSocketDataProvider ssl_data(mode, OK); |
| 11396 MockWrite data_writes[] = { | 11396 MockWrite data_writes[] = { |
| 11397 MockWrite(mode, error), | 11397 MockWrite(mode, error), |
| 11398 }; | 11398 }; |
| 11399 StaticSocketDataProvider data(NULL, 0, data_writes, arraysize(data_writes)); | 11399 StaticSocketDataProvider data(NULL, 0, data_writes, arraysize(data_writes)); |
| 11400 session_deps_.socket_factory->AddSocketDataProvider(&data); | 11400 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 11401 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data); | 11401 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data); |
| 11402 | 11402 |
| 11403 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11403 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11404 scoped_ptr<HttpTransaction> trans( | 11404 scoped_ptr<HttpTransaction> trans( |
| 11405 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11405 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11406 | 11406 |
| 11407 TestCompletionCallback callback; | 11407 TestCompletionCallback callback; |
| 11408 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); | 11408 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); |
| 11409 if (rv == ERR_IO_PENDING) | 11409 if (rv == ERR_IO_PENDING) |
| 11410 rv = callback.WaitForResult(); | 11410 rv = callback.WaitForResult(); |
| 11411 ASSERT_EQ(error, rv); | 11411 ASSERT_EQ(error, rv); |
| 11412 } | 11412 } |
| 11413 | 11413 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11480 // connection was attempted with TLSv1.1. This is transparent to the caller | 11480 // connection was attempted with TLSv1.1. This is transparent to the caller |
| 11481 // of the HttpNetworkTransaction. Because this test failure is due to | 11481 // of the HttpNetworkTransaction. Because this test failure is due to |
| 11482 // requiring a client certificate, this fallback handshake should also | 11482 // requiring a client certificate, this fallback handshake should also |
| 11483 // fail. | 11483 // fail. |
| 11484 SSLSocketDataProvider ssl_data4(ASYNC, ERR_SSL_PROTOCOL_ERROR); | 11484 SSLSocketDataProvider ssl_data4(ASYNC, ERR_SSL_PROTOCOL_ERROR); |
| 11485 ssl_data4.cert_request_info = cert_request.get(); | 11485 ssl_data4.cert_request_info = cert_request.get(); |
| 11486 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data4); | 11486 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data4); |
| 11487 StaticSocketDataProvider data4(NULL, 0, NULL, 0); | 11487 StaticSocketDataProvider data4(NULL, 0, NULL, 0); |
| 11488 session_deps_.socket_factory->AddSocketDataProvider(&data4); | 11488 session_deps_.socket_factory->AddSocketDataProvider(&data4); |
| 11489 | 11489 |
| 11490 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11490 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11491 scoped_ptr<HttpTransaction> trans( | 11491 scoped_ptr<HttpTransaction> trans( |
| 11492 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11492 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11493 | 11493 |
| 11494 // Begin the SSL handshake with the peer. This consumes ssl_data1. | 11494 // Begin the SSL handshake with the peer. This consumes ssl_data1. |
| 11495 TestCompletionCallback callback; | 11495 TestCompletionCallback callback; |
| 11496 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); | 11496 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); |
| 11497 ASSERT_EQ(ERR_IO_PENDING, rv); | 11497 ASSERT_EQ(ERR_IO_PENDING, rv); |
| 11498 | 11498 |
| 11499 // Complete the SSL handshake, which should abort due to requiring a | 11499 // Complete the SSL handshake, which should abort due to requiring a |
| 11500 // client certificate. | 11500 // client certificate. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11597 StaticSocketDataProvider data4(data2_reads, arraysize(data2_reads), NULL, 0); | 11597 StaticSocketDataProvider data4(data2_reads, arraysize(data2_reads), NULL, 0); |
| 11598 session_deps_.socket_factory->AddSocketDataProvider(&data4); | 11598 session_deps_.socket_factory->AddSocketDataProvider(&data4); |
| 11599 | 11599 |
| 11600 // Need one more if TLSv1.2 is enabled. | 11600 // Need one more if TLSv1.2 is enabled. |
| 11601 SSLSocketDataProvider ssl_data5(ASYNC, OK); | 11601 SSLSocketDataProvider ssl_data5(ASYNC, OK); |
| 11602 ssl_data5.cert_request_info = cert_request.get(); | 11602 ssl_data5.cert_request_info = cert_request.get(); |
| 11603 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data5); | 11603 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data5); |
| 11604 StaticSocketDataProvider data5(data2_reads, arraysize(data2_reads), NULL, 0); | 11604 StaticSocketDataProvider data5(data2_reads, arraysize(data2_reads), NULL, 0); |
| 11605 session_deps_.socket_factory->AddSocketDataProvider(&data5); | 11605 session_deps_.socket_factory->AddSocketDataProvider(&data5); |
| 11606 | 11606 |
| 11607 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11607 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11608 scoped_ptr<HttpTransaction> trans( | 11608 scoped_ptr<HttpTransaction> trans( |
| 11609 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11609 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11610 | 11610 |
| 11611 // Begin the initial SSL handshake. | 11611 // Begin the initial SSL handshake. |
| 11612 TestCompletionCallback callback; | 11612 TestCompletionCallback callback; |
| 11613 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); | 11613 int rv = trans->Start(&request_info, callback.callback(), BoundNetLog()); |
| 11614 ASSERT_EQ(ERR_IO_PENDING, rv); | 11614 ASSERT_EQ(ERR_IO_PENDING, rv); |
| 11615 | 11615 |
| 11616 // Complete the SSL handshake, which should abort due to requiring a | 11616 // Complete the SSL handshake, which should abort due to requiring a |
| 11617 // client certificate. | 11617 // client certificate. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11690 requests[0].url = GURL("https://www.example.com/"); | 11690 requests[0].url = GURL("https://www.example.com/"); |
| 11691 requests[0].method = "GET"; | 11691 requests[0].method = "GET"; |
| 11692 requests[0].load_flags = LOAD_NORMAL; | 11692 requests[0].load_flags = LOAD_NORMAL; |
| 11693 | 11693 |
| 11694 requests[1].url = GURL("http://www.example.com/"); | 11694 requests[1].url = GURL("http://www.example.com/"); |
| 11695 requests[1].method = "GET"; | 11695 requests[1].method = "GET"; |
| 11696 requests[1].load_flags = LOAD_NORMAL; | 11696 requests[1].load_flags = LOAD_NORMAL; |
| 11697 | 11697 |
| 11698 for (size_t i = 0; i < arraysize(requests); ++i) { | 11698 for (size_t i = 0; i < arraysize(requests); ++i) { |
| 11699 session_deps_.socket_factory->ResetNextMockIndexes(); | 11699 session_deps_.socket_factory->ResetNextMockIndexes(); |
| 11700 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11700 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11701 scoped_ptr<HttpNetworkTransaction> trans( | 11701 scoped_ptr<HttpNetworkTransaction> trans( |
| 11702 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 11702 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 11703 | 11703 |
| 11704 // Begin the SSL handshake with the proxy. | 11704 // Begin the SSL handshake with the proxy. |
| 11705 TestCompletionCallback callback; | 11705 TestCompletionCallback callback; |
| 11706 int rv = trans->Start(&requests[i], callback.callback(), BoundNetLog()); | 11706 int rv = trans->Start(&requests[i], callback.callback(), BoundNetLog()); |
| 11707 ASSERT_EQ(ERR_IO_PENDING, rv); | 11707 ASSERT_EQ(ERR_IO_PENDING, rv); |
| 11708 | 11708 |
| 11709 // Complete the SSL handshake, which should abort due to requiring a | 11709 // Complete the SSL handshake, which should abort due to requiring a |
| 11710 // client certificate. | 11710 // client certificate. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11743 HostPortPair("www.example.com", 443), &client_cert)); | 11743 HostPortPair("www.example.com", 443), &client_cert)); |
| 11744 } | 11744 } |
| 11745 } | 11745 } |
| 11746 | 11746 |
| 11747 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPooling) { | 11747 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPooling) { |
| 11748 session_deps_.use_alternative_services = true; | 11748 session_deps_.use_alternative_services = true; |
| 11749 session_deps_.next_protos = SpdyNextProtos(); | 11749 session_deps_.next_protos = SpdyNextProtos(); |
| 11750 | 11750 |
| 11751 // Set up a special HttpNetworkSession with a MockCachingHostResolver. | 11751 // Set up a special HttpNetworkSession with a MockCachingHostResolver. |
| 11752 session_deps_.host_resolver.reset(new MockCachingHostResolver()); | 11752 session_deps_.host_resolver.reset(new MockCachingHostResolver()); |
| 11753 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11753 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11754 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 11754 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 11755 pool_peer.DisableDomainAuthenticationVerification(); | 11755 pool_peer.DisableDomainAuthenticationVerification(); |
| 11756 | 11756 |
| 11757 SSLSocketDataProvider ssl(ASYNC, OK); | 11757 SSLSocketDataProvider ssl(ASYNC, OK); |
| 11758 ssl.SetNextProto(GetParam()); | 11758 ssl.SetNextProto(GetParam()); |
| 11759 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 11759 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 11760 | 11760 |
| 11761 scoped_ptr<SpdyFrame> host1_req( | 11761 scoped_ptr<SpdyFrame> host1_req( |
| 11762 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); | 11762 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); |
| 11763 scoped_ptr<SpdyFrame> host2_req( | 11763 scoped_ptr<SpdyFrame> host2_req( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11842 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); | 11842 ASSERT_EQ(OK, ReadTransaction(&trans2, &response_data)); |
| 11843 EXPECT_EQ("hello!", response_data); | 11843 EXPECT_EQ("hello!", response_data); |
| 11844 } | 11844 } |
| 11845 | 11845 |
| 11846 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPoolingAfterResolution) { | 11846 TEST_P(HttpNetworkTransactionTest, UseIPConnectionPoolingAfterResolution) { |
| 11847 session_deps_.use_alternative_services = true; | 11847 session_deps_.use_alternative_services = true; |
| 11848 session_deps_.next_protos = SpdyNextProtos(); | 11848 session_deps_.next_protos = SpdyNextProtos(); |
| 11849 | 11849 |
| 11850 // Set up a special HttpNetworkSession with a MockCachingHostResolver. | 11850 // Set up a special HttpNetworkSession with a MockCachingHostResolver. |
| 11851 session_deps_.host_resolver.reset(new MockCachingHostResolver()); | 11851 session_deps_.host_resolver.reset(new MockCachingHostResolver()); |
| 11852 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11852 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11853 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 11853 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 11854 pool_peer.DisableDomainAuthenticationVerification(); | 11854 pool_peer.DisableDomainAuthenticationVerification(); |
| 11855 | 11855 |
| 11856 SSLSocketDataProvider ssl(ASYNC, OK); | 11856 SSLSocketDataProvider ssl(ASYNC, OK); |
| 11857 ssl.SetNextProto(GetParam()); | 11857 ssl.SetNextProto(GetParam()); |
| 11858 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 11858 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 11859 | 11859 |
| 11860 scoped_ptr<SpdyFrame> host1_req( | 11860 scoped_ptr<SpdyFrame> host1_req( |
| 11861 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); | 11861 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); |
| 11862 scoped_ptr<SpdyFrame> host2_req( | 11862 scoped_ptr<SpdyFrame> host2_req( |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11972 TEST_P(HttpNetworkTransactionTest, | 11972 TEST_P(HttpNetworkTransactionTest, |
| 11973 UseIPConnectionPoolingWithHostCacheExpiration) { | 11973 UseIPConnectionPoolingWithHostCacheExpiration) { |
| 11974 session_deps_.use_alternative_services = true; | 11974 session_deps_.use_alternative_services = true; |
| 11975 session_deps_.next_protos = SpdyNextProtos(); | 11975 session_deps_.next_protos = SpdyNextProtos(); |
| 11976 | 11976 |
| 11977 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. | 11977 // Set up a special HttpNetworkSession with a OneTimeCachingHostResolver. |
| 11978 OneTimeCachingHostResolver host_resolver(HostPortPair("www.gmail.com", 443)); | 11978 OneTimeCachingHostResolver host_resolver(HostPortPair("www.gmail.com", 443)); |
| 11979 HttpNetworkSession::Params params = | 11979 HttpNetworkSession::Params params = |
| 11980 SpdySessionDependencies::CreateSessionParams(&session_deps_); | 11980 SpdySessionDependencies::CreateSessionParams(&session_deps_); |
| 11981 params.host_resolver = &host_resolver; | 11981 params.host_resolver = &host_resolver; |
| 11982 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 11982 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 11983 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); | 11983 SpdySessionPoolPeer pool_peer(session->spdy_session_pool()); |
| 11984 pool_peer.DisableDomainAuthenticationVerification(); | 11984 pool_peer.DisableDomainAuthenticationVerification(); |
| 11985 | 11985 |
| 11986 SSLSocketDataProvider ssl(ASYNC, OK); | 11986 SSLSocketDataProvider ssl(ASYNC, OK); |
| 11987 ssl.SetNextProto(GetParam()); | 11987 ssl.SetNextProto(GetParam()); |
| 11988 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 11988 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 11989 | 11989 |
| 11990 scoped_ptr<SpdyFrame> host1_req( | 11990 scoped_ptr<SpdyFrame> host1_req( |
| 11991 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); | 11991 spdy_util_.ConstructSpdyGet("https://www.example.org", false, 1, LOWEST)); |
| 11992 scoped_ptr<SpdyFrame> host2_req( | 11992 scoped_ptr<SpdyFrame> host2_req( |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12112 | 12112 |
| 12113 SequencedSocketData data2(reads2, arraysize(reads2), writes2, | 12113 SequencedSocketData data2(reads2, arraysize(reads2), writes2, |
| 12114 arraysize(writes2)); | 12114 arraysize(writes2)); |
| 12115 | 12115 |
| 12116 SSLSocketDataProvider ssl(ASYNC, OK); | 12116 SSLSocketDataProvider ssl(ASYNC, OK); |
| 12117 ssl.SetNextProto(GetParam()); | 12117 ssl.SetNextProto(GetParam()); |
| 12118 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 12118 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 12119 session_deps_.socket_factory->AddSocketDataProvider(&data1); | 12119 session_deps_.socket_factory->AddSocketDataProvider(&data1); |
| 12120 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 12120 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
| 12121 | 12121 |
| 12122 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12122 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12123 | 12123 |
| 12124 // Start the first transaction to set up the SpdySession | 12124 // Start the first transaction to set up the SpdySession |
| 12125 HttpRequestInfo request1; | 12125 HttpRequestInfo request1; |
| 12126 request1.method = "GET"; | 12126 request1.method = "GET"; |
| 12127 request1.url = GURL(https_url); | 12127 request1.url = GURL(https_url); |
| 12128 request1.load_flags = 0; | 12128 request1.load_flags = 0; |
| 12129 HttpNetworkTransaction trans1(LOWEST, session.get()); | 12129 HttpNetworkTransaction trans1(LOWEST, session.get()); |
| 12130 TestCompletionCallback callback1; | 12130 TestCompletionCallback callback1; |
| 12131 EXPECT_EQ(ERR_IO_PENDING, | 12131 EXPECT_EQ(ERR_IO_PENDING, |
| 12132 trans1.Start(&request1, callback1.callback(), BoundNetLog())); | 12132 trans1.Start(&request1, callback1.callback(), BoundNetLog())); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12224 vector_as_array(&writes), writes.size()); | 12224 vector_as_array(&writes), writes.size()); |
| 12225 session_deps_.socket_factory->AddSocketDataProvider(&data); | 12225 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 12226 | 12226 |
| 12227 // Connection to the origin fails. | 12227 // Connection to the origin fails. |
| 12228 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 12228 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 12229 StaticSocketDataProvider data_refused; | 12229 StaticSocketDataProvider data_refused; |
| 12230 data_refused.set_connect_data(mock_connect); | 12230 data_refused.set_connect_data(mock_connect); |
| 12231 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); | 12231 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); |
| 12232 | 12232 |
| 12233 session_deps_.use_alternative_services = true; | 12233 session_deps_.use_alternative_services = true; |
| 12234 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12234 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12235 base::WeakPtr<HttpServerProperties> http_server_properties = | 12235 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 12236 session->http_server_properties(); | 12236 session->http_server_properties(); |
| 12237 AlternativeService alternative_service( | 12237 AlternativeService alternative_service( |
| 12238 AlternateProtocolFromNextProto(GetParam()), alternative); | 12238 AlternateProtocolFromNextProto(GetParam()), alternative); |
| 12239 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 12239 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 12240 http_server_properties->SetAlternativeService(origin, alternative_service, | 12240 http_server_properties->SetAlternativeService(origin, alternative_service, |
| 12241 1.0, expiration); | 12241 1.0, expiration); |
| 12242 | 12242 |
| 12243 // First request to alternative. | 12243 // First request to alternative. |
| 12244 if (pooling) { | 12244 if (pooling) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12328 | 12328 |
| 12329 // This test documents that an alternate Job should not be used if HTTP/1.1 is | 12329 // This test documents that an alternate Job should not be used if HTTP/1.1 is |
| 12330 // negotiated. In order to test this, a failed connection to the origin is | 12330 // negotiated. In order to test this, a failed connection to the origin is |
| 12331 // mocked. This way the request relies on the alternate Job. | 12331 // mocked. This way the request relies on the alternate Job. |
| 12332 StaticSocketDataProvider data_refused; | 12332 StaticSocketDataProvider data_refused; |
| 12333 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); | 12333 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); |
| 12334 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); | 12334 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); |
| 12335 | 12335 |
| 12336 // Set up alternative service for origin. | 12336 // Set up alternative service for origin. |
| 12337 session_deps_.use_alternative_services = true; | 12337 session_deps_.use_alternative_services = true; |
| 12338 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12338 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12339 base::WeakPtr<HttpServerProperties> http_server_properties = | 12339 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 12340 session->http_server_properties(); | 12340 session->http_server_properties(); |
| 12341 AlternativeService alternative_service( | 12341 AlternativeService alternative_service( |
| 12342 AlternateProtocolFromNextProto(GetParam()), alternative); | 12342 AlternateProtocolFromNextProto(GetParam()), alternative); |
| 12343 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 12343 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 12344 http_server_properties->SetAlternativeService(origin, alternative_service, | 12344 http_server_properties->SetAlternativeService(origin, alternative_service, |
| 12345 1.0, expiration); | 12345 1.0, expiration); |
| 12346 | 12346 |
| 12347 scoped_ptr<HttpTransaction> trans( | 12347 scoped_ptr<HttpTransaction> trans( |
| 12348 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 12348 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12401 MockRead("Content-Type: text/html\r\n"), | 12401 MockRead("Content-Type: text/html\r\n"), |
| 12402 MockRead("Content-Length: 7\r\n\r\n"), | 12402 MockRead("Content-Length: 7\r\n\r\n"), |
| 12403 MockRead("another"), | 12403 MockRead("another"), |
| 12404 }; | 12404 }; |
| 12405 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), | 12405 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), |
| 12406 http_writes, arraysize(http_writes)); | 12406 http_writes, arraysize(http_writes)); |
| 12407 session_deps_.socket_factory->AddSocketDataProvider(&http_data); | 12407 session_deps_.socket_factory->AddSocketDataProvider(&http_data); |
| 12408 | 12408 |
| 12409 // Set up alternative service for origin. | 12409 // Set up alternative service for origin. |
| 12410 session_deps_.use_alternative_services = true; | 12410 session_deps_.use_alternative_services = true; |
| 12411 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12411 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12412 base::WeakPtr<HttpServerProperties> http_server_properties = | 12412 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 12413 session->http_server_properties(); | 12413 session->http_server_properties(); |
| 12414 AlternativeService alternative_service( | 12414 AlternativeService alternative_service( |
| 12415 AlternateProtocolFromNextProto(GetParam()), alternative); | 12415 AlternateProtocolFromNextProto(GetParam()), alternative); |
| 12416 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 12416 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 12417 http_server_properties->SetAlternativeService(origin, alternative_service, | 12417 http_server_properties->SetAlternativeService(origin, alternative_service, |
| 12418 1.0, expiration); | 12418 1.0, expiration); |
| 12419 | 12419 |
| 12420 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get()); | 12420 HttpNetworkTransaction trans1(DEFAULT_PRIORITY, session.get()); |
| 12421 HttpRequestInfo request1; | 12421 HttpRequestInfo request1; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12510 | 12510 |
| 12511 // This test documents that an alternate Job should not pool to an already | 12511 // This test documents that an alternate Job should not pool to an already |
| 12512 // existing HTTP/1.1 connection. In order to test this, a failed connection | 12512 // existing HTTP/1.1 connection. In order to test this, a failed connection |
| 12513 // to the origin is mocked. This way |request2| relies on the alternate Job. | 12513 // to the origin is mocked. This way |request2| relies on the alternate Job. |
| 12514 StaticSocketDataProvider data_refused; | 12514 StaticSocketDataProvider data_refused; |
| 12515 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); | 12515 data_refused.set_connect_data(MockConnect(ASYNC, ERR_CONNECTION_REFUSED)); |
| 12516 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); | 12516 session_deps_.socket_factory->AddSocketDataProvider(&data_refused); |
| 12517 | 12517 |
| 12518 // Set up alternative service for origin. | 12518 // Set up alternative service for origin. |
| 12519 session_deps_.use_alternative_services = true; | 12519 session_deps_.use_alternative_services = true; |
| 12520 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12520 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12521 base::WeakPtr<HttpServerProperties> http_server_properties = | 12521 base::WeakPtr<HttpServerProperties> http_server_properties = |
| 12522 session->http_server_properties(); | 12522 session->http_server_properties(); |
| 12523 AlternativeService alternative_service( | 12523 AlternativeService alternative_service( |
| 12524 AlternateProtocolFromNextProto(GetParam()), alternative); | 12524 AlternateProtocolFromNextProto(GetParam()), alternative); |
| 12525 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 12525 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 12526 http_server_properties->SetAlternativeService(origin, alternative_service, | 12526 http_server_properties->SetAlternativeService(origin, alternative_service, |
| 12527 1.0, expiration); | 12527 1.0, expiration); |
| 12528 | 12528 |
| 12529 // First transaction to alternative to open an HTTP/1.1 socket. | 12529 // First transaction to alternative to open an HTTP/1.1 socket. |
| 12530 scoped_ptr<HttpTransaction> trans1( | 12530 scoped_ptr<HttpTransaction> trans1( |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12644 TestNetLog log; | 12644 TestNetLog log; |
| 12645 session_deps_.net_log = &log; | 12645 session_deps_.net_log = &log; |
| 12646 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy | 12646 SSLSocketDataProvider ssl1(ASYNC, OK); // to the proxy |
| 12647 ssl1.SetNextProto(GetParam()); | 12647 ssl1.SetNextProto(GetParam()); |
| 12648 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); | 12648 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl1); |
| 12649 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server | 12649 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server |
| 12650 ssl2.SetNextProto(GetParam()); | 12650 ssl2.SetNextProto(GetParam()); |
| 12651 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); | 12651 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 12652 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1); | 12652 session_deps_.deterministic_socket_factory->AddSocketDataProvider(&data1); |
| 12653 | 12653 |
| 12654 scoped_refptr<HttpNetworkSession> session( | 12654 scoped_ptr<HttpNetworkSession> session( |
| 12655 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); | 12655 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); |
| 12656 | 12656 |
| 12657 // Start the first transaction to set up the SpdySession | 12657 // Start the first transaction to set up the SpdySession |
| 12658 HttpRequestInfo request1; | 12658 HttpRequestInfo request1; |
| 12659 request1.method = "GET"; | 12659 request1.method = "GET"; |
| 12660 request1.url = GURL(https_url); | 12660 request1.url = GURL(https_url); |
| 12661 request1.load_flags = 0; | 12661 request1.load_flags = 0; |
| 12662 HttpNetworkTransaction trans1(LOWEST, session.get()); | 12662 HttpNetworkTransaction trans1(LOWEST, session.get()); |
| 12663 TestCompletionCallback callback1; | 12663 TestCompletionCallback callback1; |
| 12664 EXPECT_EQ(ERR_IO_PENDING, | 12664 EXPECT_EQ(ERR_IO_PENDING, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12778 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server | 12778 SSLSocketDataProvider ssl2(ASYNC, OK); // to the server |
| 12779 ssl2.SetNextProto(GetParam()); | 12779 ssl2.SetNextProto(GetParam()); |
| 12780 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); | 12780 session_deps_.deterministic_socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 12781 session_deps_.deterministic_socket_factory->AddSocketDataProvider( | 12781 session_deps_.deterministic_socket_factory->AddSocketDataProvider( |
| 12782 data2.get()); | 12782 data2.get()); |
| 12783 | 12783 |
| 12784 session_deps_.host_resolver.reset(new MockCachingHostResolver()); | 12784 session_deps_.host_resolver.reset(new MockCachingHostResolver()); |
| 12785 session_deps_.host_resolver->rules()->AddRule("news.example.org", ip_addr); | 12785 session_deps_.host_resolver->rules()->AddRule("news.example.org", ip_addr); |
| 12786 session_deps_.host_resolver->rules()->AddRule("proxy", ip_addr); | 12786 session_deps_.host_resolver->rules()->AddRule("proxy", ip_addr); |
| 12787 | 12787 |
| 12788 scoped_refptr<HttpNetworkSession> session( | 12788 scoped_ptr<HttpNetworkSession> session( |
| 12789 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); | 12789 SpdySessionDependencies::SpdyCreateSessionDeterministic(&session_deps_)); |
| 12790 | 12790 |
| 12791 // Start the first transaction to set up the SpdySession | 12791 // Start the first transaction to set up the SpdySession |
| 12792 HttpRequestInfo request1; | 12792 HttpRequestInfo request1; |
| 12793 request1.method = "GET"; | 12793 request1.method = "GET"; |
| 12794 request1.url = GURL(url1); | 12794 request1.url = GURL(url1); |
| 12795 request1.load_flags = 0; | 12795 request1.load_flags = 0; |
| 12796 HttpNetworkTransaction trans1(LOWEST, session.get()); | 12796 HttpNetworkTransaction trans1(LOWEST, session.get()); |
| 12797 TestCompletionCallback callback1; | 12797 TestCompletionCallback callback1; |
| 12798 ASSERT_EQ(ERR_IO_PENDING, | 12798 ASSERT_EQ(ERR_IO_PENDING, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12853 SSLSocketDataProvider ssl1(ASYNC, OK); | 12853 SSLSocketDataProvider ssl1(ASYNC, OK); |
| 12854 ssl1.SetNextProto(GetParam()); | 12854 ssl1.SetNextProto(GetParam()); |
| 12855 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); | 12855 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); |
| 12856 session_deps_.socket_factory->AddSocketDataProvider(&data1); | 12856 session_deps_.socket_factory->AddSocketDataProvider(&data1); |
| 12857 | 12857 |
| 12858 SSLSocketDataProvider ssl2(ASYNC, OK); | 12858 SSLSocketDataProvider ssl2(ASYNC, OK); |
| 12859 ssl2.SetNextProto(GetParam()); | 12859 ssl2.SetNextProto(GetParam()); |
| 12860 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); | 12860 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 12861 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 12861 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
| 12862 | 12862 |
| 12863 scoped_refptr<HttpNetworkSession> session( | 12863 scoped_ptr<HttpNetworkSession> session( |
| 12864 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); | 12864 SpdySessionDependencies::SpdyCreateSession(&session_deps_)); |
| 12865 | 12865 |
| 12866 // Start the first transaction to set up the SpdySession and verify that | 12866 // Start the first transaction to set up the SpdySession and verify that |
| 12867 // connection was closed. | 12867 // connection was closed. |
| 12868 HttpRequestInfo request1; | 12868 HttpRequestInfo request1; |
| 12869 request1.method = "GET"; | 12869 request1.method = "GET"; |
| 12870 request1.url = GURL(https_url); | 12870 request1.url = GURL(https_url); |
| 12871 request1.load_flags = 0; | 12871 request1.load_flags = 0; |
| 12872 HttpNetworkTransaction trans1(MEDIUM, session.get()); | 12872 HttpNetworkTransaction trans1(MEDIUM, session.get()); |
| 12873 TestCompletionCallback callback1; | 12873 TestCompletionCallback callback1; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 12892 TEST_P(HttpNetworkTransactionTest, CloseIdleSpdySessionToOpenNewOne) { | 12892 TEST_P(HttpNetworkTransactionTest, CloseIdleSpdySessionToOpenNewOne) { |
| 12893 session_deps_.next_protos = SpdyNextProtos(); | 12893 session_deps_.next_protos = SpdyNextProtos(); |
| 12894 ClientSocketPoolManager::set_max_sockets_per_group( | 12894 ClientSocketPoolManager::set_max_sockets_per_group( |
| 12895 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); | 12895 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); |
| 12896 ClientSocketPoolManager::set_max_sockets_per_pool( | 12896 ClientSocketPoolManager::set_max_sockets_per_pool( |
| 12897 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); | 12897 HttpNetworkSession::NORMAL_SOCKET_POOL, 1); |
| 12898 | 12898 |
| 12899 // Use two different hosts with different IPs so they don't get pooled. | 12899 // Use two different hosts with different IPs so they don't get pooled. |
| 12900 session_deps_.host_resolver->rules()->AddRule("www.a.com", "10.0.0.1"); | 12900 session_deps_.host_resolver->rules()->AddRule("www.a.com", "10.0.0.1"); |
| 12901 session_deps_.host_resolver->rules()->AddRule("www.b.com", "10.0.0.2"); | 12901 session_deps_.host_resolver->rules()->AddRule("www.b.com", "10.0.0.2"); |
| 12902 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 12902 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 12903 | 12903 |
| 12904 SSLSocketDataProvider ssl1(ASYNC, OK); | 12904 SSLSocketDataProvider ssl1(ASYNC, OK); |
| 12905 ssl1.SetNextProto(GetParam()); | 12905 ssl1.SetNextProto(GetParam()); |
| 12906 SSLSocketDataProvider ssl2(ASYNC, OK); | 12906 SSLSocketDataProvider ssl2(ASYNC, OK); |
| 12907 ssl2.SetNextProto(GetParam()); | 12907 ssl2.SetNextProto(GetParam()); |
| 12908 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); | 12908 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl1); |
| 12909 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); | 12909 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl2); |
| 12910 | 12910 |
| 12911 scoped_ptr<SpdyFrame> host1_req(spdy_util_.ConstructSpdyGet( | 12911 scoped_ptr<SpdyFrame> host1_req(spdy_util_.ConstructSpdyGet( |
| 12912 "https://www.a.com", false, 1, DEFAULT_PRIORITY)); | 12912 "https://www.a.com", false, 1, DEFAULT_PRIORITY)); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13052 EXPECT_FALSE( | 13052 EXPECT_FALSE( |
| 13053 HasSpdySession(session->spdy_session_pool(), spdy_session_key_b)); | 13053 HasSpdySession(session->spdy_session_pool(), spdy_session_key_b)); |
| 13054 } | 13054 } |
| 13055 | 13055 |
| 13056 TEST_P(HttpNetworkTransactionTest, HttpSyncConnectError) { | 13056 TEST_P(HttpNetworkTransactionTest, HttpSyncConnectError) { |
| 13057 HttpRequestInfo request; | 13057 HttpRequestInfo request; |
| 13058 request.method = "GET"; | 13058 request.method = "GET"; |
| 13059 request.url = GURL("http://www.example.org/"); | 13059 request.url = GURL("http://www.example.org/"); |
| 13060 request.load_flags = 0; | 13060 request.load_flags = 0; |
| 13061 | 13061 |
| 13062 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13062 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13063 scoped_ptr<HttpTransaction> trans( | 13063 scoped_ptr<HttpTransaction> trans( |
| 13064 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13064 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13065 | 13065 |
| 13066 MockConnect mock_connect(SYNCHRONOUS, ERR_CONNECTION_REFUSED); | 13066 MockConnect mock_connect(SYNCHRONOUS, ERR_CONNECTION_REFUSED); |
| 13067 StaticSocketDataProvider data; | 13067 StaticSocketDataProvider data; |
| 13068 data.set_connect_data(mock_connect); | 13068 data.set_connect_data(mock_connect); |
| 13069 session_deps_.socket_factory->AddSocketDataProvider(&data); | 13069 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 13070 | 13070 |
| 13071 TestCompletionCallback callback; | 13071 TestCompletionCallback callback; |
| 13072 | 13072 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 13085 ASSERT_EQ(1u, attempts.size()); | 13085 ASSERT_EQ(1u, attempts.size()); |
| 13086 EXPECT_EQ(ERR_CONNECTION_REFUSED, attempts[0].result); | 13086 EXPECT_EQ(ERR_CONNECTION_REFUSED, attempts[0].result); |
| 13087 } | 13087 } |
| 13088 | 13088 |
| 13089 TEST_P(HttpNetworkTransactionTest, HttpAsyncConnectError) { | 13089 TEST_P(HttpNetworkTransactionTest, HttpAsyncConnectError) { |
| 13090 HttpRequestInfo request; | 13090 HttpRequestInfo request; |
| 13091 request.method = "GET"; | 13091 request.method = "GET"; |
| 13092 request.url = GURL("http://www.example.org/"); | 13092 request.url = GURL("http://www.example.org/"); |
| 13093 request.load_flags = 0; | 13093 request.load_flags = 0; |
| 13094 | 13094 |
| 13095 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13095 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13096 scoped_ptr<HttpTransaction> trans( | 13096 scoped_ptr<HttpTransaction> trans( |
| 13097 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13097 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13098 | 13098 |
| 13099 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); | 13099 MockConnect mock_connect(ASYNC, ERR_CONNECTION_REFUSED); |
| 13100 StaticSocketDataProvider data; | 13100 StaticSocketDataProvider data; |
| 13101 data.set_connect_data(mock_connect); | 13101 data.set_connect_data(mock_connect); |
| 13102 session_deps_.socket_factory->AddSocketDataProvider(&data); | 13102 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 13103 | 13103 |
| 13104 TestCompletionCallback callback; | 13104 TestCompletionCallback callback; |
| 13105 | 13105 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 13118 ASSERT_EQ(1u, attempts.size()); | 13118 ASSERT_EQ(1u, attempts.size()); |
| 13119 EXPECT_EQ(ERR_CONNECTION_REFUSED, attempts[0].result); | 13119 EXPECT_EQ(ERR_CONNECTION_REFUSED, attempts[0].result); |
| 13120 } | 13120 } |
| 13121 | 13121 |
| 13122 TEST_P(HttpNetworkTransactionTest, HttpSyncWriteError) { | 13122 TEST_P(HttpNetworkTransactionTest, HttpSyncWriteError) { |
| 13123 HttpRequestInfo request; | 13123 HttpRequestInfo request; |
| 13124 request.method = "GET"; | 13124 request.method = "GET"; |
| 13125 request.url = GURL("http://www.example.org/"); | 13125 request.url = GURL("http://www.example.org/"); |
| 13126 request.load_flags = 0; | 13126 request.load_flags = 0; |
| 13127 | 13127 |
| 13128 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13128 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13129 scoped_ptr<HttpTransaction> trans( | 13129 scoped_ptr<HttpTransaction> trans( |
| 13130 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13130 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13131 | 13131 |
| 13132 MockWrite data_writes[] = { | 13132 MockWrite data_writes[] = { |
| 13133 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 13133 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 13134 }; | 13134 }; |
| 13135 MockRead data_reads[] = { | 13135 MockRead data_reads[] = { |
| 13136 MockRead(SYNCHRONOUS, ERR_UNEXPECTED), // Should not be reached. | 13136 MockRead(SYNCHRONOUS, ERR_UNEXPECTED), // Should not be reached. |
| 13137 }; | 13137 }; |
| 13138 | 13138 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 13152 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); | 13152 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); |
| 13153 EXPECT_TRUE(request_headers.HasHeader("Host")); | 13153 EXPECT_TRUE(request_headers.HasHeader("Host")); |
| 13154 } | 13154 } |
| 13155 | 13155 |
| 13156 TEST_P(HttpNetworkTransactionTest, HttpAsyncWriteError) { | 13156 TEST_P(HttpNetworkTransactionTest, HttpAsyncWriteError) { |
| 13157 HttpRequestInfo request; | 13157 HttpRequestInfo request; |
| 13158 request.method = "GET"; | 13158 request.method = "GET"; |
| 13159 request.url = GURL("http://www.example.org/"); | 13159 request.url = GURL("http://www.example.org/"); |
| 13160 request.load_flags = 0; | 13160 request.load_flags = 0; |
| 13161 | 13161 |
| 13162 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13162 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13163 scoped_ptr<HttpTransaction> trans( | 13163 scoped_ptr<HttpTransaction> trans( |
| 13164 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13164 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13165 | 13165 |
| 13166 MockWrite data_writes[] = { | 13166 MockWrite data_writes[] = { |
| 13167 MockWrite(ASYNC, ERR_CONNECTION_RESET), | 13167 MockWrite(ASYNC, ERR_CONNECTION_RESET), |
| 13168 }; | 13168 }; |
| 13169 MockRead data_reads[] = { | 13169 MockRead data_reads[] = { |
| 13170 MockRead(SYNCHRONOUS, ERR_UNEXPECTED), // Should not be reached. | 13170 MockRead(SYNCHRONOUS, ERR_UNEXPECTED), // Should not be reached. |
| 13171 }; | 13171 }; |
| 13172 | 13172 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 13186 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); | 13186 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); |
| 13187 EXPECT_TRUE(request_headers.HasHeader("Host")); | 13187 EXPECT_TRUE(request_headers.HasHeader("Host")); |
| 13188 } | 13188 } |
| 13189 | 13189 |
| 13190 TEST_P(HttpNetworkTransactionTest, HttpSyncReadError) { | 13190 TEST_P(HttpNetworkTransactionTest, HttpSyncReadError) { |
| 13191 HttpRequestInfo request; | 13191 HttpRequestInfo request; |
| 13192 request.method = "GET"; | 13192 request.method = "GET"; |
| 13193 request.url = GURL("http://www.example.org/"); | 13193 request.url = GURL("http://www.example.org/"); |
| 13194 request.load_flags = 0; | 13194 request.load_flags = 0; |
| 13195 | 13195 |
| 13196 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13196 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13197 scoped_ptr<HttpTransaction> trans( | 13197 scoped_ptr<HttpTransaction> trans( |
| 13198 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13198 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13199 | 13199 |
| 13200 MockWrite data_writes[] = { | 13200 MockWrite data_writes[] = { |
| 13201 MockWrite( | 13201 MockWrite( |
| 13202 "GET / HTTP/1.1\r\n" | 13202 "GET / HTTP/1.1\r\n" |
| 13203 "Host: www.example.org\r\n" | 13203 "Host: www.example.org\r\n" |
| 13204 "Connection: keep-alive\r\n\r\n"), | 13204 "Connection: keep-alive\r\n\r\n"), |
| 13205 }; | 13205 }; |
| 13206 MockRead data_reads[] = { | 13206 MockRead data_reads[] = { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 13223 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); | 13223 EXPECT_TRUE(trans->GetFullRequestHeaders(&request_headers)); |
| 13224 EXPECT_TRUE(request_headers.HasHeader("Host")); | 13224 EXPECT_TRUE(request_headers.HasHeader("Host")); |
| 13225 } | 13225 } |
| 13226 | 13226 |
| 13227 TEST_P(HttpNetworkTransactionTest, HttpAsyncReadError) { | 13227 TEST_P(HttpNetworkTransactionTest, HttpAsyncReadError) { |
| 13228 HttpRequestInfo request; | 13228 HttpRequestInfo request; |
| 13229 request.method = "GET"; | 13229 request.method = "GET"; |
| 13230 request.url = GURL("http://www.example.org/"); | 13230 request.url = GURL("http://www.example.org/"); |
| 13231 request.load_flags = 0; | 13231 request.load_flags = 0; |
| 13232 | 13232 |
| 13233 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13233 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13234 scoped_ptr<HttpTransaction> trans( | 13234 scoped_ptr<HttpTransaction> trans( |
| 13235 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13235 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13236 | 13236 |
| 13237 MockWrite data_writes[] = { | 13237 MockWrite data_writes[] = { |
| 13238 MockWrite( | 13238 MockWrite( |
| 13239 "GET / HTTP/1.1\r\n" | 13239 "GET / HTTP/1.1\r\n" |
| 13240 "Host: www.example.org\r\n" | 13240 "Host: www.example.org\r\n" |
| 13241 "Connection: keep-alive\r\n\r\n"), | 13241 "Connection: keep-alive\r\n\r\n"), |
| 13242 }; | 13242 }; |
| 13243 MockRead data_reads[] = { | 13243 MockRead data_reads[] = { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 13261 EXPECT_TRUE(request_headers.HasHeader("Host")); | 13261 EXPECT_TRUE(request_headers.HasHeader("Host")); |
| 13262 } | 13262 } |
| 13263 | 13263 |
| 13264 TEST_P(HttpNetworkTransactionTest, GetFullRequestHeadersIncludesExtraHeader) { | 13264 TEST_P(HttpNetworkTransactionTest, GetFullRequestHeadersIncludesExtraHeader) { |
| 13265 HttpRequestInfo request; | 13265 HttpRequestInfo request; |
| 13266 request.method = "GET"; | 13266 request.method = "GET"; |
| 13267 request.url = GURL("http://www.example.org/"); | 13267 request.url = GURL("http://www.example.org/"); |
| 13268 request.load_flags = 0; | 13268 request.load_flags = 0; |
| 13269 request.extra_headers.SetHeader("X-Foo", "bar"); | 13269 request.extra_headers.SetHeader("X-Foo", "bar"); |
| 13270 | 13270 |
| 13271 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13271 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13272 scoped_ptr<HttpTransaction> trans( | 13272 scoped_ptr<HttpTransaction> trans( |
| 13273 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13273 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13274 | 13274 |
| 13275 MockWrite data_writes[] = { | 13275 MockWrite data_writes[] = { |
| 13276 MockWrite( | 13276 MockWrite( |
| 13277 "GET / HTTP/1.1\r\n" | 13277 "GET / HTTP/1.1\r\n" |
| 13278 "Host: www.example.org\r\n" | 13278 "Host: www.example.org\r\n" |
| 13279 "Connection: keep-alive\r\n" | 13279 "Connection: keep-alive\r\n" |
| 13280 "X-Foo: bar\r\n\r\n"), | 13280 "X-Foo: bar\r\n\r\n"), |
| 13281 }; | 13281 }; |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13659 NOTREACHED(); | 13659 NOTREACHED(); |
| 13660 return scoped_ptr<WebSocketStream>(); | 13660 return scoped_ptr<WebSocketStream>(); |
| 13661 } | 13661 } |
| 13662 }; | 13662 }; |
| 13663 | 13663 |
| 13664 } // namespace | 13664 } // namespace |
| 13665 | 13665 |
| 13666 // Make sure that HttpNetworkTransaction passes on its priority to its | 13666 // Make sure that HttpNetworkTransaction passes on its priority to its |
| 13667 // stream request on start. | 13667 // stream request on start. |
| 13668 TEST_P(HttpNetworkTransactionTest, SetStreamRequestPriorityOnStart) { | 13668 TEST_P(HttpNetworkTransactionTest, SetStreamRequestPriorityOnStart) { |
| 13669 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13669 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13670 HttpNetworkSessionPeer peer(session); | 13670 HttpNetworkSessionPeer peer(session.get()); |
| 13671 FakeStreamFactory* fake_factory = new FakeStreamFactory(); | 13671 FakeStreamFactory* fake_factory = new FakeStreamFactory(); |
| 13672 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); | 13672 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); |
| 13673 | 13673 |
| 13674 HttpNetworkTransaction trans(LOW, session.get()); | 13674 HttpNetworkTransaction trans(LOW, session.get()); |
| 13675 | 13675 |
| 13676 ASSERT_TRUE(fake_factory->last_stream_request() == NULL); | 13676 ASSERT_TRUE(fake_factory->last_stream_request() == NULL); |
| 13677 | 13677 |
| 13678 HttpRequestInfo request; | 13678 HttpRequestInfo request; |
| 13679 TestCompletionCallback callback; | 13679 TestCompletionCallback callback; |
| 13680 EXPECT_EQ(ERR_IO_PENDING, | 13680 EXPECT_EQ(ERR_IO_PENDING, |
| 13681 trans.Start(&request, callback.callback(), BoundNetLog())); | 13681 trans.Start(&request, callback.callback(), BoundNetLog())); |
| 13682 | 13682 |
| 13683 base::WeakPtr<FakeStreamRequest> fake_request = | 13683 base::WeakPtr<FakeStreamRequest> fake_request = |
| 13684 fake_factory->last_stream_request(); | 13684 fake_factory->last_stream_request(); |
| 13685 ASSERT_TRUE(fake_request != NULL); | 13685 ASSERT_TRUE(fake_request != NULL); |
| 13686 EXPECT_EQ(LOW, fake_request->priority()); | 13686 EXPECT_EQ(LOW, fake_request->priority()); |
| 13687 } | 13687 } |
| 13688 | 13688 |
| 13689 // Make sure that HttpNetworkTransaction passes on its priority | 13689 // Make sure that HttpNetworkTransaction passes on its priority |
| 13690 // updates to its stream request. | 13690 // updates to its stream request. |
| 13691 TEST_P(HttpNetworkTransactionTest, SetStreamRequestPriority) { | 13691 TEST_P(HttpNetworkTransactionTest, SetStreamRequestPriority) { |
| 13692 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13692 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13693 HttpNetworkSessionPeer peer(session); | 13693 HttpNetworkSessionPeer peer(session.get()); |
| 13694 FakeStreamFactory* fake_factory = new FakeStreamFactory(); | 13694 FakeStreamFactory* fake_factory = new FakeStreamFactory(); |
| 13695 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); | 13695 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); |
| 13696 | 13696 |
| 13697 HttpNetworkTransaction trans(LOW, session.get()); | 13697 HttpNetworkTransaction trans(LOW, session.get()); |
| 13698 | 13698 |
| 13699 HttpRequestInfo request; | 13699 HttpRequestInfo request; |
| 13700 TestCompletionCallback callback; | 13700 TestCompletionCallback callback; |
| 13701 EXPECT_EQ(ERR_IO_PENDING, | 13701 EXPECT_EQ(ERR_IO_PENDING, |
| 13702 trans.Start(&request, callback.callback(), BoundNetLog())); | 13702 trans.Start(&request, callback.callback(), BoundNetLog())); |
| 13703 | 13703 |
| 13704 base::WeakPtr<FakeStreamRequest> fake_request = | 13704 base::WeakPtr<FakeStreamRequest> fake_request = |
| 13705 fake_factory->last_stream_request(); | 13705 fake_factory->last_stream_request(); |
| 13706 ASSERT_TRUE(fake_request != NULL); | 13706 ASSERT_TRUE(fake_request != NULL); |
| 13707 EXPECT_EQ(LOW, fake_request->priority()); | 13707 EXPECT_EQ(LOW, fake_request->priority()); |
| 13708 | 13708 |
| 13709 trans.SetPriority(LOWEST); | 13709 trans.SetPriority(LOWEST); |
| 13710 ASSERT_TRUE(fake_request != NULL); | 13710 ASSERT_TRUE(fake_request != NULL); |
| 13711 EXPECT_EQ(LOWEST, fake_request->priority()); | 13711 EXPECT_EQ(LOWEST, fake_request->priority()); |
| 13712 } | 13712 } |
| 13713 | 13713 |
| 13714 // Make sure that HttpNetworkTransaction passes on its priority | 13714 // Make sure that HttpNetworkTransaction passes on its priority |
| 13715 // updates to its stream. | 13715 // updates to its stream. |
| 13716 TEST_P(HttpNetworkTransactionTest, SetStreamPriority) { | 13716 TEST_P(HttpNetworkTransactionTest, SetStreamPriority) { |
| 13717 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13717 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13718 HttpNetworkSessionPeer peer(session); | 13718 HttpNetworkSessionPeer peer(session.get()); |
| 13719 FakeStreamFactory* fake_factory = new FakeStreamFactory(); | 13719 FakeStreamFactory* fake_factory = new FakeStreamFactory(); |
| 13720 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); | 13720 peer.SetHttpStreamFactory(scoped_ptr<HttpStreamFactory>(fake_factory)); |
| 13721 | 13721 |
| 13722 HttpNetworkTransaction trans(LOW, session.get()); | 13722 HttpNetworkTransaction trans(LOW, session.get()); |
| 13723 | 13723 |
| 13724 HttpRequestInfo request; | 13724 HttpRequestInfo request; |
| 13725 TestCompletionCallback callback; | 13725 TestCompletionCallback callback; |
| 13726 EXPECT_EQ(ERR_IO_PENDING, | 13726 EXPECT_EQ(ERR_IO_PENDING, |
| 13727 trans.Start(&request, callback.callback(), BoundNetLog())); | 13727 trans.Start(&request, callback.callback(), BoundNetLog())); |
| 13728 | 13728 |
| 13729 base::WeakPtr<FakeStreamRequest> fake_request = | 13729 base::WeakPtr<FakeStreamRequest> fake_request = |
| 13730 fake_factory->last_stream_request(); | 13730 fake_factory->last_stream_request(); |
| 13731 ASSERT_TRUE(fake_request != NULL); | 13731 ASSERT_TRUE(fake_request != NULL); |
| 13732 base::WeakPtr<FakeStream> fake_stream = fake_request->FinishStreamRequest(); | 13732 base::WeakPtr<FakeStream> fake_stream = fake_request->FinishStreamRequest(); |
| 13733 ASSERT_TRUE(fake_stream != NULL); | 13733 ASSERT_TRUE(fake_stream != NULL); |
| 13734 EXPECT_EQ(LOW, fake_stream->priority()); | 13734 EXPECT_EQ(LOW, fake_stream->priority()); |
| 13735 | 13735 |
| 13736 trans.SetPriority(LOWEST); | 13736 trans.SetPriority(LOWEST); |
| 13737 EXPECT_EQ(LOWEST, fake_stream->priority()); | 13737 EXPECT_EQ(LOWEST, fake_stream->priority()); |
| 13738 } | 13738 } |
| 13739 | 13739 |
| 13740 TEST_P(HttpNetworkTransactionTest, CreateWebSocketHandshakeStream) { | 13740 TEST_P(HttpNetworkTransactionTest, CreateWebSocketHandshakeStream) { |
| 13741 // The same logic needs to be tested for both ws: and wss: schemes, but this | 13741 // The same logic needs to be tested for both ws: and wss: schemes, but this |
| 13742 // test is already parameterised on NextProto, so it uses a loop to verify | 13742 // test is already parameterised on NextProto, so it uses a loop to verify |
| 13743 // that the different schemes work. | 13743 // that the different schemes work. |
| 13744 std::string test_cases[] = {"ws://www.example.org/", | 13744 std::string test_cases[] = {"ws://www.example.org/", |
| 13745 "wss://www.example.org/"}; | 13745 "wss://www.example.org/"}; |
| 13746 for (size_t i = 0; i < arraysize(test_cases); ++i) { | 13746 for (size_t i = 0; i < arraysize(test_cases); ++i) { |
| 13747 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13747 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13748 HttpNetworkSessionPeer peer(session); | 13748 HttpNetworkSessionPeer peer(session.get()); |
| 13749 FakeStreamFactory* fake_factory = new FakeStreamFactory(); | 13749 FakeStreamFactory* fake_factory = new FakeStreamFactory(); |
| 13750 FakeWebSocketStreamCreateHelper websocket_stream_create_helper; | 13750 FakeWebSocketStreamCreateHelper websocket_stream_create_helper; |
| 13751 peer.SetHttpStreamFactoryForWebSocket( | 13751 peer.SetHttpStreamFactoryForWebSocket( |
| 13752 scoped_ptr<HttpStreamFactory>(fake_factory)); | 13752 scoped_ptr<HttpStreamFactory>(fake_factory)); |
| 13753 | 13753 |
| 13754 HttpNetworkTransaction trans(LOW, session.get()); | 13754 HttpNetworkTransaction trans(LOW, session.get()); |
| 13755 trans.SetWebSocketHandshakeStreamCreateHelper( | 13755 trans.SetWebSocketHandshakeStreamCreateHelper( |
| 13756 &websocket_stream_create_helper); | 13756 &websocket_stream_create_helper); |
| 13757 | 13757 |
| 13758 HttpRequestInfo request; | 13758 HttpRequestInfo request; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13819 MockRead http_reads[] = { | 13819 MockRead http_reads[] = { |
| 13820 MockRead("HTTP/1.1 200 OK\r\n"), | 13820 MockRead("HTTP/1.1 200 OK\r\n"), |
| 13821 MockRead("Content-Length: 7\r\n\r\n"), | 13821 MockRead("Content-Length: 7\r\n\r\n"), |
| 13822 MockRead("falafel"), | 13822 MockRead("falafel"), |
| 13823 MockRead(SYNCHRONOUS, OK), | 13823 MockRead(SYNCHRONOUS, OK), |
| 13824 }; | 13824 }; |
| 13825 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), | 13825 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), |
| 13826 http_writes, arraysize(http_writes)); | 13826 http_writes, arraysize(http_writes)); |
| 13827 session_deps_.socket_factory->AddSocketDataProvider(&http_data); | 13827 session_deps_.socket_factory->AddSocketDataProvider(&http_data); |
| 13828 | 13828 |
| 13829 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13829 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13830 | 13830 |
| 13831 // Start the SSL request. | 13831 // Start the SSL request. |
| 13832 TestCompletionCallback ssl_callback; | 13832 TestCompletionCallback ssl_callback; |
| 13833 scoped_ptr<HttpTransaction> ssl_trans( | 13833 scoped_ptr<HttpTransaction> ssl_trans( |
| 13834 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13834 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13835 ASSERT_EQ(ERR_IO_PENDING, | 13835 ASSERT_EQ(ERR_IO_PENDING, |
| 13836 ssl_trans->Start(&ssl_request, ssl_callback.callback(), | 13836 ssl_trans->Start(&ssl_request, ssl_callback.callback(), |
| 13837 BoundNetLog())); | 13837 BoundNetLog())); |
| 13838 | 13838 |
| 13839 // Start the HTTP request. Pool should stall. | 13839 // Start the HTTP request. Pool should stall. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13901 MockRead http_reads[] = { | 13901 MockRead http_reads[] = { |
| 13902 MockRead("HTTP/1.1 200 OK\r\n"), | 13902 MockRead("HTTP/1.1 200 OK\r\n"), |
| 13903 MockRead("Content-Length: 7\r\n\r\n"), | 13903 MockRead("Content-Length: 7\r\n\r\n"), |
| 13904 MockRead("falafel"), | 13904 MockRead("falafel"), |
| 13905 MockRead(SYNCHRONOUS, OK), | 13905 MockRead(SYNCHRONOUS, OK), |
| 13906 }; | 13906 }; |
| 13907 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), | 13907 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), |
| 13908 http_writes, arraysize(http_writes)); | 13908 http_writes, arraysize(http_writes)); |
| 13909 session_deps_.socket_factory->AddSocketDataProvider(&http_data); | 13909 session_deps_.socket_factory->AddSocketDataProvider(&http_data); |
| 13910 | 13910 |
| 13911 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13911 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13912 | 13912 |
| 13913 // Preconnect an SSL socket. A preconnect is needed because connect jobs are | 13913 // Preconnect an SSL socket. A preconnect is needed because connect jobs are |
| 13914 // cancelled when a normal transaction is cancelled. | 13914 // cancelled when a normal transaction is cancelled. |
| 13915 HttpStreamFactory* http_stream_factory = session->http_stream_factory(); | 13915 HttpStreamFactory* http_stream_factory = session->http_stream_factory(); |
| 13916 SSLConfig ssl_config; | 13916 SSLConfig ssl_config; |
| 13917 session->ssl_config_service()->GetSSLConfig(&ssl_config); | 13917 session->ssl_config_service()->GetSSLConfig(&ssl_config); |
| 13918 http_stream_factory->PreconnectStreams(1, ssl_request, ssl_config, | 13918 http_stream_factory->PreconnectStreams(1, ssl_request, ssl_config, |
| 13919 ssl_config); | 13919 ssl_config); |
| 13920 EXPECT_EQ(0, GetIdleSocketCountInSSLSocketPool(session.get())); | 13920 EXPECT_EQ(0, GetIdleSocketCountInSSLSocketPool(session.get())); |
| 13921 | 13921 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 13942 ScopedVector<UploadElementReader> element_readers; | 13942 ScopedVector<UploadElementReader> element_readers; |
| 13943 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 13943 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 13944 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 13944 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 13945 | 13945 |
| 13946 HttpRequestInfo request; | 13946 HttpRequestInfo request; |
| 13947 request.method = "POST"; | 13947 request.method = "POST"; |
| 13948 request.url = GURL("http://www.foo.com/"); | 13948 request.url = GURL("http://www.foo.com/"); |
| 13949 request.upload_data_stream = &upload_data_stream; | 13949 request.upload_data_stream = &upload_data_stream; |
| 13950 request.load_flags = 0; | 13950 request.load_flags = 0; |
| 13951 | 13951 |
| 13952 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13952 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13953 scoped_ptr<HttpTransaction> trans( | 13953 scoped_ptr<HttpTransaction> trans( |
| 13954 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 13954 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 13955 // Send headers successfully, but get an error while sending the body. | 13955 // Send headers successfully, but get an error while sending the body. |
| 13956 MockWrite data_writes[] = { | 13956 MockWrite data_writes[] = { |
| 13957 MockWrite("POST / HTTP/1.1\r\n" | 13957 MockWrite("POST / HTTP/1.1\r\n" |
| 13958 "Host: www.foo.com\r\n" | 13958 "Host: www.foo.com\r\n" |
| 13959 "Connection: keep-alive\r\n" | 13959 "Connection: keep-alive\r\n" |
| 13960 "Content-Length: 3\r\n\r\n"), | 13960 "Content-Length: 3\r\n\r\n"), |
| 13961 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 13961 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 13962 }; | 13962 }; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 13987 std::string response_data; | 13987 std::string response_data; |
| 13988 rv = ReadTransaction(trans.get(), &response_data); | 13988 rv = ReadTransaction(trans.get(), &response_data); |
| 13989 EXPECT_EQ(OK, rv); | 13989 EXPECT_EQ(OK, rv); |
| 13990 EXPECT_EQ("hello world", response_data); | 13990 EXPECT_EQ("hello world", response_data); |
| 13991 } | 13991 } |
| 13992 | 13992 |
| 13993 // This test makes sure the retry logic doesn't trigger when reading an error | 13993 // This test makes sure the retry logic doesn't trigger when reading an error |
| 13994 // response from a server that rejected a POST with a CONNECTION_RESET. | 13994 // response from a server that rejected a POST with a CONNECTION_RESET. |
| 13995 TEST_P(HttpNetworkTransactionTest, | 13995 TEST_P(HttpNetworkTransactionTest, |
| 13996 PostReadsErrorResponseAfterResetOnReusedSocket) { | 13996 PostReadsErrorResponseAfterResetOnReusedSocket) { |
| 13997 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 13997 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 13998 MockWrite data_writes[] = { | 13998 MockWrite data_writes[] = { |
| 13999 MockWrite("GET / HTTP/1.1\r\n" | 13999 MockWrite("GET / HTTP/1.1\r\n" |
| 14000 "Host: www.foo.com\r\n" | 14000 "Host: www.foo.com\r\n" |
| 14001 "Connection: keep-alive\r\n\r\n"), | 14001 "Connection: keep-alive\r\n\r\n"), |
| 14002 MockWrite("POST / HTTP/1.1\r\n" | 14002 MockWrite("POST / HTTP/1.1\r\n" |
| 14003 "Host: www.foo.com\r\n" | 14003 "Host: www.foo.com\r\n" |
| 14004 "Connection: keep-alive\r\n" | 14004 "Connection: keep-alive\r\n" |
| 14005 "Content-Length: 3\r\n\r\n"), | 14005 "Content-Length: 3\r\n\r\n"), |
| 14006 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14006 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14007 }; | 14007 }; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14081 ScopedVector<UploadElementReader> element_readers; | 14081 ScopedVector<UploadElementReader> element_readers; |
| 14082 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14082 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14083 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14083 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14084 | 14084 |
| 14085 HttpRequestInfo request; | 14085 HttpRequestInfo request; |
| 14086 request.method = "POST"; | 14086 request.method = "POST"; |
| 14087 request.url = GURL("http://www.foo.com/"); | 14087 request.url = GURL("http://www.foo.com/"); |
| 14088 request.upload_data_stream = &upload_data_stream; | 14088 request.upload_data_stream = &upload_data_stream; |
| 14089 request.load_flags = 0; | 14089 request.load_flags = 0; |
| 14090 | 14090 |
| 14091 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14091 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14092 scoped_ptr<HttpTransaction> trans( | 14092 scoped_ptr<HttpTransaction> trans( |
| 14093 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14093 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14094 // Send headers successfully, but get an error while sending the body. | 14094 // Send headers successfully, but get an error while sending the body. |
| 14095 MockWrite data_writes[] = { | 14095 MockWrite data_writes[] = { |
| 14096 MockWrite("POST / HTTP/1.1\r\n" | 14096 MockWrite("POST / HTTP/1.1\r\n" |
| 14097 "Host: www.foo.com\r\n" | 14097 "Host: www.foo.com\r\n" |
| 14098 "Connection: keep-alive\r\n" | 14098 "Connection: keep-alive\r\n" |
| 14099 "Content-Length: 3\r\n\r\n" | 14099 "Content-Length: 3\r\n\r\n" |
| 14100 "fo"), | 14100 "fo"), |
| 14101 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14101 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14136 ScopedVector<UploadElementReader> element_readers; | 14136 ScopedVector<UploadElementReader> element_readers; |
| 14137 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14137 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14138 ChunkedUploadDataStream upload_data_stream(0); | 14138 ChunkedUploadDataStream upload_data_stream(0); |
| 14139 | 14139 |
| 14140 HttpRequestInfo request; | 14140 HttpRequestInfo request; |
| 14141 request.method = "POST"; | 14141 request.method = "POST"; |
| 14142 request.url = GURL("http://www.foo.com/"); | 14142 request.url = GURL("http://www.foo.com/"); |
| 14143 request.upload_data_stream = &upload_data_stream; | 14143 request.upload_data_stream = &upload_data_stream; |
| 14144 request.load_flags = 0; | 14144 request.load_flags = 0; |
| 14145 | 14145 |
| 14146 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14146 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14147 scoped_ptr<HttpTransaction> trans( | 14147 scoped_ptr<HttpTransaction> trans( |
| 14148 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14148 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14149 // Send headers successfully, but get an error while sending the body. | 14149 // Send headers successfully, but get an error while sending the body. |
| 14150 MockWrite data_writes[] = { | 14150 MockWrite data_writes[] = { |
| 14151 MockWrite("POST / HTTP/1.1\r\n" | 14151 MockWrite("POST / HTTP/1.1\r\n" |
| 14152 "Host: www.foo.com\r\n" | 14152 "Host: www.foo.com\r\n" |
| 14153 "Connection: keep-alive\r\n" | 14153 "Connection: keep-alive\r\n" |
| 14154 "Transfer-Encoding: chunked\r\n\r\n"), | 14154 "Transfer-Encoding: chunked\r\n\r\n"), |
| 14155 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14155 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14156 }; | 14156 }; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14195 ScopedVector<UploadElementReader> element_readers; | 14195 ScopedVector<UploadElementReader> element_readers; |
| 14196 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14196 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14197 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14197 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14198 | 14198 |
| 14199 HttpRequestInfo request; | 14199 HttpRequestInfo request; |
| 14200 request.method = "POST"; | 14200 request.method = "POST"; |
| 14201 request.url = GURL("http://www.foo.com/"); | 14201 request.url = GURL("http://www.foo.com/"); |
| 14202 request.upload_data_stream = &upload_data_stream; | 14202 request.upload_data_stream = &upload_data_stream; |
| 14203 request.load_flags = 0; | 14203 request.load_flags = 0; |
| 14204 | 14204 |
| 14205 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14205 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14206 scoped_ptr<HttpTransaction> trans( | 14206 scoped_ptr<HttpTransaction> trans( |
| 14207 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14207 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14208 | 14208 |
| 14209 MockWrite data_writes[] = { | 14209 MockWrite data_writes[] = { |
| 14210 MockWrite("POST / HTTP/1.1\r\n" | 14210 MockWrite("POST / HTTP/1.1\r\n" |
| 14211 "Host: www.foo.com\r\n" | 14211 "Host: www.foo.com\r\n" |
| 14212 "Connection: keep-alive\r\n" | 14212 "Connection: keep-alive\r\n" |
| 14213 "Content-Length: 3\r\n\r\n"), | 14213 "Content-Length: 3\r\n\r\n"), |
| 14214 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14214 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14215 }; | 14215 }; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14248 ScopedVector<UploadElementReader> element_readers; | 14248 ScopedVector<UploadElementReader> element_readers; |
| 14249 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14249 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14250 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14250 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14251 | 14251 |
| 14252 HttpRequestInfo request; | 14252 HttpRequestInfo request; |
| 14253 request.method = "POST"; | 14253 request.method = "POST"; |
| 14254 request.url = GURL("http://www.foo.com/"); | 14254 request.url = GURL("http://www.foo.com/"); |
| 14255 request.upload_data_stream = &upload_data_stream; | 14255 request.upload_data_stream = &upload_data_stream; |
| 14256 request.load_flags = 0; | 14256 request.load_flags = 0; |
| 14257 | 14257 |
| 14258 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14258 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14259 scoped_ptr<HttpTransaction> trans( | 14259 scoped_ptr<HttpTransaction> trans( |
| 14260 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14260 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14261 // Send headers successfully, but get an error while sending the body. | 14261 // Send headers successfully, but get an error while sending the body. |
| 14262 MockWrite data_writes[] = { | 14262 MockWrite data_writes[] = { |
| 14263 MockWrite("POST / HTTP/1.1\r\n" | 14263 MockWrite("POST / HTTP/1.1\r\n" |
| 14264 "Host: www.foo.com\r\n" | 14264 "Host: www.foo.com\r\n" |
| 14265 "Connection: keep-alive\r\n" | 14265 "Connection: keep-alive\r\n" |
| 14266 "Content-Length: 3\r\n\r\n"), | 14266 "Content-Length: 3\r\n\r\n"), |
| 14267 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14267 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14268 }; | 14268 }; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 14290 ScopedVector<UploadElementReader> element_readers; | 14290 ScopedVector<UploadElementReader> element_readers; |
| 14291 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14291 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14292 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14292 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14293 | 14293 |
| 14294 HttpRequestInfo request; | 14294 HttpRequestInfo request; |
| 14295 request.method = "POST"; | 14295 request.method = "POST"; |
| 14296 request.url = GURL("http://www.foo.com/"); | 14296 request.url = GURL("http://www.foo.com/"); |
| 14297 request.upload_data_stream = &upload_data_stream; | 14297 request.upload_data_stream = &upload_data_stream; |
| 14298 request.load_flags = 0; | 14298 request.load_flags = 0; |
| 14299 | 14299 |
| 14300 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14300 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14301 scoped_ptr<HttpTransaction> trans( | 14301 scoped_ptr<HttpTransaction> trans( |
| 14302 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14302 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14303 // Send headers successfully, but get an error while sending the body. | 14303 // Send headers successfully, but get an error while sending the body. |
| 14304 MockWrite data_writes[] = { | 14304 MockWrite data_writes[] = { |
| 14305 MockWrite("POST / HTTP/1.1\r\n" | 14305 MockWrite("POST / HTTP/1.1\r\n" |
| 14306 "Host: www.foo.com\r\n" | 14306 "Host: www.foo.com\r\n" |
| 14307 "Connection: keep-alive\r\n" | 14307 "Connection: keep-alive\r\n" |
| 14308 "Content-Length: 3\r\n\r\n"), | 14308 "Content-Length: 3\r\n\r\n"), |
| 14309 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14309 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14310 }; | 14310 }; |
| (...skipping 22 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 19 matching lines...) Expand all Loading... | |
| 14373 ScopedVector<UploadElementReader> element_readers; | 14373 ScopedVector<UploadElementReader> element_readers; |
| 14374 element_readers.push_back(new UploadBytesElementReader("foo", 3)); | 14374 element_readers.push_back(new UploadBytesElementReader("foo", 3)); |
| 14375 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); | 14375 ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0); |
| 14376 | 14376 |
| 14377 HttpRequestInfo request; | 14377 HttpRequestInfo request; |
| 14378 request.method = "POST"; | 14378 request.method = "POST"; |
| 14379 request.url = GURL("http://www.foo.com/"); | 14379 request.url = GURL("http://www.foo.com/"); |
| 14380 request.upload_data_stream = &upload_data_stream; | 14380 request.upload_data_stream = &upload_data_stream; |
| 14381 request.load_flags = 0; | 14381 request.load_flags = 0; |
| 14382 | 14382 |
| 14383 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14383 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14384 scoped_ptr<HttpTransaction> trans( | 14384 scoped_ptr<HttpTransaction> trans( |
| 14385 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 14385 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 14386 // Send headers successfully, but get an error while sending the body. | 14386 // Send headers successfully, but get an error while sending the body. |
| 14387 MockWrite data_writes[] = { | 14387 MockWrite data_writes[] = { |
| 14388 MockWrite("POST / HTTP/1.1\r\n" | 14388 MockWrite("POST / HTTP/1.1\r\n" |
| 14389 "Host: www.foo.com\r\n" | 14389 "Host: www.foo.com\r\n" |
| 14390 "Connection: keep-alive\r\n" | 14390 "Connection: keep-alive\r\n" |
| 14391 "Content-Length: 3\r\n\r\n"), | 14391 "Content-Length: 3\r\n\r\n"), |
| 14392 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), | 14392 MockWrite(SYNCHRONOUS, ERR_CONNECTION_RESET), |
| 14393 }; | 14393 }; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 14414 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWssTunnel) { | 14414 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWssTunnel) { |
| 14415 HttpRequestInfo request; | 14415 HttpRequestInfo request; |
| 14416 request.method = "GET"; | 14416 request.method = "GET"; |
| 14417 request.url = GURL("wss://www.example.org/"); | 14417 request.url = GURL("wss://www.example.org/"); |
| 14418 AddWebSocketHeaders(&request.extra_headers); | 14418 AddWebSocketHeaders(&request.extra_headers); |
| 14419 | 14419 |
| 14420 // Configure against proxy server "myproxy:70". | 14420 // Configure against proxy server "myproxy:70". |
| 14421 session_deps_.proxy_service.reset( | 14421 session_deps_.proxy_service.reset( |
| 14422 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 14422 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 14423 | 14423 |
| 14424 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14424 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14425 | 14425 |
| 14426 // Since a proxy is configured, try to establish a tunnel. | 14426 // Since a proxy is configured, try to establish a tunnel. |
| 14427 MockWrite data_writes[] = { | 14427 MockWrite data_writes[] = { |
| 14428 MockWrite( | 14428 MockWrite( |
| 14429 "CONNECT www.example.org:443 HTTP/1.1\r\n" | 14429 "CONNECT www.example.org:443 HTTP/1.1\r\n" |
| 14430 "Host: www.example.org\r\n" | 14430 "Host: www.example.org\r\n" |
| 14431 "Proxy-Connection: keep-alive\r\n\r\n"), | 14431 "Proxy-Connection: keep-alive\r\n\r\n"), |
| 14432 | 14432 |
| 14433 // After calling trans->RestartWithAuth(), this is the request we should | 14433 // After calling trans->RestartWithAuth(), this is the request we should |
| 14434 // be issuing -- the final header line contains the credentials. | 14434 // be issuing -- the final header line contains the credentials. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14521 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWsTunnel) { | 14521 TEST_P(HttpNetworkTransactionTest, ProxyHeadersNotSentOverWsTunnel) { |
| 14522 HttpRequestInfo request; | 14522 HttpRequestInfo request; |
| 14523 request.method = "GET"; | 14523 request.method = "GET"; |
| 14524 request.url = GURL("ws://www.example.org/"); | 14524 request.url = GURL("ws://www.example.org/"); |
| 14525 AddWebSocketHeaders(&request.extra_headers); | 14525 AddWebSocketHeaders(&request.extra_headers); |
| 14526 | 14526 |
| 14527 // Configure against proxy server "myproxy:70". | 14527 // Configure against proxy server "myproxy:70". |
| 14528 session_deps_.proxy_service.reset( | 14528 session_deps_.proxy_service.reset( |
| 14529 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | 14529 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); |
| 14530 | 14530 |
| 14531 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_)); | 14531 scoped_ptr<HttpNetworkSession> session(CreateSession(&session_deps_)); |
| 14532 | 14532 |
| 14533 MockWrite data_writes[] = { | 14533 MockWrite data_writes[] = { |
| 14534 // Try to establish a tunnel for the WebSocket connection, with | 14534 // Try to establish a tunnel for the WebSocket connection, with |
| 14535 // credentials. Because WebSockets have a separate set of socket pools, | 14535 // credentials. Because WebSockets have a separate set of socket pools, |
| 14536 // they cannot and will not use the same TCP/IP connection as the | 14536 // they cannot and will not use the same TCP/IP connection as the |
| 14537 // preflight HTTP request. | 14537 // preflight HTTP request. |
| 14538 MockWrite( | 14538 MockWrite( |
| 14539 "CONNECT www.example.org:80 HTTP/1.1\r\n" | 14539 "CONNECT www.example.org:80 HTTP/1.1\r\n" |
| 14540 "Host: www.example.org:80\r\n" | 14540 "Host: www.example.org:80\r\n" |
| 14541 "Proxy-Connection: keep-alive\r\n" | 14541 "Proxy-Connection: keep-alive\r\n" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14588 ASSERT_TRUE(response); | 14588 ASSERT_TRUE(response); |
| 14589 ASSERT_TRUE(response->headers.get()); | 14589 ASSERT_TRUE(response->headers.get()); |
| 14590 | 14590 |
| 14591 EXPECT_EQ(101, response->headers->response_code()); | 14591 EXPECT_EQ(101, response->headers->response_code()); |
| 14592 | 14592 |
| 14593 trans.reset(); | 14593 trans.reset(); |
| 14594 session->CloseAllConnections(); | 14594 session->CloseAllConnections(); |
| 14595 } | 14595 } |
| 14596 | 14596 |
| 14597 } // namespace net | 14597 } // namespace net |
| OLD | NEW |