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

Unified Diff: net/quic/chromium/quic_chromium_client_stream_test.cc

Issue 2900533002: Add an async ReadTrailers method to QuicChromiumClientStream::Handle (Closed)
Patch Set: Fix comments 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 0623610f878860b1d4fed8e093a2e23bf693f2fb..bb20cb32ecd51c9380988202feaf3475f9a5e78f 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 OnTrailingHeadersAvailable(const SpdyHeaderBlock& headers,
- size_t frame_len) override {
- trailers_ = headers.Clone();
- OnTrailingHeadersAvailableMock(headers, frame_len);
- }
- MOCK_METHOD2(OnTrailingHeadersAvailableMock,
- void(const SpdyHeaderBlock& headers, size_t frame_len));
MOCK_METHOD0(OnClose, void());
MOCK_METHOD1(OnError, void(int));
MOCK_METHOD0(HasSendHeadersComplete, bool());
@@ -503,12 +496,11 @@ TEST_P(QuicChromiumClientStreamTest, OnTrailers) {
trailers[kFinalOffsetHeaderKey] = base::IntToString(strlen(data));
auto t = ProcessTrailers(trailers);
- base::RunLoop run_loop;
- EXPECT_CALL(delegate_,
- OnTrailingHeadersAvailableMock(_, t.uncompressed_header_bytes()))
- .WillOnce(testing::InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); }));
- run_loop.Run();
+ TestCompletionCallback trailers_callback;
+ EXPECT_EQ(static_cast<int>(t.uncompressed_header_bytes()),
+ handle_->ReadTrailingHeaders(&delegate_.trailers_,
+ trailers_callback.callback()));
// Read the body and verify that it arrives correctly.
EXPECT_EQ(0,
@@ -550,13 +542,9 @@ TEST_P(QuicChromiumClientStreamTest, MarkTrailersConsumedWhenNotifyDelegate) {
QuicHeaderList t = ProcessTrailers(trailers);
EXPECT_FALSE(stream_->IsDoneReading());
- base::RunLoop run_loop2;
- EXPECT_CALL(delegate_,
- OnTrailingHeadersAvailableMock(_, t.uncompressed_header_bytes()))
- .WillOnce(
- testing::InvokeWithoutArgs([&run_loop2]() { run_loop2.Quit(); }));
-
- run_loop2.Run();
+ EXPECT_EQ(
+ static_cast<int>(t.uncompressed_header_bytes()),
+ handle_->ReadTrailingHeaders(&delegate_.trailers_, callback.callback()));
// Read the body and verify that it arrives correctly.
EXPECT_EQ(0, callback.WaitForResult());
@@ -607,13 +595,10 @@ TEST_P(QuicChromiumClientStreamTest, ReadAfterTrailersReceivedButNotDelivered) {
// Trailers are not delivered
EXPECT_FALSE(stream_->IsDoneReading());
- base::RunLoop run_loop2;
- EXPECT_CALL(delegate_,
- OnTrailingHeadersAvailableMock(_, t.uncompressed_header_bytes()))
- .WillOnce(
- testing::InvokeWithoutArgs([&run_loop2]() { run_loop2.Quit(); }));
-
- run_loop2.Run();
+ TestCompletionCallback callback2;
+ EXPECT_EQ(
+ static_cast<int>(t.uncompressed_header_bytes()),
+ handle_->ReadTrailingHeaders(&delegate_.trailers_, callback2.callback()));
// Read the body and verify that it arrives correctly.
// OnDataAvailable() should follow right after and Read() will return 0.
« 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