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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 }; | 63 }; |
64 | 64 |
65 // A Connection class which unregisters the session from the dispatcher | 65 // A Connection class which unregisters the session from the dispatcher |
66 // when sending connection close. | 66 // when sending connection close. |
67 // It'd be slightly more realistic to do this from the Session but it would | 67 // It'd be slightly more realistic to do this from the Session but it would |
68 // involve a lot more mocking. | 68 // involve a lot more mocking. |
69 class MockServerConnection : public MockConnection { | 69 class MockServerConnection : public MockConnection { |
70 public: | 70 public: |
71 MockServerConnection(QuicConnectionId connection_id, | 71 MockServerConnection(QuicConnectionId connection_id, |
72 QuicDispatcher* dispatcher) | 72 QuicDispatcher* dispatcher) |
73 : MockConnection(connection_id, true), | 73 : MockConnection(connection_id, Perspective::IS_SERVER), |
74 dispatcher_(dispatcher) {} | 74 dispatcher_(dispatcher) {} |
75 | 75 |
76 void UnregisterOnConnectionClosed() { | 76 void UnregisterOnConnectionClosed() { |
77 LOG(ERROR) << "Unregistering " << connection_id(); | 77 LOG(ERROR) << "Unregistering " << connection_id(); |
78 dispatcher_->OnConnectionClosed(connection_id(), QUIC_NO_ERROR); | 78 dispatcher_->OnConnectionClosed(connection_id(), QUIC_NO_ERROR); |
79 } | 79 } |
80 private: | 80 private: |
81 QuicDispatcher* dispatcher_; | 81 QuicDispatcher* dispatcher_; |
82 }; | 82 }; |
83 | 83 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 // And we'll resume where we left off when we get another call. | 480 // And we'll resume where we left off when we get another call. |
481 EXPECT_CALL(*connection2(), OnCanWrite()); | 481 EXPECT_CALL(*connection2(), OnCanWrite()); |
482 dispatcher_.OnCanWrite(); | 482 dispatcher_.OnCanWrite(); |
483 EXPECT_FALSE(dispatcher_.HasPendingWrites()); | 483 EXPECT_FALSE(dispatcher_.HasPendingWrites()); |
484 } | 484 } |
485 | 485 |
486 } // namespace | 486 } // namespace |
487 } // namespace test | 487 } // namespace test |
488 } // namespace tools | 488 } // namespace tools |
489 } // namespace net | 489 } // namespace net |
OLD | NEW |