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

Unified Diff: net/quic/chromium/quic_chromium_client_stream_test.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/chromium/quic_chromium_client_stream.cc ('k') | net/quic/chromium/quic_http_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/chromium/quic_chromium_client_stream_test.cc
diff --git a/net/quic/chromium/quic_chromium_client_stream_test.cc b/net/quic/chromium/quic_chromium_client_stream_test.cc
index 735c1013457620c3265184c5782eee2e1c709ce4..abb4b85950b6abb3239b71f3f56b995ccdc045d1 100644
--- a/net/quic/chromium/quic_chromium_client_stream_test.cc
+++ b/net/quic/chromium/quic_chromium_client_stream_test.cc
@@ -44,13 +44,6 @@ class MockDelegate : public QuicChromiumClientStream::Delegate {
MOCK_METHOD0(OnSendData, int());
MOCK_METHOD2(OnSendDataComplete, int(int, bool*));
- void OnInitialHeadersAvailable(const SpdyHeaderBlock& headers,
- size_t frame_len) override {
- headers_ = headers.Clone();
- OnInitialHeadersAvailableMock(headers, frame_len);
- }
- MOCK_METHOD2(OnInitialHeadersAvailableMock,
- void(const SpdyHeaderBlock& headers, size_t frame_len));
void OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers,
size_t frame_len) override {
trailers_ = headers.Clone();
@@ -253,9 +246,10 @@ class QuicChromiumClientStreamTest
QuicHeaderList ProcessHeadersFull(const SpdyHeaderBlock& headers) {
QuicHeaderList h = ProcessHeaders(headers);
- EXPECT_CALL(delegate_, OnInitialHeadersAvailableMock(
- _, h.uncompressed_header_bytes()));
- base::RunLoop().RunUntilIdle();
+ TestCompletionCallback callback;
+ EXPECT_EQ(
+ static_cast<int>(h.uncompressed_header_bytes()),
+ handle_->ReadInitialHeaders(&delegate_.headers_, callback.callback()));
EXPECT_EQ(headers, delegate_.headers_);
EXPECT_TRUE(stream_->header_list().empty());
return h;
@@ -731,10 +725,11 @@ TEST_P(QuicChromiumClientStreamTest, HeadersBeforeDelegate) {
EXPECT_TRUE(delegate2_.headers_.empty());
// Now set the delegate and verify that the headers are delivered.
- EXPECT_CALL(delegate2_, OnInitialHeadersAvailableMock(
- _, header_list.uncompressed_header_bytes()));
handle2_ = stream2->CreateHandle(&delegate2_);
- base::RunLoop().RunUntilIdle();
+ TestCompletionCallback callback;
+ EXPECT_EQ(
+ static_cast<int>(header_list.uncompressed_header_bytes()),
+ handle2_->ReadInitialHeaders(&delegate2_.headers_, callback.callback()));
EXPECT_EQ(headers_, delegate2_.headers_);
// Both delegates should be notified that theirs streams are closed.
@@ -763,10 +758,11 @@ TEST_P(QuicChromiumClientStreamTest, HeadersAndDataBeforeDelegate) {
// Now set the delegate and verify that the headers are delivered, but
// not the data, which needs to be read explicitly.
- EXPECT_CALL(delegate2_, OnInitialHeadersAvailableMock(
- _, header_list.uncompressed_header_bytes()));
handle2_ = stream2->CreateHandle(&delegate2_);
- base::RunLoop().RunUntilIdle();
+ TestCompletionCallback callback;
+ EXPECT_EQ(
+ static_cast<int>(header_list.uncompressed_header_bytes()),
+ handle2_->ReadInitialHeaders(&delegate2_.headers_, callback.callback()));
EXPECT_EQ(headers_, delegate2_.headers_);
base::RunLoop().RunUntilIdle();
« no previous file with comments | « net/quic/chromium/quic_chromium_client_stream.cc ('k') | net/quic/chromium/quic_http_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698