| OLD | NEW |
| 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_chromium_client_stream.h" | 5 #include "net/quic/quic_chromium_client_stream.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 470 |
| 471 scoped_refptr<StringIOBuffer> buf1(new StringIOBuffer("hello world!")); | 471 scoped_refptr<StringIOBuffer> buf1(new StringIOBuffer("hello world!")); |
| 472 scoped_refptr<StringIOBuffer> buf2( | 472 scoped_refptr<StringIOBuffer> buf2( |
| 473 new StringIOBuffer("Just a small payload")); | 473 new StringIOBuffer("Just a small payload")); |
| 474 | 474 |
| 475 // All data written. | 475 // All data written. |
| 476 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _)) | 476 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _)) |
| 477 .WillOnce(Return(QuicConsumedData(buf1->size(), false))) | 477 .WillOnce(Return(QuicConsumedData(buf1->size(), false))) |
| 478 .WillOnce(Return(QuicConsumedData(buf2->size(), true))); | 478 .WillOnce(Return(QuicConsumedData(buf2->size(), true))); |
| 479 TestCompletionCallback callback; | 479 TestCompletionCallback callback; |
| 480 EXPECT_EQ(OK, stream_->WritevStreamData({buf1.get(), buf2.get()}, | 480 EXPECT_EQ( |
| 481 {buf1->size(), buf2->size()}, true, | 481 OK, stream_->WritevStreamData({buf1, buf2}, {buf1->size(), buf2->size()}, |
| 482 callback.callback())); | 482 true, callback.callback())); |
| 483 } | 483 } |
| 484 | 484 |
| 485 TEST_P(QuicChromiumClientStreamTest, WritevStreamDataAsync) { | 485 TEST_P(QuicChromiumClientStreamTest, WritevStreamDataAsync) { |
| 486 EXPECT_CALL(delegate_, HasSendHeadersComplete()).Times(AnyNumber()); | 486 EXPECT_CALL(delegate_, HasSendHeadersComplete()).Times(AnyNumber()); |
| 487 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); | 487 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); |
| 488 | 488 |
| 489 scoped_refptr<StringIOBuffer> buf1(new StringIOBuffer("hello world!")); | 489 scoped_refptr<StringIOBuffer> buf1(new StringIOBuffer("hello world!")); |
| 490 scoped_refptr<StringIOBuffer> buf2( | 490 scoped_refptr<StringIOBuffer> buf2( |
| 491 new StringIOBuffer("Just a small payload")); | 491 new StringIOBuffer("Just a small payload")); |
| 492 | 492 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 stream->SetDelegate(&delegate_); | 530 stream->SetDelegate(&delegate_); |
| 531 base::MessageLoop::current()->RunUntilIdle(); | 531 base::MessageLoop::current()->RunUntilIdle(); |
| 532 | 532 |
| 533 // Times(2) because OnClose will be called for stream and stream_. | 533 // Times(2) because OnClose will be called for stream and stream_. |
| 534 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)).Times(2); | 534 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)).Times(2); |
| 535 } | 535 } |
| 536 | 536 |
| 537 } // namespace | 537 } // namespace |
| 538 } // namespace test | 538 } // namespace test |
| 539 } // namespace net | 539 } // namespace net |
| OLD | NEW |