| 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 "net/socket/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/thread_task_runner_handle.h" |
| 10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 11 #include "net/base/address_list.h" | 12 #include "net/base/address_list.h" |
| 12 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
| 13 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 14 #include "net/base/test_completion_callback.h" | 15 #include "net/base/test_completion_callback.h" |
| 15 #include "net/base/test_data_directory.h" | 16 #include "net/base/test_data_directory.h" |
| 16 #include "net/cert/asn1_util.h" | 17 #include "net/cert/asn1_util.h" |
| 17 #include "net/cert/ct_verifier.h" | 18 #include "net/cert/ct_verifier.h" |
| 18 #include "net/cert/mock_cert_verifier.h" | 19 #include "net/cert/mock_cert_verifier.h" |
| 19 #include "net/cert/test_root_certs.h" | 20 #include "net/cert/test_root_certs.h" |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 // the server second leg is blocked. | 933 // the server second leg is blocked. |
| 933 base::RunLoop().RunUntilIdle(); | 934 base::RunLoop().RunUntilIdle(); |
| 934 EXPECT_FALSE(callback.have_result()); | 935 EXPECT_FALSE(callback.have_result()); |
| 935 } | 936 } |
| 936 } | 937 } |
| 937 }; | 938 }; |
| 938 | 939 |
| 939 class SSLClientSocketChannelIDTest : public SSLClientSocketTest { | 940 class SSLClientSocketChannelIDTest : public SSLClientSocketTest { |
| 940 protected: | 941 protected: |
| 941 void EnableChannelID() { | 942 void EnableChannelID() { |
| 942 channel_id_service_.reset( | 943 channel_id_service_.reset(new ChannelIDService( |
| 943 new ChannelIDService(new DefaultChannelIDStore(NULL), | 944 new DefaultChannelIDStore(NULL), base::ThreadTaskRunnerHandle::Get())); |
| 944 base::MessageLoopProxy::current())); | |
| 945 context_.channel_id_service = channel_id_service_.get(); | 945 context_.channel_id_service = channel_id_service_.get(); |
| 946 } | 946 } |
| 947 | 947 |
| 948 void EnableFailingChannelID() { | 948 void EnableFailingChannelID() { |
| 949 channel_id_service_.reset(new ChannelIDService( | 949 channel_id_service_.reset(new ChannelIDService( |
| 950 new FailingChannelIDStore(), base::MessageLoopProxy::current())); | 950 new FailingChannelIDStore(), base::ThreadTaskRunnerHandle::Get())); |
| 951 context_.channel_id_service = channel_id_service_.get(); | 951 context_.channel_id_service = channel_id_service_.get(); |
| 952 } | 952 } |
| 953 | 953 |
| 954 void EnableAsyncFailingChannelID() { | 954 void EnableAsyncFailingChannelID() { |
| 955 channel_id_service_.reset(new ChannelIDService( | 955 channel_id_service_.reset(new ChannelIDService( |
| 956 new AsyncFailingChannelIDStore(), | 956 new AsyncFailingChannelIDStore(), base::ThreadTaskRunnerHandle::Get())); |
| 957 base::MessageLoopProxy::current())); | |
| 958 context_.channel_id_service = channel_id_service_.get(); | 957 context_.channel_id_service = channel_id_service_.get(); |
| 959 } | 958 } |
| 960 | 959 |
| 961 private: | 960 private: |
| 962 scoped_ptr<ChannelIDService> channel_id_service_; | 961 scoped_ptr<ChannelIDService> channel_id_service_; |
| 963 }; | 962 }; |
| 964 | 963 |
| 965 //----------------------------------------------------------------------------- | 964 //----------------------------------------------------------------------------- |
| 966 | 965 |
| 967 // LogContainsSSLConnectEndEvent returns true if the given index in the given | 966 // LogContainsSSLConnectEndEvent returns true if the given index in the given |
| (...skipping 2466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3434 ssl_config.channel_id_enabled = true; | 3433 ssl_config.channel_id_enabled = true; |
| 3435 | 3434 |
| 3436 int rv; | 3435 int rv; |
| 3437 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); | 3436 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); |
| 3438 | 3437 |
| 3439 EXPECT_EQ(ERR_UNEXPECTED, rv); | 3438 EXPECT_EQ(ERR_UNEXPECTED, rv); |
| 3440 EXPECT_FALSE(sock_->IsConnected()); | 3439 EXPECT_FALSE(sock_->IsConnected()); |
| 3441 } | 3440 } |
| 3442 | 3441 |
| 3443 } // namespace net | 3442 } // namespace net |
| OLD | NEW |