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

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

Issue 180723003: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unintialized memory error Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_received_packet_manager.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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 EXPECT_FALSE(stream_->GetDelegate()); 139 EXPECT_FALSE(stream_->GetDelegate());
140 } 140 }
141 141
142 TEST_P(QuicReliableClientStreamTest, WriteStreamData) { 142 TEST_P(QuicReliableClientStreamTest, WriteStreamData) {
143 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); 143 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR));
144 144
145 const char kData1[] = "hello world"; 145 const char kData1[] = "hello world";
146 const size_t kDataLen = arraysize(kData1); 146 const size_t kDataLen = arraysize(kData1);
147 147
148 // All data written. 148 // All data written.
149 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce( 149 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _)).WillOnce(
150 Return(QuicConsumedData(kDataLen, true))); 150 Return(QuicConsumedData(kDataLen, true)));
151 TestCompletionCallback callback; 151 TestCompletionCallback callback;
152 EXPECT_EQ(OK, stream_->WriteStreamData(base::StringPiece(kData1, kDataLen), 152 EXPECT_EQ(OK, stream_->WriteStreamData(base::StringPiece(kData1, kDataLen),
153 true, callback.callback())); 153 true, callback.callback()));
154 } 154 }
155 155
156 TEST_P(QuicReliableClientStreamTest, WriteStreamDataAsync) { 156 TEST_P(QuicReliableClientStreamTest, WriteStreamDataAsync) {
157 EXPECT_CALL(delegate_, HasSendHeadersComplete()).Times(AnyNumber()); 157 EXPECT_CALL(delegate_, HasSendHeadersComplete()).Times(AnyNumber());
158 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); 158 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR));
159 159
160 const char kData1[] = "hello world"; 160 const char kData1[] = "hello world";
161 const size_t kDataLen = arraysize(kData1); 161 const size_t kDataLen = arraysize(kData1);
162 162
163 // No data written. 163 // No data written.
164 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce( 164 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _)).WillOnce(
165 Return(QuicConsumedData(0, false))); 165 Return(QuicConsumedData(0, false)));
166 TestCompletionCallback callback; 166 TestCompletionCallback callback;
167 EXPECT_EQ(ERR_IO_PENDING, 167 EXPECT_EQ(ERR_IO_PENDING,
168 stream_->WriteStreamData(base::StringPiece(kData1, kDataLen), 168 stream_->WriteStreamData(base::StringPiece(kData1, kDataLen),
169 true, callback.callback())); 169 true, callback.callback()));
170 ASSERT_FALSE(callback.have_result()); 170 ASSERT_FALSE(callback.have_result());
171 171
172 // All data written. 172 // All data written.
173 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)).WillOnce( 173 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _)).WillOnce(
174 Return(QuicConsumedData(kDataLen, true))); 174 Return(QuicConsumedData(kDataLen, true)));
175 stream_->OnCanWrite(); 175 stream_->OnCanWrite();
176 ASSERT_TRUE(callback.have_result()); 176 ASSERT_TRUE(callback.have_result());
177 EXPECT_EQ(OK, callback.WaitForResult()); 177 EXPECT_EQ(OK, callback.WaitForResult());
178 } 178 }
179 179
180 } // namespace 180 } // namespace
181 } // namespace test 181 } // namespace test
182 } // namespace net 182 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_received_packet_manager.cc ('k') | net/quic/quic_sent_packet_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698