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

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

Issue 18546008: [SPDY] Use WeakPtr<SpdySession> everywhere but SpdySessionPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test, other minor formatting/comment changes Created 7 years, 5 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
« no previous file with comments | « net/spdy/spdy_http_stream.cc ('k') | net/spdy/spdy_network_transaction_unittest.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/spdy/spdy_http_stream.h" 5 #include "net/spdy/spdy_http_stream.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 ServerBoundCertService* server_bound_cert_service, 114 ServerBoundCertService* server_bound_cert_service,
115 const std::string& cert, 115 const std::string& cert,
116 const std::string& proof); 116 const std::string& proof);
117 117
118 SpdyTestUtil spdy_util_; 118 SpdyTestUtil spdy_util_;
119 CapturingNetLog net_log_; 119 CapturingNetLog net_log_;
120 SpdySessionDependencies session_deps_; 120 SpdySessionDependencies session_deps_;
121 scoped_ptr<OrderedSocketData> data_; 121 scoped_ptr<OrderedSocketData> data_;
122 scoped_ptr<DeterministicSocketData> deterministic_data_; 122 scoped_ptr<DeterministicSocketData> deterministic_data_;
123 scoped_refptr<HttpNetworkSession> http_session_; 123 scoped_refptr<HttpNetworkSession> http_session_;
124 scoped_refptr<SpdySession> session_; 124 base::WeakPtr<SpdySession> session_;
125 125
126 private: 126 private:
127 MockECSignatureCreatorFactory ec_signature_creator_factory_; 127 MockECSignatureCreatorFactory ec_signature_creator_factory_;
128 }; 128 };
129 129
130 INSTANTIATE_TEST_CASE_P( 130 INSTANTIATE_TEST_CASE_P(
131 NextProto, 131 NextProto,
132 SpdyHttpStreamTest, 132 SpdyHttpStreamTest,
133 testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2)); 133 testing::Values(kProtoSPDY2, kProtoSPDY3, kProtoSPDY31, kProtoSPDY4a2));
134 134
135 // SpdyHttpStream::GetUploadProgress() should still work even before the 135 // SpdyHttpStream::GetUploadProgress() should still work even before the
136 // stream is initialized. 136 // stream is initialized.
137 TEST_P(SpdyHttpStreamTest, GetUploadProgressBeforeInitialization) { 137 TEST_P(SpdyHttpStreamTest, GetUploadProgressBeforeInitialization) {
138 MockRead reads[] = { 138 MockRead reads[] = {
139 MockRead(ASYNC, 0, 0) // EOF 139 MockRead(ASYNC, 0, 0) // EOF
140 }; 140 };
141 141
142 HostPortPair host_port_pair("www.google.com", 80); 142 HostPortPair host_port_pair("www.google.com", 80);
143 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), 143 SpdySessionKey key(host_port_pair, ProxyServer::Direct(),
144 kPrivacyModeDisabled); 144 kPrivacyModeDisabled);
145 InitSession(reads, arraysize(reads), NULL, 0, key); 145 InitSession(reads, arraysize(reads), NULL, 0, key);
146 146
147 SpdyHttpStream stream(session_.get(), false); 147 SpdyHttpStream stream(session_, false);
148 UploadProgress progress = stream.GetUploadProgress(); 148 UploadProgress progress = stream.GetUploadProgress();
149 EXPECT_EQ(0u, progress.size()); 149 EXPECT_EQ(0u, progress.size());
150 EXPECT_EQ(0u, progress.position()); 150 EXPECT_EQ(0u, progress.position());
151 } 151 }
152 152
153 TEST_P(SpdyHttpStreamTest, SendRequest) { 153 TEST_P(SpdyHttpStreamTest, SendRequest) {
154 scoped_ptr<SpdyFrame> req( 154 scoped_ptr<SpdyFrame> req(
155 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true)); 155 spdy_util_.ConstructSpdyGet(NULL, 0, false, 1, LOWEST, true));
156 MockWrite writes[] = { 156 MockWrite writes[] = {
157 CreateMockWrite(*req.get(), 1), 157 CreateMockWrite(*req.get(), 1),
158 }; 158 };
159 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1)); 159 scoped_ptr<SpdyFrame> resp(spdy_util_.ConstructSpdyGetSynReply(NULL, 0, 1));
160 MockRead reads[] = { 160 MockRead reads[] = {
161 CreateMockRead(*resp, 2), 161 CreateMockRead(*resp, 2),
162 MockRead(SYNCHRONOUS, 0, 3) // EOF 162 MockRead(SYNCHRONOUS, 0, 3) // EOF
163 }; 163 };
164 164
165 HostPortPair host_port_pair("www.google.com", 80); 165 HostPortPair host_port_pair("www.google.com", 80);
166 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), 166 SpdySessionKey key(host_port_pair, ProxyServer::Direct(),
167 kPrivacyModeDisabled); 167 kPrivacyModeDisabled);
168 InitSession(reads, arraysize(reads), writes, arraysize(writes), key); 168 InitSession(reads, arraysize(reads), writes, arraysize(writes), key);
169 169
170 HttpRequestInfo request; 170 HttpRequestInfo request;
171 request.method = "GET"; 171 request.method = "GET";
172 request.url = GURL("http://www.google.com/"); 172 request.url = GURL("http://www.google.com/");
173 TestCompletionCallback callback; 173 TestCompletionCallback callback;
174 HttpResponseInfo response; 174 HttpResponseInfo response;
175 HttpRequestHeaders headers; 175 HttpRequestHeaders headers;
176 BoundNetLog net_log; 176 BoundNetLog net_log;
177 scoped_ptr<SpdyHttpStream> http_stream( 177 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true));
178 new SpdyHttpStream(session_.get(), true));
179 // Make sure getting load timing information the stream early does not crash. 178 // Make sure getting load timing information the stream early does not crash.
180 LoadTimingInfo load_timing_info; 179 LoadTimingInfo load_timing_info;
181 EXPECT_FALSE(http_stream->GetLoadTimingInfo(&load_timing_info)); 180 EXPECT_FALSE(http_stream->GetLoadTimingInfo(&load_timing_info));
182 181
183 ASSERT_EQ( 182 ASSERT_EQ(
184 OK, 183 OK,
185 http_stream->InitializeStream(&request, DEFAULT_PRIORITY, 184 http_stream->InitializeStream(&request, DEFAULT_PRIORITY,
186 net_log, CompletionCallback())); 185 net_log, CompletionCallback()));
187 EXPECT_FALSE(http_stream->GetLoadTimingInfo(&load_timing_info)); 186 EXPECT_FALSE(http_stream->GetLoadTimingInfo(&load_timing_info));
188 187
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 InitSessionDeterministic(reads, arraysize(reads), 243 InitSessionDeterministic(reads, arraysize(reads),
245 writes, arraysize(writes), 244 writes, arraysize(writes),
246 key); 245 key);
247 246
248 HttpRequestInfo request1; 247 HttpRequestInfo request1;
249 request1.method = "GET"; 248 request1.method = "GET";
250 request1.url = GURL("http://www.google.com/"); 249 request1.url = GURL("http://www.google.com/");
251 TestCompletionCallback callback1; 250 TestCompletionCallback callback1;
252 HttpResponseInfo response1; 251 HttpResponseInfo response1;
253 HttpRequestHeaders headers1; 252 HttpRequestHeaders headers1;
254 scoped_ptr<SpdyHttpStream> http_stream1( 253 scoped_ptr<SpdyHttpStream> http_stream1(new SpdyHttpStream(session_, true));
255 new SpdyHttpStream(session_.get(), true));
256 254
257 HttpRequestInfo request2; 255 HttpRequestInfo request2;
258 request2.method = "GET"; 256 request2.method = "GET";
259 request2.url = GURL("http://www.google.com/"); 257 request2.url = GURL("http://www.google.com/");
260 TestCompletionCallback callback2; 258 TestCompletionCallback callback2;
261 HttpResponseInfo response2; 259 HttpResponseInfo response2;
262 HttpRequestHeaders headers2; 260 HttpRequestHeaders headers2;
263 scoped_ptr<SpdyHttpStream> http_stream2( 261 scoped_ptr<SpdyHttpStream> http_stream2(new SpdyHttpStream(session_, true));
264 new SpdyHttpStream(session_.get(), true));
265 262
266 // First write. 263 // First write.
267 ASSERT_EQ(OK, 264 ASSERT_EQ(OK,
268 http_stream1->InitializeStream(&request1, DEFAULT_PRIORITY, 265 http_stream1->InitializeStream(&request1, DEFAULT_PRIORITY,
269 BoundNetLog(), 266 BoundNetLog(),
270 CompletionCallback())); 267 CompletionCallback()));
271 EXPECT_EQ(ERR_IO_PENDING, http_stream1->SendRequest(headers1, &response1, 268 EXPECT_EQ(ERR_IO_PENDING, http_stream1->SendRequest(headers1, &response1,
272 callback1.callback())); 269 callback1.callback()));
273 EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key)); 270 EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key));
274 271
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 request.method = "POST"; 344 request.method = "POST";
348 request.url = GURL("http://www.google.com/"); 345 request.url = GURL("http://www.google.com/");
349 request.upload_data_stream = &upload_stream; 346 request.upload_data_stream = &upload_stream;
350 347
351 ASSERT_EQ(OK, upload_stream.Init(CompletionCallback())); 348 ASSERT_EQ(OK, upload_stream.Init(CompletionCallback()));
352 349
353 TestCompletionCallback callback; 350 TestCompletionCallback callback;
354 HttpResponseInfo response; 351 HttpResponseInfo response;
355 HttpRequestHeaders headers; 352 HttpRequestHeaders headers;
356 BoundNetLog net_log; 353 BoundNetLog net_log;
357 SpdyHttpStream http_stream(session_.get(), true); 354 SpdyHttpStream http_stream(session_, true);
358 ASSERT_EQ( 355 ASSERT_EQ(
359 OK, 356 OK,
360 http_stream.InitializeStream(&request, DEFAULT_PRIORITY, 357 http_stream.InitializeStream(&request, DEFAULT_PRIORITY,
361 net_log, CompletionCallback())); 358 net_log, CompletionCallback()));
362 359
363 EXPECT_EQ(ERR_IO_PENDING, http_stream.SendRequest( 360 EXPECT_EQ(ERR_IO_PENDING, http_stream.SendRequest(
364 headers, &response, callback.callback())); 361 headers, &response, callback.callback()));
365 EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key)); 362 EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key));
366 363
367 // This results in writing the post body and reading the response headers. 364 // This results in writing the post body and reading the response headers.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 413
417 HttpRequestInfo request; 414 HttpRequestInfo request;
418 request.method = "POST"; 415 request.method = "POST";
419 request.url = GURL("http://www.google.com/"); 416 request.url = GURL("http://www.google.com/");
420 request.upload_data_stream = &upload_stream; 417 request.upload_data_stream = &upload_stream;
421 418
422 ASSERT_EQ(OK, upload_stream.Init(CompletionCallback())); 419 ASSERT_EQ(OK, upload_stream.Init(CompletionCallback()));
423 upload_stream.AppendChunk(kUploadData, kUploadDataSize, false); 420 upload_stream.AppendChunk(kUploadData, kUploadDataSize, false);
424 421
425 BoundNetLog net_log; 422 BoundNetLog net_log;
426 scoped_ptr<SpdyHttpStream> http_stream( 423 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true));
427 new SpdyHttpStream(session_.get(), true));
428 ASSERT_EQ(OK, http_stream->InitializeStream(&request, DEFAULT_PRIORITY, 424 ASSERT_EQ(OK, http_stream->InitializeStream(&request, DEFAULT_PRIORITY,
429 net_log, CompletionCallback())); 425 net_log, CompletionCallback()));
430 426
431 TestCompletionCallback callback; 427 TestCompletionCallback callback;
432 HttpRequestHeaders headers; 428 HttpRequestHeaders headers;
433 HttpResponseInfo response; 429 HttpResponseInfo response;
434 // This will attempt to Write() the initial request and headers, which will 430 // This will attempt to Write() the initial request and headers, which will
435 // complete asynchronously. 431 // complete asynchronously.
436 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response, 432 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response,
437 callback.callback())); 433 callback.callback()));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 kPrivacyModeDisabled); 501 kPrivacyModeDisabled);
506 InitSession(reads, arraysize(reads), writes, arraysize(writes), key); 502 InitSession(reads, arraysize(reads), writes, arraysize(writes), key);
507 503
508 HttpRequestInfo request; 504 HttpRequestInfo request;
509 request.method = "GET"; 505 request.method = "GET";
510 request.url = GURL(full_url); 506 request.url = GURL(full_url);
511 TestCompletionCallback callback; 507 TestCompletionCallback callback;
512 HttpResponseInfo response; 508 HttpResponseInfo response;
513 HttpRequestHeaders headers; 509 HttpRequestHeaders headers;
514 BoundNetLog net_log; 510 BoundNetLog net_log;
515 scoped_ptr<SpdyHttpStream> http_stream( 511 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true));
516 new SpdyHttpStream(session_.get(), true));
517 ASSERT_EQ(OK, 512 ASSERT_EQ(OK,
518 http_stream->InitializeStream( 513 http_stream->InitializeStream(
519 &request, DEFAULT_PRIORITY, net_log, CompletionCallback())); 514 &request, DEFAULT_PRIORITY, net_log, CompletionCallback()));
520 515
521 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response, 516 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response,
522 callback.callback())); 517 callback.callback()));
523 518
524 EXPECT_EQ(base_url, http_stream->stream()->GetUrlFromHeaders().spec()); 519 EXPECT_EQ(base_url, http_stream->stream()->GetUrlFromHeaders().spec());
525 520
526 // This triggers the MockWrite and read 2 521 // This triggers the MockWrite and read 2
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 http_session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( 644 http_session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic(
650 &session_deps_); 645 &session_deps_);
651 session_ = CreateSecureSpdySession(http_session_, key, BoundNetLog()); 646 session_ = CreateSecureSpdySession(http_session_, key, BoundNetLog());
652 647
653 HttpRequestInfo request; 648 HttpRequestInfo request;
654 request.method = "GET"; 649 request.method = "GET";
655 request.url = GURL(kUrl1); 650 request.url = GURL(kUrl1);
656 HttpResponseInfo response; 651 HttpResponseInfo response;
657 HttpRequestHeaders headers; 652 HttpRequestHeaders headers;
658 BoundNetLog net_log; 653 BoundNetLog net_log;
659 scoped_ptr<SpdyHttpStream> http_stream( 654 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true));
660 new SpdyHttpStream(session_.get(), true));
661 ASSERT_EQ( 655 ASSERT_EQ(
662 OK, 656 OK,
663 http_stream->InitializeStream(&request, DEFAULT_PRIORITY, 657 http_stream->InitializeStream(&request, DEFAULT_PRIORITY,
664 net_log, CompletionCallback())); 658 net_log, CompletionCallback()));
665 659
666 // EXPECT_FALSE(session_->NeedsCredentials(request.url)); 660 // EXPECT_FALSE(session_->NeedsCredentials(request.url));
667 // GURL new_origin(kUrl2); 661 // GURL new_origin(kUrl2);
668 // EXPECT_TRUE(session_->NeedsCredentials(new_origin)); 662 // EXPECT_TRUE(session_->NeedsCredentials(new_origin));
669 663
670 TestCompletionCallback callback; 664 TestCompletionCallback callback;
671 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response, 665 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response,
672 callback.callback())); 666 callback.callback()));
673 EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key)); 667 EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key));
674 668
675 data.RunFor(2); 669 data.RunFor(2);
676 callback.WaitForResult(); 670 callback.WaitForResult();
677 671
678 // Start up second request for resource on a new origin. 672 // Start up second request for resource on a new origin.
679 scoped_ptr<SpdyHttpStream> http_stream2( 673 scoped_ptr<SpdyHttpStream> http_stream2(new SpdyHttpStream(session_, true));
680 new SpdyHttpStream(session_.get(), true));
681 request.url = GURL(kUrl2); 674 request.url = GURL(kUrl2);
682 ASSERT_EQ( 675 ASSERT_EQ(
683 OK, 676 OK,
684 http_stream2->InitializeStream(&request, DEFAULT_PRIORITY, 677 http_stream2->InitializeStream(&request, DEFAULT_PRIORITY,
685 net_log, CompletionCallback())); 678 net_log, CompletionCallback()));
686 EXPECT_EQ(ERR_IO_PENDING, http_stream2->SendRequest(headers, &response, 679 EXPECT_EQ(ERR_IO_PENDING, http_stream2->SendRequest(headers, &response,
687 callback.callback())); 680 callback.callback()));
688 data.RunFor(2); 681 data.RunFor(2);
689 callback.WaitForResult(); 682 callback.WaitForResult();
690 683
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 725
733 HttpRequestInfo request; 726 HttpRequestInfo request;
734 request.method = "POST"; 727 request.method = "POST";
735 request.url = GURL("http://www.google.com/"); 728 request.url = GURL("http://www.google.com/");
736 request.upload_data_stream = &upload_stream; 729 request.upload_data_stream = &upload_stream;
737 730
738 ASSERT_EQ(OK, upload_stream.Init(CompletionCallback())); 731 ASSERT_EQ(OK, upload_stream.Init(CompletionCallback()));
739 upload_stream.AppendChunk(kUploadData, kUploadDataSize, true); 732 upload_stream.AppendChunk(kUploadData, kUploadDataSize, true);
740 733
741 BoundNetLog net_log; 734 BoundNetLog net_log;
742 scoped_ptr<SpdyHttpStream> http_stream( 735 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true));
743 new SpdyHttpStream(session_.get(), true));
744 ASSERT_EQ(OK, http_stream->InitializeStream(&request, DEFAULT_PRIORITY, 736 ASSERT_EQ(OK, http_stream->InitializeStream(&request, DEFAULT_PRIORITY,
745 net_log, CompletionCallback())); 737 net_log, CompletionCallback()));
746 738
747 HttpRequestHeaders headers; 739 HttpRequestHeaders headers;
748 HttpResponseInfo response; 740 HttpResponseInfo response;
749 // This will attempt to Write() the initial request and headers, which will 741 // This will attempt to Write() the initial request and headers, which will
750 // complete asynchronously. 742 // complete asynchronously.
751 TestCompletionCallback callback; 743 TestCompletionCallback callback;
752 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response, 744 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response,
753 callback.callback())); 745 callback.callback()));
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 InitSessionDeterministic(reads, arraysize(reads), 851 InitSessionDeterministic(reads, arraysize(reads),
860 writes, arraysize(writes), 852 writes, arraysize(writes),
861 key); 853 key);
862 854
863 HttpRequestInfo request; 855 HttpRequestInfo request;
864 request.method = "GET"; 856 request.method = "GET";
865 request.url = GURL(kUrl1); 857 request.url = GURL(kUrl1);
866 HttpResponseInfo response; 858 HttpResponseInfo response;
867 HttpRequestHeaders headers; 859 HttpRequestHeaders headers;
868 BoundNetLog net_log; 860 BoundNetLog net_log;
869 scoped_ptr<SpdyHttpStream> http_stream( 861 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true));
870 new SpdyHttpStream(session_.get(), true));
871 ASSERT_EQ( 862 ASSERT_EQ(
872 OK, 863 OK,
873 http_stream->InitializeStream(&request, DEFAULT_PRIORITY, 864 http_stream->InitializeStream(&request, DEFAULT_PRIORITY,
874 net_log, CompletionCallback())); 865 net_log, CompletionCallback()));
875 866
876 TestCompletionCallback callback; 867 TestCompletionCallback callback;
877 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response, 868 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response,
878 callback.callback())); 869 callback.callback()));
879 EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key)); 870 EXPECT_TRUE(HasSpdySession(http_session_->spdy_session_pool(), key));
880 871
881 deterministic_data_->RunFor(2); 872 deterministic_data_->RunFor(2);
882 EXPECT_EQ(OK, callback.WaitForResult()); 873 EXPECT_EQ(OK, callback.WaitForResult());
883 874
884 // Start up second request for resource on a new origin. 875 // Start up second request for resource on a new origin.
885 scoped_ptr<SpdyHttpStream> http_stream2( 876 scoped_ptr<SpdyHttpStream> http_stream2(new SpdyHttpStream(session_, true));
886 new SpdyHttpStream(session_.get(), true));
887 request.url = GURL(kUrl2); 877 request.url = GURL(kUrl2);
888 ASSERT_EQ( 878 ASSERT_EQ(
889 OK, 879 OK,
890 http_stream2->InitializeStream(&request, DEFAULT_PRIORITY, 880 http_stream2->InitializeStream(&request, DEFAULT_PRIORITY,
891 net_log, CompletionCallback())); 881 net_log, CompletionCallback()));
892 EXPECT_EQ(ERR_IO_PENDING, http_stream2->SendRequest(headers, &response, 882 EXPECT_EQ(ERR_IO_PENDING, http_stream2->SendRequest(headers, &response,
893 callback.callback())); 883 callback.callback()));
894 deterministic_data_->RunFor(1); 884 deterministic_data_->RunFor(1);
895 EXPECT_EQ(OK, callback.WaitForResult()); 885 EXPECT_EQ(OK, callback.WaitForResult());
896 886
897 EXPECT_EQ(ERR_IO_PENDING, http_stream2->ReadResponseHeaders( 887 EXPECT_EQ(ERR_IO_PENDING, http_stream2->ReadResponseHeaders(
898 callback.callback())); 888 callback.callback()));
899 deterministic_data_->RunFor(1); 889 deterministic_data_->RunFor(1);
900 EXPECT_EQ(OK, callback.WaitForResult()); 890 EXPECT_EQ(OK, callback.WaitForResult());
901 ASSERT_TRUE(response.headers.get() != NULL); 891 ASSERT_TRUE(response.headers.get() != NULL);
902 ASSERT_EQ(200, response.headers->response_code()); 892 ASSERT_EQ(200, response.headers->response_code());
903 deterministic_data_->RunFor(1); 893 deterministic_data_->RunFor(1);
904 sequenced_worker_pool->Shutdown(); 894 sequenced_worker_pool->Shutdown();
905 } 895 }
906 896
907 #endif // !defined(USE_OPENSSL) 897 #endif // !defined(USE_OPENSSL)
908 898
909 // TODO(willchan): Write a longer test for SpdyStream that exercises all 899 // TODO(willchan): Write a longer test for SpdyStream that exercises all
910 // methods. 900 // methods.
911 901
912 } // namespace net 902 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_http_stream.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698