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

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

Issue 2908243002: Remove QuicChromiumClientStream::Delegate in favor of async methods. (Closed)
Patch Set: Rebase Created 3 years, 6 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 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 TestCompletionCallback cb; 1711 TestCompletionCallback cb;
1712 int rv = delegate->ReadData(cb.callback()); 1712 int rv = delegate->ReadData(cb.callback());
1713 EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); 1713 EXPECT_THAT(rv, IsError(ERR_IO_PENDING));
1714 session()->connection()->CloseConnection( 1714 session()->connection()->CloseConnection(
1715 QUIC_NO_ERROR, "test", ConnectionCloseBehavior::SILENT_CLOSE); 1715 QUIC_NO_ERROR, "test", ConnectionCloseBehavior::SILENT_CLOSE);
1716 delegate->WaitUntilNextCallback(kOnFailed); 1716 delegate->WaitUntilNextCallback(kOnFailed);
1717 1717
1718 // Try to send data after OnFailed(), should not get called back. 1718 // Try to send data after OnFailed(), should not get called back.
1719 scoped_refptr<StringIOBuffer> buf(new StringIOBuffer(kUploadData)); 1719 scoped_refptr<StringIOBuffer> buf(new StringIOBuffer(kUploadData));
1720 delegate->SendData(buf, buf->size(), false); 1720 delegate->SendData(buf, buf->size(), false);
1721 base::RunLoop().RunUntilIdle();
1722 1721
1723 EXPECT_THAT(delegate->ReadData(cb.callback()), IsError(ERR_UNEXPECTED)); 1722 EXPECT_THAT(delegate->ReadData(cb.callback()),
1724 EXPECT_THAT(delegate->error(), IsError(ERR_UNEXPECTED)); 1723 IsError(ERR_QUIC_PROTOCOL_ERROR));
1724 EXPECT_THAT(delegate->error(), IsError(ERR_QUIC_PROTOCOL_ERROR));
1725 EXPECT_EQ(0, delegate->on_data_read_count()); 1725 EXPECT_EQ(0, delegate->on_data_read_count());
1726 EXPECT_EQ(0, delegate->on_data_sent_count()); 1726 EXPECT_EQ(0, delegate->on_data_sent_count());
1727 EXPECT_EQ(kProtoQUIC, delegate->GetProtocol()); 1727 EXPECT_EQ(kProtoQUIC, delegate->GetProtocol());
1728 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length), 1728 EXPECT_EQ(static_cast<int64_t>(spdy_request_headers_frame_length),
1729 delegate->GetTotalSentBytes()); 1729 delegate->GetTotalSentBytes());
1730 EXPECT_EQ(static_cast<int64_t>(spdy_response_headers_frame_length), 1730 EXPECT_EQ(static_cast<int64_t>(spdy_response_headers_frame_length),
1731 delegate->GetTotalReceivedBytes()); 1731 delegate->GetTotalReceivedBytes());
1732 } 1732 }
1733 1733
1734 TEST_P(BidirectionalStreamQuicImplTest, SessionClosedBeforeStartConfirmed) { 1734 TEST_P(BidirectionalStreamQuicImplTest, SessionClosedBeforeStartConfirmed) {
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
2118 2118
2119 base::RunLoop().RunUntilIdle(); 2119 base::RunLoop().RunUntilIdle();
2120 2120
2121 EXPECT_EQ(1, delegate->on_data_read_count()); 2121 EXPECT_EQ(1, delegate->on_data_read_count());
2122 EXPECT_EQ(0, delegate->on_data_sent_count()); 2122 EXPECT_EQ(0, delegate->on_data_sent_count());
2123 } 2123 }
2124 2124
2125 } // namespace test 2125 } // namespace test
2126 2126
2127 } // namespace net 2127 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698