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/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 StreamSocket* socket_; | 612 StreamSocket* socket_; |
613 CompletionCallback callback_; | 613 CompletionCallback callback_; |
614 | 614 |
615 DISALLOW_COPY_AND_ASSIGN(DeleteSocketCallback); | 615 DISALLOW_COPY_AND_ASSIGN(DeleteSocketCallback); |
616 }; | 616 }; |
617 | 617 |
618 // A ChannelIDStore that always returns an error when asked for a | 618 // A ChannelIDStore that always returns an error when asked for a |
619 // channel id. | 619 // channel id. |
620 class FailingChannelIDStore : public ChannelIDStore { | 620 class FailingChannelIDStore : public ChannelIDStore { |
621 int GetChannelID(const std::string& server_identifier, | 621 int GetChannelID(const std::string& server_identifier, |
622 base::Time* expiration_time, | |
623 std::string* private_key_result, | 622 std::string* private_key_result, |
624 std::string* cert_result, | 623 std::string* public_key_result, |
625 const GetChannelIDCallback& callback) override { | 624 const GetChannelIDCallback& callback) override { |
626 return ERR_UNEXPECTED; | 625 return ERR_UNEXPECTED; |
627 } | 626 } |
628 void SetChannelID(const std::string& server_identifier, | 627 void SetChannelID(const std::string& server_identifier, |
629 base::Time creation_time, | 628 base::Time creation_time, |
630 base::Time expiration_time, | |
631 const std::string& private_key, | 629 const std::string& private_key, |
632 const std::string& cert) override {} | 630 const std::string& public_key) override {} |
633 void DeleteChannelID(const std::string& server_identifier, | 631 void DeleteChannelID(const std::string& server_identifier, |
634 const base::Closure& completion_callback) override {} | 632 const base::Closure& completion_callback) override {} |
635 void DeleteAllCreatedBetween( | 633 void DeleteAllCreatedBetween( |
636 base::Time delete_begin, | 634 base::Time delete_begin, |
637 base::Time delete_end, | 635 base::Time delete_end, |
638 const base::Closure& completion_callback) override {} | 636 const base::Closure& completion_callback) override {} |
639 void DeleteAll(const base::Closure& completion_callback) override {} | 637 void DeleteAll(const base::Closure& completion_callback) override {} |
640 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} | 638 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} |
641 int GetChannelIDCount() override { return 0; } | 639 int GetChannelIDCount() override { return 0; } |
642 void SetForceKeepSessionState() override {} | 640 void SetForceKeepSessionState() override {} |
643 }; | 641 }; |
644 | 642 |
645 // A ChannelIDStore that asynchronously returns an error when asked for a | 643 // A ChannelIDStore that asynchronously returns an error when asked for a |
646 // channel id. | 644 // channel id. |
647 class AsyncFailingChannelIDStore : public ChannelIDStore { | 645 class AsyncFailingChannelIDStore : public ChannelIDStore { |
648 int GetChannelID(const std::string& server_identifier, | 646 int GetChannelID(const std::string& server_identifier, |
649 base::Time* expiration_time, | |
650 std::string* private_key_result, | 647 std::string* private_key_result, |
651 std::string* cert_result, | 648 std::string* public_key_result, |
652 const GetChannelIDCallback& callback) override { | 649 const GetChannelIDCallback& callback) override { |
653 base::MessageLoop::current()->PostTask( | 650 base::MessageLoop::current()->PostTask( |
654 FROM_HERE, base::Bind(callback, ERR_UNEXPECTED, | 651 FROM_HERE, |
655 server_identifier, base::Time(), "", "")); | 652 base::Bind(callback, ERR_UNEXPECTED, server_identifier, "", "")); |
656 return ERR_IO_PENDING; | 653 return ERR_IO_PENDING; |
657 } | 654 } |
658 void SetChannelID(const std::string& server_identifier, | 655 void SetChannelID(const std::string& server_identifier, |
659 base::Time creation_time, | 656 base::Time creation_time, |
660 base::Time expiration_time, | |
661 const std::string& private_key, | 657 const std::string& private_key, |
662 const std::string& cert) override {} | 658 const std::string& public_key) override {} |
663 void DeleteChannelID(const std::string& server_identifier, | 659 void DeleteChannelID(const std::string& server_identifier, |
664 const base::Closure& completion_callback) override {} | 660 const base::Closure& completion_callback) override {} |
665 void DeleteAllCreatedBetween( | 661 void DeleteAllCreatedBetween( |
666 base::Time delete_begin, | 662 base::Time delete_begin, |
667 base::Time delete_end, | 663 base::Time delete_end, |
668 const base::Closure& completion_callback) override {} | 664 const base::Closure& completion_callback) override {} |
669 void DeleteAll(const base::Closure& completion_callback) override {} | 665 void DeleteAll(const base::Closure& completion_callback) override {} |
670 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} | 666 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} |
671 int GetChannelIDCount() override { return 0; } | 667 int GetChannelIDCount() override { return 0; } |
672 void SetForceKeepSessionState() override {} | 668 void SetForceKeepSessionState() override {} |
(...skipping 2712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3385 ssl_config.channel_id_enabled = true; | 3381 ssl_config.channel_id_enabled = true; |
3386 | 3382 |
3387 int rv; | 3383 int rv; |
3388 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); | 3384 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); |
3389 | 3385 |
3390 EXPECT_EQ(ERR_UNEXPECTED, rv); | 3386 EXPECT_EQ(ERR_UNEXPECTED, rv); |
3391 EXPECT_FALSE(sock_->IsConnected()); | 3387 EXPECT_FALSE(sock_->IsConnected()); |
3392 } | 3388 } |
3393 | 3389 |
3394 } // namespace net | 3390 } // namespace net |
OLD | NEW |