OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
16 #include "base/test/test_file_util.h" | 16 #include "base/test/test_file_util.h" |
17 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
18 #include "net/base/auth.h" | 18 #include "net/base/auth.h" |
19 #include "net/base/chunked_upload_data_stream.h" | 19 #include "net/base/chunked_upload_data_stream.h" |
20 #include "net/base/elements_upload_data_stream.h" | 20 #include "net/base/elements_upload_data_stream.h" |
21 #include "net/base/request_priority.h" | 21 #include "net/base/request_priority.h" |
22 #include "net/base/test_data_directory.h" | 22 #include "net/base/test_data_directory.h" |
23 #include "net/base/upload_bytes_element_reader.h" | 23 #include "net/base/upload_bytes_element_reader.h" |
24 #include "net/base/upload_file_element_reader.h" | 24 #include "net/base/upload_file_element_reader.h" |
| 25 #include "net/http/http_auth_scheme.h" |
25 #include "net/http/http_network_session_peer.h" | 26 #include "net/http/http_network_session_peer.h" |
26 #include "net/http/http_network_transaction.h" | 27 #include "net/http/http_network_transaction.h" |
27 #include "net/http/http_server_properties.h" | 28 #include "net/http/http_server_properties.h" |
28 #include "net/http/http_transaction_test_util.h" | 29 #include "net/http/http_transaction_test_util.h" |
29 #include "net/log/test_net_log.h" | 30 #include "net/log/test_net_log.h" |
30 #include "net/log/test_net_log_entry.h" | 31 #include "net/log/test_net_log_entry.h" |
31 #include "net/log/test_net_log_util.h" | 32 #include "net/log/test_net_log_util.h" |
32 #include "net/socket/client_socket_pool_base.h" | 33 #include "net/socket/client_socket_pool_base.h" |
33 #include "net/socket/next_proto.h" | 34 #include "net/socket/next_proto.h" |
34 #include "net/spdy/buffered_spdy_framer.h" | 35 #include "net/spdy/buffered_spdy_framer.h" |
(...skipping 4902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4937 | 4938 |
4938 // Make sure the response has an auth challenge. | 4939 // Make sure the response has an auth challenge. |
4939 const HttpResponseInfo* const response_start = trans->GetResponseInfo(); | 4940 const HttpResponseInfo* const response_start = trans->GetResponseInfo(); |
4940 ASSERT_TRUE(response_start != NULL); | 4941 ASSERT_TRUE(response_start != NULL); |
4941 ASSERT_TRUE(response_start->headers.get() != NULL); | 4942 ASSERT_TRUE(response_start->headers.get() != NULL); |
4942 EXPECT_EQ(401, response_start->headers->response_code()); | 4943 EXPECT_EQ(401, response_start->headers->response_code()); |
4943 EXPECT_TRUE(response_start->was_fetched_via_spdy); | 4944 EXPECT_TRUE(response_start->was_fetched_via_spdy); |
4944 AuthChallengeInfo* auth_challenge = response_start->auth_challenge.get(); | 4945 AuthChallengeInfo* auth_challenge = response_start->auth_challenge.get(); |
4945 ASSERT_TRUE(auth_challenge != NULL); | 4946 ASSERT_TRUE(auth_challenge != NULL); |
4946 EXPECT_FALSE(auth_challenge->is_proxy); | 4947 EXPECT_FALSE(auth_challenge->is_proxy); |
4947 EXPECT_EQ("basic", auth_challenge->scheme); | 4948 EXPECT_EQ(kBasicAuthScheme, auth_challenge->scheme); |
4948 EXPECT_EQ("MyRealm", auth_challenge->realm); | 4949 EXPECT_EQ("MyRealm", auth_challenge->realm); |
4949 | 4950 |
4950 // Restart with a username/password. | 4951 // Restart with a username/password. |
4951 AuthCredentials credentials(base::ASCIIToUTF16("foo"), | 4952 AuthCredentials credentials(base::ASCIIToUTF16("foo"), |
4952 base::ASCIIToUTF16("bar")); | 4953 base::ASCIIToUTF16("bar")); |
4953 TestCompletionCallback callback_restart; | 4954 TestCompletionCallback callback_restart; |
4954 const int rv_restart = trans->RestartWithAuth( | 4955 const int rv_restart = trans->RestartWithAuth( |
4955 credentials, callback_restart.callback()); | 4956 credentials, callback_restart.callback()); |
4956 EXPECT_EQ(ERR_IO_PENDING, rv_restart); | 4957 EXPECT_EQ(ERR_IO_PENDING, rv_restart); |
4957 const int rv_restart_complete = callback_restart.WaitForResult(); | 4958 const int rv_restart_complete = callback_restart.WaitForResult(); |
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6590 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6591 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
6591 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6592 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
6592 new SSLSocketDataProvider(ASYNC, OK)); | 6593 new SSLSocketDataProvider(ASYNC, OK)); |
6593 // Set to TLS_RSA_WITH_NULL_MD5 | 6594 // Set to TLS_RSA_WITH_NULL_MD5 |
6594 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6595 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
6595 | 6596 |
6596 RunTLSUsageCheckTest(ssl_provider.Pass()); | 6597 RunTLSUsageCheckTest(ssl_provider.Pass()); |
6597 } | 6598 } |
6598 | 6599 |
6599 } // namespace net | 6600 } // namespace net |
OLD | NEW |