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_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 #include "base/test/test_file_util.h" | 15 #include "base/test/test_file_util.h" |
16 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
17 #include "net/base/auth.h" | 17 #include "net/base/auth.h" |
18 #include "net/base/chunked_upload_data_stream.h" | 18 #include "net/base/chunked_upload_data_stream.h" |
19 #include "net/base/elements_upload_data_stream.h" | 19 #include "net/base/elements_upload_data_stream.h" |
20 #include "net/base/request_priority.h" | 20 #include "net/base/request_priority.h" |
21 #include "net/base/test_data_directory.h" | 21 #include "net/base/test_data_directory.h" |
22 #include "net/base/upload_bytes_element_reader.h" | 22 #include "net/base/upload_bytes_element_reader.h" |
23 #include "net/base/upload_file_element_reader.h" | 23 #include "net/base/upload_file_element_reader.h" |
| 24 #include "net/http/http_auth_scheme.h" |
24 #include "net/http/http_network_session_peer.h" | 25 #include "net/http/http_network_session_peer.h" |
25 #include "net/http/http_network_transaction.h" | 26 #include "net/http/http_network_transaction.h" |
26 #include "net/http/http_server_properties.h" | 27 #include "net/http/http_server_properties.h" |
27 #include "net/http/http_transaction_test_util.h" | 28 #include "net/http/http_transaction_test_util.h" |
28 #include "net/log/test_net_log.h" | 29 #include "net/log/test_net_log.h" |
29 #include "net/log/test_net_log_entry.h" | 30 #include "net/log/test_net_log_entry.h" |
30 #include "net/log/test_net_log_util.h" | 31 #include "net/log/test_net_log_util.h" |
31 #include "net/socket/client_socket_pool_base.h" | 32 #include "net/socket/client_socket_pool_base.h" |
32 #include "net/socket/next_proto.h" | 33 #include "net/socket/next_proto.h" |
33 #include "net/spdy/buffered_spdy_framer.h" | 34 #include "net/spdy/buffered_spdy_framer.h" |
(...skipping 4945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4979 | 4980 |
4980 // Make sure the response has an auth challenge. | 4981 // Make sure the response has an auth challenge. |
4981 const HttpResponseInfo* const response_start = trans->GetResponseInfo(); | 4982 const HttpResponseInfo* const response_start = trans->GetResponseInfo(); |
4982 ASSERT_TRUE(response_start != NULL); | 4983 ASSERT_TRUE(response_start != NULL); |
4983 ASSERT_TRUE(response_start->headers.get() != NULL); | 4984 ASSERT_TRUE(response_start->headers.get() != NULL); |
4984 EXPECT_EQ(401, response_start->headers->response_code()); | 4985 EXPECT_EQ(401, response_start->headers->response_code()); |
4985 EXPECT_TRUE(response_start->was_fetched_via_spdy); | 4986 EXPECT_TRUE(response_start->was_fetched_via_spdy); |
4986 AuthChallengeInfo* auth_challenge = response_start->auth_challenge.get(); | 4987 AuthChallengeInfo* auth_challenge = response_start->auth_challenge.get(); |
4987 ASSERT_TRUE(auth_challenge != NULL); | 4988 ASSERT_TRUE(auth_challenge != NULL); |
4988 EXPECT_FALSE(auth_challenge->is_proxy); | 4989 EXPECT_FALSE(auth_challenge->is_proxy); |
4989 EXPECT_EQ("basic", auth_challenge->scheme); | 4990 EXPECT_EQ(kBasicAuthScheme, auth_challenge->scheme); |
4990 EXPECT_EQ("MyRealm", auth_challenge->realm); | 4991 EXPECT_EQ("MyRealm", auth_challenge->realm); |
4991 | 4992 |
4992 // Restart with a username/password. | 4993 // Restart with a username/password. |
4993 AuthCredentials credentials(base::ASCIIToUTF16("foo"), | 4994 AuthCredentials credentials(base::ASCIIToUTF16("foo"), |
4994 base::ASCIIToUTF16("bar")); | 4995 base::ASCIIToUTF16("bar")); |
4995 TestCompletionCallback callback_restart; | 4996 TestCompletionCallback callback_restart; |
4996 const int rv_restart = trans->RestartWithAuth( | 4997 const int rv_restart = trans->RestartWithAuth( |
4997 credentials, callback_restart.callback()); | 4998 credentials, callback_restart.callback()); |
4998 EXPECT_EQ(ERR_IO_PENDING, rv_restart); | 4999 EXPECT_EQ(ERR_IO_PENDING, rv_restart); |
4999 const int rv_restart_complete = callback_restart.WaitForResult(); | 5000 const int rv_restart_complete = callback_restart.WaitForResult(); |
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6652 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { | 6653 TEST_P(SpdyNetworkTransactionTLSUsageCheckTest, TLSCipherSuiteSucky) { |
6653 scoped_ptr<SSLSocketDataProvider> ssl_provider( | 6654 scoped_ptr<SSLSocketDataProvider> ssl_provider( |
6654 new SSLSocketDataProvider(ASYNC, OK)); | 6655 new SSLSocketDataProvider(ASYNC, OK)); |
6655 // Set to TLS_RSA_WITH_NULL_MD5 | 6656 // Set to TLS_RSA_WITH_NULL_MD5 |
6656 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); | 6657 SSLConnectionStatusSetCipherSuite(0x1, &ssl_provider->connection_status); |
6657 | 6658 |
6658 RunTLSUsageCheckTest(ssl_provider.Pass()); | 6659 RunTLSUsageCheckTest(ssl_provider.Pass()); |
6659 } | 6660 } |
6660 | 6661 |
6661 } // namespace net | 6662 } // namespace net |
OLD | NEW |