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

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

Issue 1680643002: Refactor gmock_mutant.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 (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_chromium_client_stream.h" 5 #include "net/quic/quic_chromium_client_stream.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/base/test_completion_callback.h" 9 #include "net/base/test_completion_callback.h"
10 #include "net/quic/quic_chromium_client_session.h" 10 #include "net/quic/quic_chromium_client_session.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 OnHeadersAvailable(headers_, uncompressed_headers.length())); 232 OnHeadersAvailable(headers_, uncompressed_headers.length()));
233 base::MessageLoop::current()->RunUntilIdle(); 233 base::MessageLoop::current()->RunUntilIdle();
234 EXPECT_TRUE(stream_->decompressed_headers().empty()); 234 EXPECT_TRUE(stream_->decompressed_headers().empty());
235 235
236 const char data[] = "hello world!"; 236 const char data[] = "hello world!";
237 stream_->OnStreamFrame(QuicStreamFrame(kTestStreamId, /*fin=*/false, 237 stream_->OnStreamFrame(QuicStreamFrame(kTestStreamId, /*fin=*/false,
238 /*offset=*/0, data)); 238 /*offset=*/0, data));
239 239
240 EXPECT_CALL(delegate_, OnDataAvailable()) 240 EXPECT_CALL(delegate_, OnDataAvailable())
241 .WillOnce(testing::Invoke( 241 .WillOnce(testing::Invoke(
242 CreateFunctor(this, &QuicChromiumClientStreamTest::ReadData, 242 CreateFunctor(&QuicChromiumClientStreamTest::ReadData,
243 base::Unretained(this),
243 StringPiece(data, arraysize(data) - 1)))); 244 StringPiece(data, arraysize(data) - 1))));
244 base::MessageLoop::current()->RunUntilIdle(); 245 base::MessageLoop::current()->RunUntilIdle();
245 246
246 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); 247 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR));
247 } 248 }
248 249
249 TEST_P(QuicChromiumClientStreamTest, ProcessHeadersWithError) { 250 TEST_P(QuicChromiumClientStreamTest, ProcessHeadersWithError) {
250 std::string bad_headers = "..."; 251 std::string bad_headers = "...";
251 stream_->OnStreamHeaders(StringPiece(bad_headers)); 252 stream_->OnStreamHeaders(StringPiece(bad_headers));
252 stream_->OnStreamHeadersComplete(false, bad_headers.length()); 253 stream_->OnStreamHeadersComplete(false, bad_headers.length());
(...skipping 15 matching lines...) Expand all
268 EXPECT_CALL(delegate_, 269 EXPECT_CALL(delegate_,
269 OnHeadersAvailable(headers_, uncompressed_headers.length())); 270 OnHeadersAvailable(headers_, uncompressed_headers.length()));
270 base::MessageLoop::current()->RunUntilIdle(); 271 base::MessageLoop::current()->RunUntilIdle();
271 EXPECT_TRUE(stream_->decompressed_headers().empty()); 272 EXPECT_TRUE(stream_->decompressed_headers().empty());
272 273
273 const char data[] = "hello world!"; 274 const char data[] = "hello world!";
274 stream_->OnStreamFrame(QuicStreamFrame(kTestStreamId, /*fin=*/false, 275 stream_->OnStreamFrame(QuicStreamFrame(kTestStreamId, /*fin=*/false,
275 /*offset=*/0, data)); 276 /*offset=*/0, data));
276 EXPECT_CALL(delegate_, OnDataAvailable()) 277 EXPECT_CALL(delegate_, OnDataAvailable())
277 .WillOnce(testing::Invoke(CreateFunctor( 278 .WillOnce(testing::Invoke(CreateFunctor(
278 stream_, &QuicChromiumClientStream::Reset, QUIC_STREAM_CANCELLED))); 279 &QuicChromiumClientStream::Reset,
280 base::Unretained(stream_), QUIC_STREAM_CANCELLED)));
279 base::MessageLoop::current()->RunUntilIdle(); 281 base::MessageLoop::current()->RunUntilIdle();
280 282
281 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR)); 283 EXPECT_CALL(delegate_, OnClose(QUIC_NO_ERROR));
282 } 284 }
283 285
284 TEST_P(QuicChromiumClientStreamTest, OnError) { 286 TEST_P(QuicChromiumClientStreamTest, OnError) {
285 EXPECT_CALL(delegate_, OnError(ERR_INTERNET_DISCONNECTED)); 287 EXPECT_CALL(delegate_, OnError(ERR_INTERNET_DISCONNECTED));
286 288
287 stream_->OnError(ERR_INTERNET_DISCONNECTED); 289 stream_->OnError(ERR_INTERNET_DISCONNECTED);
288 EXPECT_FALSE(stream_->GetDelegate()); 290 EXPECT_FALSE(stream_->GetDelegate());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _)) 324 EXPECT_CALL(session_, WritevData(stream_->id(), _, _, _, _, _))
323 .WillOnce(Return(QuicConsumedData(kDataLen, true))); 325 .WillOnce(Return(QuicConsumedData(kDataLen, true)));
324 stream_->OnCanWrite(); 326 stream_->OnCanWrite();
325 ASSERT_TRUE(callback.have_result()); 327 ASSERT_TRUE(callback.have_result());
326 EXPECT_EQ(OK, callback.WaitForResult()); 328 EXPECT_EQ(OK, callback.WaitForResult());
327 } 329 }
328 330
329 } // namespace 331 } // namespace
330 } // namespace test 332 } // namespace test
331 } // namespace net 333 } // namespace net
OLDNEW
« no previous file with comments | « chrome/browser/speech/extension_api/tts_extension_apitest.cc ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698