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

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

Issue 1780913002: Deprecating FLAG_quic_batch_writes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@115853846
Patch Set: Created 4 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
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_write_blocked_list.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_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority); 381 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority);
382 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority); 382 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority);
383 383
384 session_.MarkConnectionLevelWriteBlocked(stream2->id()); 384 session_.MarkConnectionLevelWriteBlocked(stream2->id());
385 session_.MarkConnectionLevelWriteBlocked(stream6->id()); 385 session_.MarkConnectionLevelWriteBlocked(stream6->id());
386 session_.MarkConnectionLevelWriteBlocked(stream4->id()); 386 session_.MarkConnectionLevelWriteBlocked(stream4->id());
387 387
388 InSequence s; 388 InSequence s;
389 StreamBlocker stream2_blocker(&session_, stream2->id()); 389 StreamBlocker stream2_blocker(&session_, stream2->id());
390 390
391 if (FLAGS_quic_batch_writes) { 391 // Reregister, to test the loop limit.
392 // Reregister, to test the loop limit. 392 EXPECT_CALL(*stream2, OnCanWrite())
393 EXPECT_CALL(*stream2, OnCanWrite()) 393 .WillOnce(Invoke(&stream2_blocker,
394 .WillOnce(Invoke(&stream2_blocker, 394 &StreamBlocker::MarkConnectionLevelWriteBlocked));
395 &StreamBlocker::MarkConnectionLevelWriteBlocked)); 395 // 2 will get called a second time as it didn't finish its block
396 // 2 will get called a second time as it didn't finish its block 396 EXPECT_CALL(*stream2, OnCanWrite());
397 EXPECT_CALL(*stream2, OnCanWrite()); 397 EXPECT_CALL(*stream6, OnCanWrite());
398 EXPECT_CALL(*stream6, OnCanWrite()); 398 // 4 will not get called, as we exceeded the loop limit.
399 // 4 will not get called, as we exceeded the loop limit.
400 } else {
401 // Reregister, to test the loop limit.
402 EXPECT_CALL(*stream2, OnCanWrite())
403 .WillOnce(Invoke(&stream2_blocker,
404 &StreamBlocker::MarkConnectionLevelWriteBlocked));
405 EXPECT_CALL(*stream6, OnCanWrite());
406 EXPECT_CALL(*stream4, OnCanWrite());
407 }
408 session_.OnCanWrite(); 399 session_.OnCanWrite();
409 EXPECT_TRUE(session_.WillingAndAbleToWrite()); 400 EXPECT_TRUE(session_.WillingAndAbleToWrite());
410 } 401 }
411 402
412 TEST_P(QuicSessionTestServer, TestBatchedWrites) { 403 TEST_P(QuicSessionTestServer, TestBatchedWrites) {
413 ValueRestore<bool> old_flag(&FLAGS_quic_batch_writes, true);
414 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); 404 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority);
415 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority); 405 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority);
416 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority); 406 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority);
417 407
418 session_.set_writev_consumes_all_data(true); 408 session_.set_writev_consumes_all_data(true);
419 session_.MarkConnectionLevelWriteBlocked(stream2->id()); 409 session_.MarkConnectionLevelWriteBlocked(stream2->id());
420 session_.MarkConnectionLevelWriteBlocked(stream4->id()); 410 session_.MarkConnectionLevelWriteBlocked(stream4->id());
421 411
422 StreamBlocker stream2_blocker(&session_, stream2->id()); 412 StreamBlocker stream2_blocker(&session_, stream2->id());
423 StreamBlocker stream4_blocker(&session_, stream4->id()); 413 StreamBlocker stream4_blocker(&session_, stream4->id());
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 session_.max_open_incoming_streams()); 1199 session_.max_open_incoming_streams());
1210 } 1200 }
1211 1201
1212 EXPECT_EQ(session_.max_open_outgoing_streams(), 1202 EXPECT_EQ(session_.max_open_outgoing_streams(),
1213 kDefaultMaxStreamsPerConnection); 1203 kDefaultMaxStreamsPerConnection);
1214 } 1204 }
1215 1205
1216 } // namespace 1206 } // namespace
1217 } // namespace test 1207 } // namespace test
1218 } // namespace net 1208 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_write_blocked_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698