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

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

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk Created 7 years, 6 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/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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 TestLoadTimingReused(*http_stream2); 309 TestLoadTimingReused(*http_stream2);
310 EXPECT_TRUE(http_stream2->GetLoadTimingInfo(&load_timing_info2)); 310 EXPECT_TRUE(http_stream2->GetLoadTimingInfo(&load_timing_info2));
311 EXPECT_EQ(load_timing_info1.socket_log_id, load_timing_info2.socket_log_id); 311 EXPECT_EQ(load_timing_info1.socket_log_id, load_timing_info2.socket_log_id);
312 312
313 // All the reads. 313 // All the reads.
314 deterministic_data()->RunFor(6); 314 deterministic_data()->RunFor(6);
315 315
316 // Read stream 1 to completion, before making sure we can still read load 316 // Read stream 1 to completion, before making sure we can still read load
317 // timing from both streams. 317 // timing from both streams.
318 scoped_refptr<IOBuffer> buf1(new IOBuffer(1)); 318 scoped_refptr<IOBuffer> buf1(new IOBuffer(1));
319 ASSERT_EQ(0, http_stream1->ReadResponseBody(buf1, 1, callback1.callback())); 319 ASSERT_EQ(
320 0, http_stream1->ReadResponseBody(buf1.get(), 1, callback1.callback()));
320 321
321 // Stream 1 has been read to completion. 322 // Stream 1 has been read to completion.
322 TestLoadTimingNotReused(*http_stream1); 323 TestLoadTimingNotReused(*http_stream1);
323 // Stream 2 still has queued body data. 324 // Stream 2 still has queued body data.
324 TestLoadTimingReused(*http_stream2); 325 TestLoadTimingReused(*http_stream2);
325 } 326 }
326 327
327 void SpdyHttpStreamSpdy3Test::RunSendChunkedPostTest( 328 void SpdyHttpStreamSpdy3Test::RunSendChunkedPostTest(
328 SpdyMajorVersion spdy_version) { 329 SpdyMajorVersion spdy_version) {
329 BufferedSpdyFramer framer(spdy_version, false); 330 BufferedSpdyFramer framer(spdy_version, false);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 deterministic_data()->RunFor(2); 482 deterministic_data()->RunFor(2);
482 483
483 // Read response headers. 484 // Read response headers.
484 deterministic_data()->RunFor(1); 485 deterministic_data()->RunFor(1);
485 ASSERT_EQ(OK, http_stream->ReadResponseHeaders(callback.callback())); 486 ASSERT_EQ(OK, http_stream->ReadResponseHeaders(callback.callback()));
486 487
487 // Read and check |chunk1| response. 488 // Read and check |chunk1| response.
488 deterministic_data()->RunFor(1); 489 deterministic_data()->RunFor(1);
489 scoped_refptr<IOBuffer> buf1(new IOBuffer(kUploadDataSize)); 490 scoped_refptr<IOBuffer> buf1(new IOBuffer(kUploadDataSize));
490 ASSERT_EQ(kUploadDataSize, 491 ASSERT_EQ(kUploadDataSize,
491 http_stream->ReadResponseBody(buf1, 492 http_stream->ReadResponseBody(
492 kUploadDataSize, 493 buf1.get(), kUploadDataSize, callback.callback()));
493 callback.callback()));
494 EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize)); 494 EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize));
495 495
496 // Read and check |chunk2| response. 496 // Read and check |chunk2| response.
497 deterministic_data()->RunFor(1); 497 deterministic_data()->RunFor(1);
498 scoped_refptr<IOBuffer> buf2(new IOBuffer(kUploadData1Size)); 498 scoped_refptr<IOBuffer> buf2(new IOBuffer(kUploadData1Size));
499 ASSERT_EQ(kUploadData1Size, 499 ASSERT_EQ(kUploadData1Size,
500 http_stream->ReadResponseBody(buf2, 500 http_stream->ReadResponseBody(
501 kUploadData1Size, 501 buf2.get(), kUploadData1Size, callback.callback()));
502 callback.callback()));
503 EXPECT_EQ(kUploadData1, std::string(buf2->data(), kUploadData1Size)); 502 EXPECT_EQ(kUploadData1, std::string(buf2->data(), kUploadData1Size));
504 503
505 // Read and check |chunk3| response. 504 // Read and check |chunk3| response.
506 deterministic_data()->RunFor(1); 505 deterministic_data()->RunFor(1);
507 scoped_refptr<IOBuffer> buf3(new IOBuffer(kUploadDataSize)); 506 scoped_refptr<IOBuffer> buf3(new IOBuffer(kUploadDataSize));
508 ASSERT_EQ(kUploadDataSize, 507 ASSERT_EQ(kUploadDataSize,
509 http_stream->ReadResponseBody(buf3, 508 http_stream->ReadResponseBody(
510 kUploadDataSize, 509 buf3.get(), kUploadDataSize, callback.callback()));
511 callback.callback()));
512 EXPECT_EQ(kUploadData, std::string(buf3->data(), kUploadDataSize)); 510 EXPECT_EQ(kUploadData, std::string(buf3->data(), kUploadDataSize));
513 511
514 // Finish reading the |EOF|. 512 // Finish reading the |EOF|.
515 deterministic_data()->RunFor(1); 513 deterministic_data()->RunFor(1);
516 ASSERT_TRUE(response.headers.get()); 514 ASSERT_TRUE(response.headers.get());
517 ASSERT_EQ(200, response.headers->response_code()); 515 ASSERT_EQ(200, response.headers->response_code());
518 EXPECT_TRUE(deterministic_data()->at_read_eof()); 516 EXPECT_TRUE(deterministic_data()->at_read_eof());
519 EXPECT_TRUE(deterministic_data()->at_write_eof()); 517 EXPECT_TRUE(deterministic_data()->at_write_eof());
520 } 518 }
521 519
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 http_stream->stream()->send_window_size()); 613 http_stream->stream()->send_window_size());
616 614
617 // Read response headers. 615 // Read response headers.
618 data.RunFor(1); 616 data.RunFor(1);
619 ASSERT_EQ(OK, http_stream->ReadResponseHeaders(callback.callback())); 617 ASSERT_EQ(OK, http_stream->ReadResponseHeaders(callback.callback()));
620 618
621 // Read and check |chunk1| response. 619 // Read and check |chunk1| response.
622 data.RunFor(1); 620 data.RunFor(1);
623 scoped_refptr<IOBuffer> buf1(new IOBuffer(kUploadDataSize)); 621 scoped_refptr<IOBuffer> buf1(new IOBuffer(kUploadDataSize));
624 ASSERT_EQ(kUploadDataSize, 622 ASSERT_EQ(kUploadDataSize,
625 http_stream->ReadResponseBody(buf1, 623 http_stream->ReadResponseBody(
626 kUploadDataSize, 624 buf1.get(), kUploadDataSize, callback.callback()));
627 callback.callback()));
628 EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize)); 625 EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize));
629 626
630 // Finish reading the |EOF|. 627 // Finish reading the |EOF|.
631 data.RunFor(1); 628 data.RunFor(1);
632 ASSERT_TRUE(response.headers.get()); 629 ASSERT_TRUE(response.headers.get());
633 ASSERT_EQ(200, response.headers->response_code()); 630 ASSERT_EQ(200, response.headers->response_code());
634 EXPECT_TRUE(data.at_read_eof()); 631 EXPECT_TRUE(data.at_read_eof());
635 EXPECT_TRUE(data.at_write_eof()); 632 EXPECT_TRUE(data.at_write_eof());
636 } 633 }
637 634
(...skipping 18 matching lines...) Expand all
656 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), writes, arraysize(writes), 653 EXPECT_EQ(OK, InitSession(reads, arraysize(reads), writes, arraysize(writes),
657 host_port_pair)); 654 host_port_pair));
658 655
659 HttpRequestInfo request; 656 HttpRequestInfo request;
660 request.method = "GET"; 657 request.method = "GET";
661 request.url = GURL(full_url); 658 request.url = GURL(full_url);
662 TestCompletionCallback callback; 659 TestCompletionCallback callback;
663 HttpResponseInfo response; 660 HttpResponseInfo response;
664 HttpRequestHeaders headers; 661 HttpRequestHeaders headers;
665 BoundNetLog net_log; 662 BoundNetLog net_log;
666 scoped_ptr<SpdyHttpStream> http_stream(new SpdyHttpStream(session_, true)); 663 scoped_ptr<SpdyHttpStream> http_stream(
667 ASSERT_EQ( 664 new SpdyHttpStream(session_.get(), true));
668 OK, 665 ASSERT_EQ(OK,
669 http_stream->InitializeStream(&request, DEFAULT_PRIORITY, 666 http_stream->InitializeStream(
670 net_log, CompletionCallback())); 667 &request, DEFAULT_PRIORITY, net_log, CompletionCallback()));
671 668
672 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response, 669 EXPECT_EQ(ERR_IO_PENDING, http_stream->SendRequest(headers, &response,
673 callback.callback())); 670 callback.callback()));
674 671
675 EXPECT_EQ(base_url, http_stream->stream()->GetUrl().spec()); 672 EXPECT_EQ(base_url, http_stream->stream()->GetUrl().spec());
676 673
677 // This triggers the MockWrite and read 2 674 // This triggers the MockWrite and read 2
678 callback.WaitForResult(); 675 callback.WaitForResult();
679 676
680 // This triggers read 3. The empty read causes the session to shut down. 677 // This triggers read 3. The empty read causes the session to shut down.
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 data.RunFor(1); 1043 data.RunFor(1);
1047 sequenced_worker_pool->Shutdown(); 1044 sequenced_worker_pool->Shutdown();
1048 } 1045 }
1049 1046
1050 #endif // !defined(USE_OPENSSL) 1047 #endif // !defined(USE_OPENSSL)
1051 1048
1052 // TODO(willchan): Write a longer test for SpdyStream that exercises all 1049 // TODO(willchan): Write a longer test for SpdyStream that exercises all
1053 // methods. 1050 // methods.
1054 1051
1055 } // namespace net 1052 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_http_stream_spdy2_unittest.cc ('k') | net/spdy/spdy_network_transaction_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698