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

Side by Side Diff: net/quic/chromium/bidirectional_stream_quic_impl_unittest.cc

Issue 2873963003: Add an async ReadInitialHeaders method to QuicChromiumClientStream::Handle (Closed)
Patch Set: Rebase Created 3 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chromium/bidirectional_stream_quic_impl.h" 5 #include "net/quic/chromium/bidirectional_stream_quic_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 ON_DATA_READ, 289 ON_DATA_READ,
290 ON_TRAILERS_RECEIVED, 290 ON_TRAILERS_RECEIVED,
291 ON_FAILED, 291 ON_FAILED,
292 }; 292 };
293 293
294 DeleteStreamDelegate(IOBuffer* buf, int buf_len, Phase phase) 294 DeleteStreamDelegate(IOBuffer* buf, int buf_len, Phase phase)
295 : TestDelegateBase(buf, buf_len), phase_(phase) {} 295 : TestDelegateBase(buf, buf_len), phase_(phase) {}
296 ~DeleteStreamDelegate() override {} 296 ~DeleteStreamDelegate() override {}
297 297
298 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override { 298 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override {
299 // Make a copy of |response_headers| before the stream is deleted, since
300 // the headers are owned by the stream.
301 SpdyHeaderBlock headers_copy = response_headers.Clone();
299 if (phase_ == ON_HEADERS_RECEIVED) { 302 if (phase_ == ON_HEADERS_RECEIVED) {
300 DeleteStream(); 303 DeleteStream();
301 } 304 }
302 TestDelegateBase::OnHeadersReceived(response_headers); 305 TestDelegateBase::OnHeadersReceived(headers_copy);
303 } 306 }
304 307
305 void OnDataSent() override { NOTREACHED(); } 308 void OnDataSent() override { NOTREACHED(); }
306 309
307 void OnDataRead(int bytes_read) override { 310 void OnDataRead(int bytes_read) override {
308 DCHECK_NE(ON_HEADERS_RECEIVED, phase_); 311 DCHECK_NE(ON_HEADERS_RECEIVED, phase_);
309 if (phase_ == ON_DATA_READ) 312 if (phase_ == ON_DATA_READ)
310 DeleteStream(); 313 DeleteStream();
311 TestDelegateBase::OnDataRead(bytes_read); 314 TestDelegateBase::OnDataRead(bytes_read);
312 } 315 }
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 1826
1824 base::RunLoop().RunUntilIdle(); 1827 base::RunLoop().RunUntilIdle();
1825 1828
1826 EXPECT_EQ(1, delegate->on_data_read_count()); 1829 EXPECT_EQ(1, delegate->on_data_read_count());
1827 EXPECT_EQ(0, delegate->on_data_sent_count()); 1830 EXPECT_EQ(0, delegate->on_data_sent_count());
1828 } 1831 }
1829 1832
1830 } // namespace test 1833 } // namespace test
1831 1834
1832 } // namespace net 1835 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/bidirectional_stream_quic_impl.cc ('k') | net/quic/chromium/quic_chromium_client_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698