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 <errno.h> | 7 #include <errno.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 const base::Closure& completion_callback) override {} | 767 const base::Closure& completion_callback) override {} |
768 void DeleteForDomainsCreatedBetween( | 768 void DeleteForDomainsCreatedBetween( |
769 const base::Callback<bool(const std::string&)>& domain_predicate, | 769 const base::Callback<bool(const std::string&)>& domain_predicate, |
770 base::Time delete_begin, | 770 base::Time delete_begin, |
771 base::Time delete_end, | 771 base::Time delete_end, |
772 const base::Closure& completion_callback) override {} | 772 const base::Closure& completion_callback) override {} |
773 void DeleteAll(const base::Closure& completion_callback) override {} | 773 void DeleteAll(const base::Closure& completion_callback) override {} |
774 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} | 774 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} |
775 int GetChannelIDCount() override { return 0; } | 775 int GetChannelIDCount() override { return 0; } |
776 void SetForceKeepSessionState() override {} | 776 void SetForceKeepSessionState() override {} |
| 777 void Flush() override {} |
777 bool IsEphemeral() override { return true; } | 778 bool IsEphemeral() override { return true; } |
778 }; | 779 }; |
779 | 780 |
780 // A ChannelIDStore that asynchronously returns an error when asked for a | 781 // A ChannelIDStore that asynchronously returns an error when asked for a |
781 // channel id. | 782 // channel id. |
782 class AsyncFailingChannelIDStore : public ChannelIDStore { | 783 class AsyncFailingChannelIDStore : public ChannelIDStore { |
783 int GetChannelID(const std::string& server_identifier, | 784 int GetChannelID(const std::string& server_identifier, |
784 std::unique_ptr<crypto::ECPrivateKey>* key_result, | 785 std::unique_ptr<crypto::ECPrivateKey>* key_result, |
785 const GetChannelIDCallback& callback) override { | 786 const GetChannelIDCallback& callback) override { |
786 base::ThreadTaskRunnerHandle::Get()->PostTask( | 787 base::ThreadTaskRunnerHandle::Get()->PostTask( |
787 FROM_HERE, | 788 FROM_HERE, |
788 base::Bind(callback, ERR_UNEXPECTED, server_identifier, nullptr)); | 789 base::Bind(callback, ERR_UNEXPECTED, server_identifier, nullptr)); |
789 return ERR_IO_PENDING; | 790 return ERR_IO_PENDING; |
790 } | 791 } |
791 void SetChannelID(std::unique_ptr<ChannelID> channel_id) override {} | 792 void SetChannelID(std::unique_ptr<ChannelID> channel_id) override {} |
792 void DeleteChannelID(const std::string& server_identifier, | 793 void DeleteChannelID(const std::string& server_identifier, |
793 const base::Closure& completion_callback) override {} | 794 const base::Closure& completion_callback) override {} |
794 void DeleteForDomainsCreatedBetween( | 795 void DeleteForDomainsCreatedBetween( |
795 const base::Callback<bool(const std::string&)>& domain_predicate, | 796 const base::Callback<bool(const std::string&)>& domain_predicate, |
796 base::Time delete_begin, | 797 base::Time delete_begin, |
797 base::Time delete_end, | 798 base::Time delete_end, |
798 const base::Closure& completion_callback) override {} | 799 const base::Closure& completion_callback) override {} |
799 void DeleteAll(const base::Closure& completion_callback) override {} | 800 void DeleteAll(const base::Closure& completion_callback) override {} |
800 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} | 801 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} |
801 int GetChannelIDCount() override { return 0; } | 802 int GetChannelIDCount() override { return 0; } |
802 void SetForceKeepSessionState() override {} | 803 void SetForceKeepSessionState() override {} |
| 804 void Flush() override {} |
803 bool IsEphemeral() override { return true; } | 805 bool IsEphemeral() override { return true; } |
804 }; | 806 }; |
805 | 807 |
806 // A mock ExpectCTReporter that remembers the latest violation that was | 808 // A mock ExpectCTReporter that remembers the latest violation that was |
807 // reported and the number of violations reported. | 809 // reported and the number of violations reported. |
808 class MockExpectCTReporter : public TransportSecurityState::ExpectCTReporter { | 810 class MockExpectCTReporter : public TransportSecurityState::ExpectCTReporter { |
809 public: | 811 public: |
810 MockExpectCTReporter() : num_failures_(0) {} | 812 MockExpectCTReporter() : num_failures_(0) {} |
811 ~MockExpectCTReporter() override {} | 813 ~MockExpectCTReporter() override {} |
812 | 814 |
(...skipping 3185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3998 // The read buffer should be released. | 4000 // The read buffer should be released. |
3999 StreamSocket::SocketMemoryStats stats; | 4001 StreamSocket::SocketMemoryStats stats; |
4000 client->DumpMemoryStats(&stats); | 4002 client->DumpMemoryStats(&stats); |
4001 EXPECT_EQ(0u, stats.buffer_size); | 4003 EXPECT_EQ(0u, stats.buffer_size); |
4002 EXPECT_EQ(1u, stats.cert_count); | 4004 EXPECT_EQ(1u, stats.cert_count); |
4003 EXPECT_LT(0u, stats.cert_size); | 4005 EXPECT_LT(0u, stats.cert_size); |
4004 EXPECT_EQ(stats.cert_size, stats.total_size); | 4006 EXPECT_EQ(stats.cert_size, stats.total_size); |
4005 } | 4007 } |
4006 | 4008 |
4007 } // namespace net | 4009 } // namespace net |
OLD | NEW |