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

Side by Side Diff: net/quic/quic_reliable_client_stream_test.cc

Issue 76723002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation error Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_received_packet_manager_test.cc ('k') | net/quic/quic_sent_packet_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/quic_reliable_client_stream.h" 5 #include "net/quic/quic_reliable_client_stream.h"
6 6
7 #include "net/base/net_errors.h" 7 #include "net/base/net_errors.h"
8 #include "net/base/test_completion_callback.h" 8 #include "net/base/test_completion_callback.h"
9 #include "net/quic/quic_client_session.h" 9 #include "net/quic/quic_client_session.h"
10 #include "net/quic/quic_utils.h" 10 #include "net/quic/quic_utils.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 EXPECT_FALSE(stream_.GetDelegate()); 80 EXPECT_FALSE(stream_.GetDelegate());
81 } 81 }
82 82
83 TEST_F(QuicReliableClientStreamTest, WriteStreamData) { 83 TEST_F(QuicReliableClientStreamTest, WriteStreamData) {
84 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); 84 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR));
85 85
86 const char kData1[] = "hello world"; 86 const char kData1[] = "hello world";
87 const size_t kDataLen = arraysize(kData1); 87 const size_t kDataLen = arraysize(kData1);
88 88
89 // All data written. 89 // All data written.
90 EXPECT_CALL(session_, WritevData(stream_.id(), _, _, _, _)).WillOnce( 90 EXPECT_CALL(session_, WritevData(stream_.id(), _, _, _, _, _)).WillOnce(
91 Return(QuicConsumedData(kDataLen, true))); 91 Return(QuicConsumedData(kDataLen, true)));
92 TestCompletionCallback callback; 92 TestCompletionCallback callback;
93 EXPECT_EQ(OK, stream_.WriteStreamData(base::StringPiece(kData1, kDataLen), 93 EXPECT_EQ(OK, stream_.WriteStreamData(base::StringPiece(kData1, kDataLen),
94 true, callback.callback())); 94 true, callback.callback()));
95 } 95 }
96 96
97 TEST_F(QuicReliableClientStreamTest, WriteStreamDataAsync) { 97 TEST_F(QuicReliableClientStreamTest, WriteStreamDataAsync) {
98 EXPECT_CALL(delegate_, HasSendHeadersComplete()); 98 EXPECT_CALL(delegate_, HasSendHeadersComplete());
99 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); 99 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR));
100 100
101 const char kData1[] = "hello world"; 101 const char kData1[] = "hello world";
102 const size_t kDataLen = arraysize(kData1); 102 const size_t kDataLen = arraysize(kData1);
103 103
104 // No data written. 104 // No data written.
105 EXPECT_CALL(session_, WritevData(stream_.id(), _, _, _, _)).WillOnce( 105 EXPECT_CALL(session_, WritevData(stream_.id(), _, _, _, _, _)).WillOnce(
106 Return(QuicConsumedData(0, false))); 106 Return(QuicConsumedData(0, false)));
107 TestCompletionCallback callback; 107 TestCompletionCallback callback;
108 EXPECT_EQ(ERR_IO_PENDING, 108 EXPECT_EQ(ERR_IO_PENDING,
109 stream_.WriteStreamData(base::StringPiece(kData1, kDataLen), 109 stream_.WriteStreamData(base::StringPiece(kData1, kDataLen),
110 true, callback.callback())); 110 true, callback.callback()));
111 ASSERT_FALSE(callback.have_result()); 111 ASSERT_FALSE(callback.have_result());
112 112
113 // All data written. 113 // All data written.
114 EXPECT_CALL(session_, WritevData(stream_.id(), _, _, _, _)).WillOnce( 114 EXPECT_CALL(session_, WritevData(stream_.id(), _, _, _, _, _)).WillOnce(
115 Return(QuicConsumedData(kDataLen, true))); 115 Return(QuicConsumedData(kDataLen, true)));
116 stream_.OnCanWrite(); 116 stream_.OnCanWrite();
117 ASSERT_TRUE(callback.have_result()); 117 ASSERT_TRUE(callback.have_result());
118 EXPECT_EQ(OK, callback.WaitForResult()); 118 EXPECT_EQ(OK, callback.WaitForResult());
119 } 119 }
120 120
121 } // namespace 121 } // namespace
122 } // namespace test 122 } // namespace test
123 } // namespace net 123 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_received_packet_manager_test.cc ('k') | net/quic/quic_sent_packet_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698