OLD | NEW |
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/tools/quic/quic_dispatcher.h" | 5 #include "net/tools/quic/quic_dispatcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 kTestVersions.push_back(kTestQuicVersions[i]); | 283 kTestVersions.push_back(kTestQuicVersions[i]); |
284 } | 284 } |
285 | 285 |
286 QuicDispatcher dispatcher(config, server_config, kTestVersions, &eps, | 286 QuicDispatcher dispatcher(config, server_config, kTestVersions, &eps, |
287 kInitialFlowControlWindowForTest); | 287 kInitialFlowControlWindowForTest); |
288 dispatcher.Initialize(0); | 288 dispatcher.Initialize(0); |
289 | 289 |
290 // When flag is enabled, new connections should support QUIC_VERSION_17. | 290 // When flag is enabled, new connections should support QUIC_VERSION_17. |
291 FLAGS_enable_quic_stream_flow_control_2 = true; | 291 FLAGS_enable_quic_stream_flow_control_2 = true; |
292 scoped_ptr<QuicConnection> connection_1( | 292 scoped_ptr<QuicConnection> connection_1( |
293 QuicDispatcherPeer::CreateQuicConnection( | 293 QuicDispatcherPeer::CreateQuicConnection(&dispatcher, kCID, client, |
294 &dispatcher, kCID, client, server, kInitialFlowControlWindowForTest)); | 294 server)); |
295 EXPECT_EQ(QUIC_VERSION_17, connection_1->version()); | 295 EXPECT_EQ(QUIC_VERSION_17, connection_1->version()); |
296 | 296 |
297 | 297 |
298 // When flag is disabled, new connections should not support QUIC_VERSION_17. | 298 // When flag is disabled, new connections should not support QUIC_VERSION_17. |
299 FLAGS_enable_quic_stream_flow_control_2 = false; | 299 FLAGS_enable_quic_stream_flow_control_2 = false; |
300 scoped_ptr<QuicConnection> connection_2( | 300 scoped_ptr<QuicConnection> connection_2( |
301 QuicDispatcherPeer::CreateQuicConnection( | 301 QuicDispatcherPeer::CreateQuicConnection(&dispatcher, kCID, client, |
302 &dispatcher, kCID, client, server, kInitialFlowControlWindowForTest)); | 302 server)); |
303 EXPECT_EQ(QUIC_VERSION_16, connection_2->version()); | 303 EXPECT_EQ(QUIC_VERSION_16, connection_2->version()); |
304 } | 304 } |
305 | 305 |
306 class BlockingWriter : public QuicPacketWriterWrapper { | 306 class BlockingWriter : public QuicPacketWriterWrapper { |
307 public: | 307 public: |
308 BlockingWriter() : write_blocked_(false) {} | 308 BlockingWriter() : write_blocked_(false) {} |
309 | 309 |
310 virtual bool IsWriteBlocked() const OVERRIDE { return write_blocked_; } | 310 virtual bool IsWriteBlocked() const OVERRIDE { return write_blocked_; } |
311 virtual void SetWritable() OVERRIDE { write_blocked_ = false; } | 311 virtual void SetWritable() OVERRIDE { write_blocked_ = false; } |
312 | 312 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 // And we'll resume where we left off when we get another call. | 494 // And we'll resume where we left off when we get another call. |
495 EXPECT_CALL(*connection2(), OnCanWrite()); | 495 EXPECT_CALL(*connection2(), OnCanWrite()); |
496 dispatcher_.OnCanWrite(); | 496 dispatcher_.OnCanWrite(); |
497 EXPECT_FALSE(dispatcher_.HasPendingWrites()); | 497 EXPECT_FALSE(dispatcher_.HasPendingWrites()); |
498 } | 498 } |
499 | 499 |
500 } // namespace | 500 } // namespace |
501 } // namespace test | 501 } // namespace test |
502 } // namespace tools | 502 } // namespace tools |
503 } // namespace net | 503 } // namespace net |
OLD | NEW |