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 4945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4980 | 4981 |
4981 // Make sure the response has an auth challenge. | 4982 // Make sure the response has an auth challenge. |
4982 const HttpResponseInfo* const response_start = trans->GetResponseInfo(); | 4983 const HttpResponseInfo* const response_start = trans->GetResponseInfo(); |
4983 ASSERT_TRUE(response_start != NULL); | 4984 ASSERT_TRUE(response_start != NULL); |
4984 ASSERT_TRUE(response_start->headers.get() != NULL); | 4985 ASSERT_TRUE(response_start->headers.get() != NULL); |
4985 EXPECT_EQ(401, response_start->headers->response_code()); | 4986 EXPECT_EQ(401, response_start->headers->response_code()); |
4986 EXPECT_TRUE(response_start->was_fetched_via_spdy); | 4987 EXPECT_TRUE(response_start->was_fetched_via_spdy); |
4987 AuthChallengeInfo* auth_challenge = response_start->auth_challenge.get(); | 4988 AuthChallengeInfo* auth_challenge = response_start->auth_challenge.get(); |
4988 ASSERT_TRUE(auth_challenge != NULL); | 4989 ASSERT_TRUE(auth_challenge != NULL); |
4989 EXPECT_FALSE(auth_challenge->is_proxy); | 4990 EXPECT_FALSE(auth_challenge->is_proxy); |
4990 EXPECT_EQ("basic", auth_challenge->scheme); | 4991 EXPECT_EQ(kBasicAuthScheme, auth_challenge->scheme); |
4991 EXPECT_EQ("MyRealm", auth_challenge->realm); | 4992 EXPECT_EQ("MyRealm", auth_challenge->realm); |
4992 | 4993 |
4993 // Restart with a username/password. | 4994 // Restart with a username/password. |
4994 AuthCredentials credentials(base::ASCIIToUTF16("foo"), | 4995 AuthCredentials credentials(base::ASCIIToUTF16("foo"), |
4995 base::ASCIIToUTF16("bar")); | 4996 base::ASCIIToUTF16("bar")); |
4996 TestCompletionCallback callback_restart; | 4997 TestCompletionCallback callback_restart; |
4997 const int rv_restart = trans->RestartWithAuth( | 4998 const int rv_restart = trans->RestartWithAuth( |
4998 credentials, callback_restart.callback()); | 4999 credentials, callback_restart.callback()); |
4999 EXPECT_EQ(ERR_IO_PENDING, rv_restart); | 5000 EXPECT_EQ(ERR_IO_PENDING, rv_restart); |
5000 const int rv_restart_complete = callback_restart.WaitForResult(); | 5001 const int rv_restart_complete = callback_restart.WaitForResult(); |
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6653 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6654 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
6654 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6655 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
6655 new SSLSocketDataProvider(ASYNC, OK)); | 6656 new SSLSocketDataProvider(ASYNC, OK)); |
6656 // Set to TLS_RSA_WITH_NULL_MD5 | 6657 // Set to TLS_RSA_WITH_NULL_MD5 |
6657 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6658 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
6658 | 6659 |
6659 RunTLSUsageCheckTest(ssl_provider.Pass()); | 6660 RunTLSUsageCheckTest(ssl_provider.Pass()); |
6660 } | 6661 } |
6661 | 6662 |
6662 } // namespace net | 6663 } // namespace net |
OLD | NEW |