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

Side by Side Diff: net/spdy/spdy_network_transaction_spdy3_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 SpdyNetworkTransactionSpdy3TestTypes { 32 enum SpdyNetworkTransactionSpdy3TestTypes {
33 SPDYNPN, 33 SPDYNPN,
34 SPDYNOSSL, 34 SPDYNOSSL,
35 SPDYSSL, 35 SPDYSSL,
36 }; 36 };
37 class SpdyNetworkTransactionSpdy3Test 37 class SpdyNetworkTransactionSpdy3Test
38 : public ::testing::TestWithParam<SpdyNetworkTransactionSpdy3TestTypes> { 38 : public ::testing::TestWithParam<SpdyNetworkTransactionSpdy3TestTypes> {
39 protected: 39 protected:
40 40
41 virtual void SetUp() { 41 virtual void SetUp() {
42 SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY3); 42 SpdySession::set_default_protocol(kProtoSPDY3);
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 RunDefaultTest(); 225 RunDefaultTest();
226 VerifyDataConsumed(); 226 VerifyDataConsumed();
227 } 227 }
228 228
229 void AddData(StaticSocketDataProvider* data) { 229 void AddData(StaticSocketDataProvider* data) {
230 DCHECK(!deterministic_); 230 DCHECK(!deterministic_);
231 data_vector_.push_back(data); 231 data_vector_.push_back(data);
232 linked_ptr<SSLSocketDataProvider> ssl_( 232 linked_ptr<SSLSocketDataProvider> ssl_(
233 new SSLSocketDataProvider(ASYNC, OK)); 233 new SSLSocketDataProvider(ASYNC, OK));
234 if (test_type_ == SPDYNPN) { 234 if (test_type_ == SPDYNPN) {
235 ssl_->SetNextProto(SSLClientSocket::kProtoSPDY3); 235 ssl_->SetNextProto(kProtoSPDY3);
236 } 236 }
237 ssl_vector_.push_back(ssl_); 237 ssl_vector_.push_back(ssl_);
238 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) 238 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL)
239 session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_.get()); 239 session_deps_->socket_factory->AddSSLSocketDataProvider(ssl_.get());
240 session_deps_->socket_factory->AddSocketDataProvider(data); 240 session_deps_->socket_factory->AddSocketDataProvider(data);
241 if (test_type_ == SPDYNPN) { 241 if (test_type_ == SPDYNPN) {
242 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); 242 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING);
243 linked_ptr<StaticSocketDataProvider> 243 linked_ptr<StaticSocketDataProvider>
244 hanging_non_alternate_protocol_socket( 244 hanging_non_alternate_protocol_socket(
245 new StaticSocketDataProvider(NULL, 0, NULL, 0)); 245 new StaticSocketDataProvider(NULL, 0, NULL, 0));
246 hanging_non_alternate_protocol_socket->set_connect_data( 246 hanging_non_alternate_protocol_socket->set_connect_data(
247 never_finishing_connect); 247 never_finishing_connect);
248 session_deps_->socket_factory->AddSocketDataProvider( 248 session_deps_->socket_factory->AddSocketDataProvider(
249 hanging_non_alternate_protocol_socket.get()); 249 hanging_non_alternate_protocol_socket.get());
250 alternate_vector_.push_back(hanging_non_alternate_protocol_socket); 250 alternate_vector_.push_back(hanging_non_alternate_protocol_socket);
251 } 251 }
252 } 252 }
253 253
254 void AddDeterministicData(DeterministicSocketData* data) { 254 void AddDeterministicData(DeterministicSocketData* data) {
255 DCHECK(deterministic_); 255 DCHECK(deterministic_);
256 data_vector_.push_back(data); 256 data_vector_.push_back(data);
257 linked_ptr<SSLSocketDataProvider> ssl_( 257 linked_ptr<SSLSocketDataProvider> ssl_(
258 new SSLSocketDataProvider(ASYNC, OK)); 258 new SSLSocketDataProvider(ASYNC, OK));
259 if (test_type_ == SPDYNPN) { 259 if (test_type_ == SPDYNPN) {
260 ssl_->SetNextProto(SSLClientSocket::kProtoSPDY3); 260 ssl_->SetNextProto(kProtoSPDY3);
261 } 261 }
262 ssl_vector_.push_back(ssl_); 262 ssl_vector_.push_back(ssl_);
263 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) { 263 if (test_type_ == SPDYNPN || test_type_ == SPDYSSL) {
264 session_deps_->deterministic_socket_factory-> 264 session_deps_->deterministic_socket_factory->
265 AddSSLSocketDataProvider(ssl_.get()); 265 AddSSLSocketDataProvider(ssl_.get());
266 } 266 }
267 session_deps_->deterministic_socket_factory->AddSocketDataProvider(data); 267 session_deps_->deterministic_socket_factory->AddSocketDataProvider(data);
268 if (test_type_ == SPDYNPN) { 268 if (test_type_ == SPDYNPN) {
269 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING); 269 MockConnect never_finishing_connect(SYNCHRONOUS, ERR_IO_PENDING);
270 scoped_refptr<DeterministicSocketData> 270 scoped_refptr<DeterministicSocketData>
(...skipping 5662 matching lines...) Expand 10 before | Expand all | Expand 10 after
5933 << " Write index: " 5933 << " Write index: "
5934 << data->write_index(); 5934 << data->write_index();
5935 5935
5936 // Verify the SYN_REPLY. 5936 // Verify the SYN_REPLY.
5937 HttpResponseInfo response = *trans->GetResponseInfo(); 5937 HttpResponseInfo response = *trans->GetResponseInfo();
5938 EXPECT_TRUE(response.headers != NULL); 5938 EXPECT_TRUE(response.headers != NULL);
5939 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); 5939 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine());
5940 } 5940 }
5941 5941
5942 } // namespace net 5942 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_network_transaction_spdy2_unittest.cc ('k') | net/spdy/spdy_proxy_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698