| 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/thread_task_runner_handle.h" |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 StreamSocket* socket_; | 615 StreamSocket* socket_; |
| 616 CompletionCallback callback_; | 616 CompletionCallback callback_; |
| 617 | 617 |
| 618 DISALLOW_COPY_AND_ASSIGN(DeleteSocketCallback); | 618 DISALLOW_COPY_AND_ASSIGN(DeleteSocketCallback); |
| 619 }; | 619 }; |
| 620 | 620 |
| 621 // A ChannelIDStore that always returns an error when asked for a | 621 // A ChannelIDStore that always returns an error when asked for a |
| 622 // channel id. | 622 // channel id. |
| 623 class FailingChannelIDStore : public ChannelIDStore { | 623 class FailingChannelIDStore : public ChannelIDStore { |
| 624 int GetChannelID(const std::string& server_identifier, | 624 int GetChannelID(const std::string& server_identifier, |
| 625 base::Time* expiration_time, | 625 scoped_ptr<crypto::ECPrivateKey>* key_result, |
| 626 std::string* private_key_result, | |
| 627 std::string* cert_result, | |
| 628 const GetChannelIDCallback& callback) override { | 626 const GetChannelIDCallback& callback) override { |
| 629 return ERR_UNEXPECTED; | 627 return ERR_UNEXPECTED; |
| 630 } | 628 } |
| 631 void SetChannelID(const std::string& server_identifier, | 629 void SetChannelID(scoped_ptr<ChannelID> channel_id) override {} |
| 632 base::Time creation_time, | |
| 633 base::Time expiration_time, | |
| 634 const std::string& private_key, | |
| 635 const std::string& cert) override {} | |
| 636 void DeleteChannelID(const std::string& server_identifier, | 630 void DeleteChannelID(const std::string& server_identifier, |
| 637 const base::Closure& completion_callback) override {} | 631 const base::Closure& completion_callback) override {} |
| 638 void DeleteAllCreatedBetween( | 632 void DeleteAllCreatedBetween( |
| 639 base::Time delete_begin, | 633 base::Time delete_begin, |
| 640 base::Time delete_end, | 634 base::Time delete_end, |
| 641 const base::Closure& completion_callback) override {} | 635 const base::Closure& completion_callback) override {} |
| 642 void DeleteAll(const base::Closure& completion_callback) override {} | 636 void DeleteAll(const base::Closure& completion_callback) override {} |
| 643 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} | 637 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} |
| 644 int GetChannelIDCount() override { return 0; } | 638 int GetChannelIDCount() override { return 0; } |
| 645 void SetForceKeepSessionState() override {} | 639 void SetForceKeepSessionState() override {} |
| 646 }; | 640 }; |
| 647 | 641 |
| 648 // A ChannelIDStore that asynchronously returns an error when asked for a | 642 // A ChannelIDStore that asynchronously returns an error when asked for a |
| 649 // channel id. | 643 // channel id. |
| 650 class AsyncFailingChannelIDStore : public ChannelIDStore { | 644 class AsyncFailingChannelIDStore : public ChannelIDStore { |
| 651 int GetChannelID(const std::string& server_identifier, | 645 int GetChannelID(const std::string& server_identifier, |
| 652 base::Time* expiration_time, | 646 scoped_ptr<crypto::ECPrivateKey>* key_result, |
| 653 std::string* private_key_result, | |
| 654 std::string* cert_result, | |
| 655 const GetChannelIDCallback& callback) override { | 647 const GetChannelIDCallback& callback) override { |
| 656 base::MessageLoop::current()->PostTask( | 648 base::MessageLoop::current()->PostTask( |
| 657 FROM_HERE, base::Bind(callback, ERR_UNEXPECTED, | 649 FROM_HERE, |
| 658 server_identifier, base::Time(), "", "")); | 650 base::Bind(callback, ERR_UNEXPECTED, server_identifier, |
| 651 base::Passed(scoped_ptr<crypto::ECPrivateKey>()))); |
| 659 return ERR_IO_PENDING; | 652 return ERR_IO_PENDING; |
| 660 } | 653 } |
| 661 void SetChannelID(const std::string& server_identifier, | 654 void SetChannelID(scoped_ptr<ChannelID> channel_id) override {} |
| 662 base::Time creation_time, | |
| 663 base::Time expiration_time, | |
| 664 const std::string& private_key, | |
| 665 const std::string& cert) override {} | |
| 666 void DeleteChannelID(const std::string& server_identifier, | 655 void DeleteChannelID(const std::string& server_identifier, |
| 667 const base::Closure& completion_callback) override {} | 656 const base::Closure& completion_callback) override {} |
| 668 void DeleteAllCreatedBetween( | 657 void DeleteAllCreatedBetween( |
| 669 base::Time delete_begin, | 658 base::Time delete_begin, |
| 670 base::Time delete_end, | 659 base::Time delete_end, |
| 671 const base::Closure& completion_callback) override {} | 660 const base::Closure& completion_callback) override {} |
| 672 void DeleteAll(const base::Closure& completion_callback) override {} | 661 void DeleteAll(const base::Closure& completion_callback) override {} |
| 673 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} | 662 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} |
| 674 int GetChannelIDCount() override { return 0; } | 663 int GetChannelIDCount() override { return 0; } |
| 675 void SetForceKeepSessionState() override {} | 664 void SetForceKeepSessionState() override {} |
| (...skipping 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3433 ssl_config.channel_id_enabled = true; | 3422 ssl_config.channel_id_enabled = true; |
| 3434 | 3423 |
| 3435 int rv; | 3424 int rv; |
| 3436 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); | 3425 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); |
| 3437 | 3426 |
| 3438 EXPECT_EQ(ERR_UNEXPECTED, rv); | 3427 EXPECT_EQ(ERR_UNEXPECTED, rv); |
| 3439 EXPECT_FALSE(sock_->IsConnected()); | 3428 EXPECT_FALSE(sock_->IsConnected()); |
| 3440 } | 3429 } |
| 3441 | 3430 |
| 3442 } // namespace net | 3431 } // namespace net |
| OLD | NEW |