| Index: net/http/bidirectional_stream_unittest.cc
|
| diff --git a/net/http/bidirectional_stream_unittest.cc b/net/http/bidirectional_stream_unittest.cc
|
| index 9fa41cf62a693e7c8fefe236761cbe22cf2461eb..f804b21e06ee8014373fd7d135391b354b31a2dd 100644
|
| --- a/net/http/bidirectional_stream_unittest.cc
|
| +++ b/net/http/bidirectional_stream_unittest.cc
|
| @@ -58,12 +58,15 @@ class TestDelegateBase : public BidirectionalStream::Delegate {
|
| on_data_sent_count_(0),
|
| do_not_start_read_(false),
|
| run_until_completion_(false),
|
| - not_expect_callback_(false),
|
| - disable_auto_flush_(false) {}
|
| + not_expect_callback_(false) {}
|
|
|
| ~TestDelegateBase() override {}
|
|
|
| - void OnStreamReady() override {
|
| + void OnStreamReady(bool request_headers_sent) override {
|
| + // Request headers should always be sent in H2's case, because the
|
| + // functionality to combine header frame with data frames is not
|
| + // implemented.
|
| + EXPECT_TRUE(request_headers_sent);
|
| if (callback_.is_null())
|
| return;
|
| callback_.Run(OK);
|
| @@ -111,12 +114,11 @@ class TestDelegateBase : public BidirectionalStream::Delegate {
|
| loop_->Quit();
|
| }
|
|
|
| - void DisableAutoFlush() { disable_auto_flush_ = true; }
|
| -
|
| void Start(std::unique_ptr<BidirectionalStreamRequestInfo> request_info,
|
| HttpNetworkSession* session) {
|
| stream_.reset(new BidirectionalStream(std::move(request_info), session,
|
| - false, this, std::move(timer_)));
|
| + /*ignored*/ true, this,
|
| + std::move(timer_)));
|
| if (run_until_completion_)
|
| loop_->Run();
|
| }
|
| @@ -126,12 +128,14 @@ class TestDelegateBase : public BidirectionalStream::Delegate {
|
| const CompletionCallback& cb) {
|
| callback_ = cb;
|
| stream_.reset(new BidirectionalStream(std::move(request_info), session,
|
| - disable_auto_flush_, this,
|
| + /*ignored*/ true, this,
|
| std::move(timer_)));
|
| if (run_until_completion_)
|
| loop_->Run();
|
| }
|
|
|
| + void SendRequestHeaders() { stream_->SendRequestHeaders(); }
|
| +
|
| void SendData(const scoped_refptr<IOBuffer>& data,
|
| int length,
|
| bool end_of_stream) {
|
| @@ -222,7 +226,6 @@ class TestDelegateBase : public BidirectionalStream::Delegate {
|
| // This is to ensure that delegate callback is not invoked synchronously when
|
| // calling into |stream_|.
|
| bool not_expect_callback_;
|
| - bool disable_auto_flush_;
|
|
|
| CompletionCallback callback_;
|
| DISALLOW_COPY_AND_ASSIGN(TestDelegateBase);
|
| @@ -759,12 +762,14 @@ TEST_F(BidirectionalStreamTest, TestCoalesceSmallDataBuffers) {
|
| std::unique_ptr<TestDelegateBase> delegate(new TestDelegateBase(
|
| read_buffer.get(), kReadBufferSize, base::WrapUnique(timer)));
|
| delegate->set_do_not_start_read(true);
|
| - delegate->DisableAutoFlush();
|
| TestCompletionCallback callback;
|
| delegate->Start(std::move(request_info), http_session_.get(),
|
| callback.callback());
|
| // Wait until the stream is ready.
|
| callback.WaitForResult();
|
| + // Sending request headers explicitly should do nothing in H2's case, and it
|
| + // should not crash because headers have been sent automatically.
|
| + delegate->SendRequestHeaders();
|
| // Send a DATA frame.
|
| scoped_refptr<StringIOBuffer> buf(new StringIOBuffer(body_data.substr(0, 5)));
|
| scoped_refptr<StringIOBuffer> buf2(
|
|
|