Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Side by Side Diff: net/socket/ssl_client_socket_unittest.cc

Issue 2874973002: Flush Channel IDs when Cookies get saved to a persistent backend (Closed)
Patch Set: clean up a few things Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 const base::Closure& completion_callback) override {} 769 const base::Closure& completion_callback) override {}
770 void DeleteForDomainsCreatedBetween( 770 void DeleteForDomainsCreatedBetween(
771 const base::Callback<bool(const std::string&)>& domain_predicate, 771 const base::Callback<bool(const std::string&)>& domain_predicate,
772 base::Time delete_begin, 772 base::Time delete_begin,
773 base::Time delete_end, 773 base::Time delete_end,
774 const base::Closure& completion_callback) override {} 774 const base::Closure& completion_callback) override {}
775 void DeleteAll(const base::Closure& completion_callback) override {} 775 void DeleteAll(const base::Closure& completion_callback) override {}
776 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} 776 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {}
777 int GetChannelIDCount() override { return 0; } 777 int GetChannelIDCount() override { return 0; }
778 void SetForceKeepSessionState() override {} 778 void SetForceKeepSessionState() override {}
779 void Flush() override {}
779 bool IsEphemeral() override { return true; } 780 bool IsEphemeral() override { return true; }
780 }; 781 };
781 782
782 // A ChannelIDStore that asynchronously returns an error when asked for a 783 // A ChannelIDStore that asynchronously returns an error when asked for a
783 // channel id. 784 // channel id.
784 class AsyncFailingChannelIDStore : public ChannelIDStore { 785 class AsyncFailingChannelIDStore : public ChannelIDStore {
785 int GetChannelID(const std::string& server_identifier, 786 int GetChannelID(const std::string& server_identifier,
786 std::unique_ptr<crypto::ECPrivateKey>* key_result, 787 std::unique_ptr<crypto::ECPrivateKey>* key_result,
787 const GetChannelIDCallback& callback) override { 788 const GetChannelIDCallback& callback) override {
788 base::ThreadTaskRunnerHandle::Get()->PostTask( 789 base::ThreadTaskRunnerHandle::Get()->PostTask(
789 FROM_HERE, 790 FROM_HERE,
790 base::Bind(callback, ERR_UNEXPECTED, server_identifier, nullptr)); 791 base::Bind(callback, ERR_UNEXPECTED, server_identifier, nullptr));
791 return ERR_IO_PENDING; 792 return ERR_IO_PENDING;
792 } 793 }
793 void SetChannelID(std::unique_ptr<ChannelID> channel_id) override {} 794 void SetChannelID(std::unique_ptr<ChannelID> channel_id) override {}
794 void DeleteChannelID(const std::string& server_identifier, 795 void DeleteChannelID(const std::string& server_identifier,
795 const base::Closure& completion_callback) override {} 796 const base::Closure& completion_callback) override {}
796 void DeleteForDomainsCreatedBetween( 797 void DeleteForDomainsCreatedBetween(
797 const base::Callback<bool(const std::string&)>& domain_predicate, 798 const base::Callback<bool(const std::string&)>& domain_predicate,
798 base::Time delete_begin, 799 base::Time delete_begin,
799 base::Time delete_end, 800 base::Time delete_end,
800 const base::Closure& completion_callback) override {} 801 const base::Closure& completion_callback) override {}
801 void DeleteAll(const base::Closure& completion_callback) override {} 802 void DeleteAll(const base::Closure& completion_callback) override {}
802 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {} 803 void GetAllChannelIDs(const GetChannelIDListCallback& callback) override {}
803 int GetChannelIDCount() override { return 0; } 804 int GetChannelIDCount() override { return 0; }
804 void SetForceKeepSessionState() override {} 805 void SetForceKeepSessionState() override {}
806 void Flush() override {}
805 bool IsEphemeral() override { return true; } 807 bool IsEphemeral() override { return true; }
806 }; 808 };
807 809
808 // A mock ExpectCTReporter that remembers the latest violation that was 810 // A mock ExpectCTReporter that remembers the latest violation that was
809 // reported and the number of violations reported. 811 // reported and the number of violations reported.
810 class MockExpectCTReporter : public TransportSecurityState::ExpectCTReporter { 812 class MockExpectCTReporter : public TransportSecurityState::ExpectCTReporter {
811 public: 813 public:
812 MockExpectCTReporter() : num_failures_(0) {} 814 MockExpectCTReporter() : num_failures_(0) {}
813 ~MockExpectCTReporter() override {} 815 ~MockExpectCTReporter() override {}
814 816
(...skipping 3238 matching lines...) Expand 10 before | Expand all | Expand 10 after
4053 // The read buffer should be released. 4055 // The read buffer should be released.
4054 StreamSocket::SocketMemoryStats stats; 4056 StreamSocket::SocketMemoryStats stats;
4055 client->DumpMemoryStats(&stats); 4057 client->DumpMemoryStats(&stats);
4056 EXPECT_EQ(0u, stats.buffer_size); 4058 EXPECT_EQ(0u, stats.buffer_size);
4057 EXPECT_EQ(1u, stats.cert_count); 4059 EXPECT_EQ(1u, stats.cert_count);
4058 EXPECT_LT(0u, stats.cert_size); 4060 EXPECT_LT(0u, stats.cert_size);
4059 EXPECT_EQ(stats.cert_size, stats.total_size); 4061 EXPECT_EQ(stats.cert_size, stats.total_size);
4060 } 4062 }
4061 4063
4062 } // namespace net 4064 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698