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/quic/quic_crypto_stream.h" | 5 #include "net/quic/quic_crypto_stream.h" |
6 | 6 |
| 7 #include <cstdint> |
7 #include <memory> | 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "net/quic/crypto/crypto_handshake.h" | 13 #include "net/quic/crypto/crypto_handshake.h" |
13 #include "net/quic/crypto/crypto_protocol.h" | 14 #include "net/quic/crypto/crypto_protocol.h" |
14 #include "net/quic/test_tools/crypto_test_utils.h" | 15 #include "net/quic/test_tools/crypto_test_utils.h" |
15 #include "net/quic/test_tools/quic_test_utils.h" | 16 #include "net/quic/test_tools/quic_test_utils.h" |
16 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 17 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
(...skipping 20 matching lines...) Expand all Loading... |
37 | 38 |
38 private: | 39 private: |
39 vector<CryptoHandshakeMessage> messages_; | 40 vector<CryptoHandshakeMessage> messages_; |
40 | 41 |
41 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoStream); | 42 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoStream); |
42 }; | 43 }; |
43 | 44 |
44 class QuicCryptoStreamTest : public ::testing::Test { | 45 class QuicCryptoStreamTest : public ::testing::Test { |
45 public: | 46 public: |
46 QuicCryptoStreamTest() | 47 QuicCryptoStreamTest() |
47 : connection_(new MockConnection(&helper_, Perspective::IS_CLIENT)), | 48 : connection_(new MockConnection(&helper_, |
| 49 &alarm_factory_, |
| 50 Perspective::IS_CLIENT)), |
48 session_(connection_), | 51 session_(connection_), |
49 stream_(&session_) { | 52 stream_(&session_) { |
50 message_.set_tag(kSHLO); | 53 message_.set_tag(kSHLO); |
51 message_.SetStringPiece(1, "abc"); | 54 message_.SetStringPiece(1, "abc"); |
52 message_.SetStringPiece(2, "def"); | 55 message_.SetStringPiece(2, "def"); |
53 ConstructHandshakeMessage(); | 56 ConstructHandshakeMessage(); |
54 } | 57 } |
55 | 58 |
56 void ConstructHandshakeMessage() { | 59 void ConstructHandshakeMessage() { |
57 CryptoFramer framer; | 60 CryptoFramer framer; |
58 message_data_.reset(framer.ConstructHandshakeMessage(message_)); | 61 message_data_.reset(framer.ConstructHandshakeMessage(message_)); |
59 } | 62 } |
60 | 63 |
61 protected: | 64 protected: |
62 MockConnectionHelper helper_; | 65 MockConnectionHelper helper_; |
| 66 MockAlarmFactory alarm_factory_; |
63 MockConnection* connection_; | 67 MockConnection* connection_; |
64 MockQuicSpdySession session_; | 68 MockQuicSpdySession session_; |
65 MockQuicCryptoStream stream_; | 69 MockQuicCryptoStream stream_; |
66 CryptoHandshakeMessage message_; | 70 CryptoHandshakeMessage message_; |
67 std::unique_ptr<QuicData> message_data_; | 71 std::unique_ptr<QuicData> message_data_; |
68 | 72 |
69 private: | 73 private: |
70 DISALLOW_COPY_AND_ASSIGN(QuicCryptoStreamTest); | 74 DISALLOW_COPY_AND_ASSIGN(QuicCryptoStreamTest); |
71 }; | 75 }; |
72 | 76 |
(...skipping 29 matching lines...) Expand all Loading... |
102 } | 106 } |
103 | 107 |
104 TEST_F(QuicCryptoStreamTest, NoConnectionLevelFlowControl) { | 108 TEST_F(QuicCryptoStreamTest, NoConnectionLevelFlowControl) { |
105 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( | 109 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( |
106 &stream_)); | 110 &stream_)); |
107 } | 111 } |
108 | 112 |
109 } // namespace | 113 } // namespace |
110 } // namespace test | 114 } // namespace test |
111 } // namespace net | 115 } // namespace net |
OLD | NEW |