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

Side by Side Diff: net/quic/quic_crypto_server_stream_test.cc

Issue 1433433003: Rename MockHelper to the more descriptive (and more consistent with other Mock classes) MockConnect… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106414015
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_crypto_stream_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/quic/quic_crypto_server_stream.h" 5 #include "net/quic/quic_crypto_server_stream.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 server_crypto_config_.SetStrikeRegisterClient(strike_register_client_); 92 server_crypto_config_.SetStrikeRegisterClient(strike_register_client_);
93 } 93 }
94 } 94 }
95 95
96 ~QuicCryptoServerStreamTest() override { STLDeleteElements(&helpers_); } 96 ~QuicCryptoServerStreamTest() override { STLDeleteElements(&helpers_); }
97 97
98 // Initializes the crypto server stream state for testing. May be 98 // Initializes the crypto server stream state for testing. May be
99 // called multiple times. 99 // called multiple times.
100 void InitializeServer() { 100 void InitializeServer() {
101 TestQuicSpdyServerSession* server_session = nullptr; 101 TestQuicSpdyServerSession* server_session = nullptr;
102 helpers_.push_back(new MockHelper); 102 helpers_.push_back(new MockConnectionHelper);
103
103 CreateServerSessionForTest(server_id_, QuicTime::Delta::FromSeconds(100000), 104 CreateServerSessionForTest(server_id_, QuicTime::Delta::FromSeconds(100000),
104 helpers_.back(), &server_crypto_config_, 105 helpers_.back(), &server_crypto_config_,
105 &server_connection_, &server_session); 106 &server_connection_, &server_session);
106 CHECK(server_session); 107 CHECK(server_session);
107 server_session_.reset(server_session); 108 server_session_.reset(server_session);
108 CryptoTestUtils::SetupCryptoServerConfigForTest( 109 CryptoTestUtils::SetupCryptoServerConfigForTest(
109 server_connection_->clock(), server_connection_->random_generator(), 110 server_connection_->clock(), server_connection_->random_generator(),
110 server_session_->config(), &server_crypto_config_); 111 server_session_->config(), &server_crypto_config_);
111 } 112 }
112 113
113 QuicCryptoServerStream* server_stream() { 114 QuicCryptoServerStream* server_stream() {
114 return server_session_->GetCryptoStream(); 115 return server_session_->GetCryptoStream();
115 } 116 }
116 117
117 QuicCryptoClientStream* client_stream() { 118 QuicCryptoClientStream* client_stream() {
118 return client_session_->GetCryptoStream(); 119 return client_session_->GetCryptoStream();
119 } 120 }
120 121
121 // Initializes a fake client, and all its associated state, for 122 // Initializes a fake client, and all its associated state, for
122 // testing. May be called multiple times. 123 // testing. May be called multiple times.
123 void InitializeFakeClient(bool supports_stateless_rejects) { 124 void InitializeFakeClient(bool supports_stateless_rejects) {
124 TestQuicSpdyClientSession* client_session = nullptr; 125 TestQuicSpdyClientSession* client_session = nullptr;
125 helpers_.push_back(new MockHelper); 126 helpers_.push_back(new MockConnectionHelper);
126 CreateClientSessionForTest(server_id_, supports_stateless_rejects, 127 CreateClientSessionForTest(server_id_, supports_stateless_rejects,
127 QuicTime::Delta::FromSeconds(100000), 128 QuicTime::Delta::FromSeconds(100000),
128 helpers_.back(), &client_crypto_config_, 129 helpers_.back(), &client_crypto_config_,
129 &client_connection_, &client_session); 130 &client_connection_, &client_session);
130 CHECK(client_session); 131 CHECK(client_session);
131 client_session_.reset(client_session); 132 client_session_.reset(client_session);
132 } 133 }
133 134
134 bool AsyncStrikeRegisterVerification() { 135 bool AsyncStrikeRegisterVerification() {
135 if (server_connection_->version() > QUIC_VERSION_26) { 136 if (server_connection_->version() > QUIC_VERSION_26) {
(...skipping 21 matching lines...) Expand all
157 CHECK(server_connection_); 158 CHECK(server_connection_);
158 CHECK(client_session_ != nullptr); 159 CHECK(client_session_ != nullptr);
159 160
160 EXPECT_CALL(*client_session_, OnProofValid(_)).Times(testing::AnyNumber()); 161 EXPECT_CALL(*client_session_, OnProofValid(_)).Times(testing::AnyNumber());
161 client_stream()->CryptoConnect(); 162 client_stream()->CryptoConnect();
162 CryptoTestUtils::AdvanceHandshake(client_connection_, client_stream(), 0, 163 CryptoTestUtils::AdvanceHandshake(client_connection_, client_stream(), 0,
163 server_connection_, server_stream(), 0); 164 server_connection_, server_stream(), 0);
164 } 165 }
165 166
166 protected: 167 protected:
167 // Every connection gets its own MockHelper, tracked separately from the 168 // Every connection gets its own MockConnectionHelper, tracked separately
168 // server and client state so their lifetimes persist through the whole test. 169 // from the server and client state so their lifetimes persist through the
169 std::vector<MockHelper*> helpers_; 170 // whole test.
171 std::vector<MockConnectionHelper*> helpers_;
170 172
171 // Server state 173 // Server state
172 PacketSavingConnection* server_connection_; 174 PacketSavingConnection* server_connection_;
173 scoped_ptr<TestQuicSpdyServerSession> server_session_; 175 scoped_ptr<TestQuicSpdyServerSession> server_session_;
174 QuicCryptoServerConfig server_crypto_config_; 176 QuicCryptoServerConfig server_crypto_config_;
175 QuicServerId server_id_; 177 QuicServerId server_id_;
176 178
177 // Client state 179 // Client state
178 PacketSavingConnection* client_connection_; 180 PacketSavingConnection* client_connection_;
179 QuicCryptoClientConfig client_crypto_config_; 181 QuicCryptoClientConfig client_crypto_config_;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 EXPECT_FALSE( 423 EXPECT_FALSE(
422 QuicCryptoServerStreamPeer::DoesPeerSupportStatelessRejects(message_)); 424 QuicCryptoServerStreamPeer::DoesPeerSupportStatelessRejects(message_));
423 } 425 }
424 426
425 } // namespace 427 } // namespace
426 428
427 #endif 429 #endif
428 430
429 } // namespace test 431 } // namespace test
430 } // namespace net 432 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_crypto_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698