| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 4142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4153 session_deps_.socket_factory->AddSocketDataProvider(&data2); | 4153 session_deps_.socket_factory->AddSocketDataProvider(&data2); |
| 4154 | 4154 |
| 4155 StaticSocketDataProvider data3(data_reads3, arraysize(data_reads3), | 4155 StaticSocketDataProvider data3(data_reads3, arraysize(data_reads3), |
| 4156 data_writes3, arraysize(data_writes3)); | 4156 data_writes3, arraysize(data_writes3)); |
| 4157 session_deps_.socket_factory->AddSocketDataProvider(&data3); | 4157 session_deps_.socket_factory->AddSocketDataProvider(&data3); |
| 4158 | 4158 |
| 4159 std::unique_ptr<HttpNetworkTransaction> trans( | 4159 std::unique_ptr<HttpNetworkTransaction> trans( |
| 4160 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); | 4160 new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get())); |
| 4161 | 4161 |
| 4162 TestCompletionCallback callback; | 4162 TestCompletionCallback callback; |
| 4163 int rv = trans->Start(&request, callback.callback(), NetLogWithSource()); | 4163 int rv = trans->Start(&request, callback.callback(), BoundNetLog()); |
| 4164 EXPECT_THAT(callback.GetResult(rv), IsOk()); | 4164 EXPECT_THAT(callback.GetResult(rv), IsOk()); |
| 4165 | 4165 |
| 4166 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4166 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4167 ASSERT_TRUE(response); | 4167 ASSERT_TRUE(response); |
| 4168 ASSERT_TRUE(response->headers); | 4168 ASSERT_TRUE(response->headers); |
| 4169 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); | 4169 EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); |
| 4170 | 4170 |
| 4171 // The following three tests assert that an authentication challenge was | 4171 // The following three tests assert that an authentication challenge was |
| 4172 // received and that the stack is ready to respond to the challenge using | 4172 // received and that the stack is ready to respond to the challenge using |
| 4173 // ambient credentials. | 4173 // ambient credentials. |
| (...skipping 7897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12071 test_config.server_auth_timing == AUTH_ASYNC, | 12071 test_config.server_auth_timing == AUTH_ASYNC, |
| 12072 test_config.server_auth_rv); | 12072 test_config.server_auth_rv); |
| 12073 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER); | 12073 auth_factory->AddMockHandler(auth_handler, HttpAuth::AUTH_SERVER); |
| 12074 | 12074 |
| 12075 // The second handler always succeeds. It should only be used where there | 12075 // The second handler always succeeds. It should only be used where there |
| 12076 // are multiple auth sessions for server auth in the same network | 12076 // are multiple auth sessions for server auth in the same network |
| 12077 // transaction using the same auth scheme. | 12077 // transaction using the same auth scheme. |
| 12078 std::unique_ptr<HttpAuthHandlerMock> second_handler = | 12078 std::unique_ptr<HttpAuthHandlerMock> second_handler = |
| 12079 base::MakeUnique<HttpAuthHandlerMock>(); | 12079 base::MakeUnique<HttpAuthHandlerMock>(); |
| 12080 second_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_SERVER, | 12080 second_handler->InitFromChallenge(&tokenizer, HttpAuth::AUTH_SERVER, |
| 12081 empty_ssl_info, origin, | 12081 empty_ssl_info, origin, BoundNetLog()); |
| 12082 NetLogWithSource()); | |
| 12083 second_handler->SetGenerateExpectation(true, OK); | 12082 second_handler->SetGenerateExpectation(true, OK); |
| 12084 auth_factory->AddMockHandler(second_handler.release(), | 12083 auth_factory->AddMockHandler(second_handler.release(), |
| 12085 HttpAuth::AUTH_SERVER); | 12084 HttpAuth::AUTH_SERVER); |
| 12086 } | 12085 } |
| 12087 if (test_config.proxy_url) { | 12086 if (test_config.proxy_url) { |
| 12088 session_deps_.proxy_service = | 12087 session_deps_.proxy_service = |
| 12089 ProxyService::CreateFixed(test_config.proxy_url); | 12088 ProxyService::CreateFixed(test_config.proxy_url); |
| 12090 } else { | 12089 } else { |
| 12091 session_deps_.proxy_service = ProxyService::CreateDirect(); | 12090 session_deps_.proxy_service = ProxyService::CreateDirect(); |
| 12092 } | 12091 } |
| (...skipping 3961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16054 base::RunLoop().RunUntilIdle(); | 16053 base::RunLoop().RunUntilIdle(); |
| 16055 | 16054 |
| 16056 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); | 16055 EXPECT_TRUE(trans.GetResponseInfo()->was_fetched_via_spdy); |
| 16057 HttpRequestHeaders headers; | 16056 HttpRequestHeaders headers; |
| 16058 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); | 16057 ASSERT_TRUE(trans.GetFullRequestHeaders(&headers)); |
| 16059 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); | 16058 EXPECT_TRUE(headers.HasHeader(HttpRequestHeaders::kTokenBinding)); |
| 16060 } | 16059 } |
| 16061 #endif // !defined(OS_IOS) | 16060 #endif // !defined(OS_IOS) |
| 16062 | 16061 |
| 16063 } // namespace net | 16062 } // namespace net |
| OLD | NEW |