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

Side by Side Diff: net/spdy/spdy_network_transaction_spdy2_unittest.cc

Issue 9959033: Move NextProto enum to a new file net/socket/next_proto.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address wtc's comments Created 8 years, 8 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 | Annotate | Revision Log
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/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 21 matching lines...) Expand all
32 enum SpdyNetworkTransactionSpdy2TestTypes { 32 enum SpdyNetworkTransactionSpdy2TestTypes {
33 SPDYNPN, 33 SPDYNPN,
34 SPDYNOSSL, 34 SPDYNOSSL,
35 SPDYSSL, 35 SPDYSSL,
36 }; 36 };
37 class SpdyNetworkTransactionSpdy2Test 37 class SpdyNetworkTransactionSpdy2Test
38 : public ::testing::TestWithParam<SpdyNetworkTransactionSpdy2TestTypes> { 38 : public ::testing::TestWithParam<SpdyNetworkTransactionSpdy2TestTypes> {
39 protected: 39 protected:
40 40
41 virtual void SetUp() { 41 virtual void SetUp() {
42 SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY2); 42 SpdySession::set_default_protocol(kProtoSPDY2);
43 google_get_request_initialized_ = false; 43 google_get_request_initialized_ = false;
44 google_post_request_initialized_ = false; 44 google_post_request_initialized_ = false;
45 google_chunked_post_request_initialized_ = false; 45 google_chunked_post_request_initialized_ = false;
46 } 46 }
47 47
48 virtual void TearDown() { 48 virtual void TearDown() {
49 // Empty the current queue. 49 // Empty the current queue.
50 MessageLoop::current()->RunAllPending(); 50 MessageLoop::current()->RunAllPending();
51 } 51 }
52 52
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 RunDefaultTest(); 224 RunDefaultTest();
225 VerifyDataConsumed(); 225 VerifyDataConsumed();
226 } 226 }
227 227
228 void AddData(StaticSocketDataProvider* data) { 228 void AddData(StaticSocketDataProvider* data) {
229 DCHECK(!deterministic_); 229 DCHECK(!deterministic_);
230 data_vector_.push_back(data); 230 data_vector_.push_back(data);
231 linked_ptr<SSLSocketDataProvider> ssl_( 231 linked_ptr<SSLSocketDataProvider> ssl_(
232 new SSLSocketDataProvider(ASYNC, OK)); 232 new SSLSocketDataProvider(ASYNC, OK));
233 if (test_type_ == SPDYNPN) { 233 if (test_type_ == SPDYNPN) {
234 ssl_->SetNextProto(SSLClientSocket::kProtoSPDY2); 234 ssl_->SetNextProto(kProtoSPDY2);
235 } 235 }
236 ssl_vector_.push_back(ssl_); 236 ssl_vector_.push_back(ssl_);
237 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) 237 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL)
238 session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_.get()); 238 session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_.get());
239 session_deps_->socket_factory->AddSocketDataProvider(data); 239 session_deps_->socket_factory->AddSocketDataProvider(data);
240 if (test_type_ == SPDYNPN) { 240 if (test_type_ == SPDYNPN) {
241 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); 241 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING);
242 linked_ptr<StaticSocketDataProvider> 242 linked_ptr<StaticSocketDataProvider>
243 hanging_non_alternate_protocol_socket( 243 hanging_non_alternate_protocol_socket(
244 new StaticSocketDataProvider(NULL, 0, NULL, 0)); 244 new StaticSocketDataProvider(NULL, 0, NULL, 0));
245 hanging_non_alternate_protocol_socket->set_connect_data( 245 hanging_non_alternate_protocol_socket->set_connect_data(
246 never_finishing_connect); 246 never_finishing_connect);
247 session_deps_->socket_factory->AddSocketDataProvider( 247 session_deps_->socket_factory->AddSocketDataProvider(
248 hanging_non_alternate_protocol_socket.get()); 248 hanging_non_alternate_protocol_socket.get());
249 alternate_vector_.push_back(hanging_non_alternate_protocol_socket); 249 alternate_vector_.push_back(hanging_non_alternate_protocol_socket);
250 } 250 }
251 } 251 }
252 252
253 void AddDeterministicData(DeterministicSocketData* data) { 253 void AddDeterministicData(DeterministicSocketData* data) {
254 DCHECK(deterministic_); 254 DCHECK(deterministic_);
255 data_vector_.push_back(data); 255 data_vector_.push_back(data);
256 linked_ptr<SSLSocketDataProvider> ssl_( 256 linked_ptr<SSLSocketDataProvider> ssl_(
257 new SSLSocketDataProvider(ASYNC, OK)); 257 new SSLSocketDataProvider(ASYNC, OK));
258 if (test_type_ == SPDYNPN) { 258 if (test_type_ == SPDYNPN) {
259 ssl_->SetNextProto(SSLClientSocket::kProtoSPDY2); 259 ssl_->SetNextProto(kProtoSPDY2);
260 } 260 }
261 ssl_vector_.push_back(ssl_); 261 ssl_vector_.push_back(ssl_);
262 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) { 262 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) {
263 session_deps_->deterministic_socket_factory-> 263 session_deps_->deterministic_socket_factory->
264 AddSSLSocketDataProvider(ssl_.get()); 264 AddSSLSocketDataProvider(ssl_.get());
265 } 265 }
266 session_deps_->deterministic_socket_factory->AddSocketDataProvider(data); 266 session_deps_->deterministic_socket_factory->AddSocketDataProvider(data);
267 if (test_type_ == SPDYNPN) { 267 if (test_type_ == SPDYNPN) {
268 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); 268 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING);
269 scoped_refptr<DeterministicSocketData> 269 scoped_refptr<DeterministicSocketData>
(...skipping 5291 matching lines...) Expand 10 before | Expand all | Expand 10 after
5561 << " Write index: " 5561 << " Write index: "
5562 << data->write_index(); 5562 << data->write_index();
5563 5563
5564 // Verify the SYN_REPLY. 5564 // Verify the SYN_REPLY.
5565 HttpResponseInfo response = *trans->GetResponseInfo(); 5565 HttpResponseInfo response = *trans->GetResponseInfo();
5566 EXPECT_TRUE(response.headers != NULL); 5566 EXPECT_TRUE(response.headers != NULL);
5567 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); 5567 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine());
5568 } 5568 }
5569 5569
5570 } // namespace net 5570 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_network_transaction_spdy21_unittest.cc ('k') | net/spdy/spdy_network_transaction_spdy3_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698