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/core/quic_crypto_stream.h" | 5 #include "net/quic/core/quic_crypto_stream.h" |
6 | 6 |
7 #include <cstdint> | 7 #include <cstdint> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "net/quic/core/crypto/crypto_handshake.h" | 13 #include "net/quic/core/crypto/crypto_handshake.h" |
14 #include "net/quic/core/crypto/crypto_protocol.h" | 14 #include "net/quic/core/crypto/crypto_protocol.h" |
15 #include "net/quic/test_tools/crypto_test_utils.h" | 15 #include "net/quic/test_tools/crypto_test_utils.h" |
16 #include "net/quic/test_tools/quic_test_utils.h" | 16 #include "net/quic/test_tools/quic_test_utils.h" |
17 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 17 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 using std::string; | 21 using std::string; |
22 using std::vector; | |
23 | 22 |
24 namespace net { | 23 namespace net { |
25 namespace test { | 24 namespace test { |
26 namespace { | 25 namespace { |
27 | 26 |
28 class MockQuicCryptoStream : public QuicCryptoStream { | 27 class MockQuicCryptoStream : public QuicCryptoStream { |
29 public: | 28 public: |
30 explicit MockQuicCryptoStream(QuicSession* session) | 29 explicit MockQuicCryptoStream(QuicSession* session) |
31 : QuicCryptoStream(session) {} | 30 : QuicCryptoStream(session) {} |
32 | 31 |
33 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override { | 32 void OnHandshakeMessage(const CryptoHandshakeMessage& message) override { |
34 messages_.push_back(message); | 33 messages_.push_back(message); |
35 } | 34 } |
36 | 35 |
37 vector<CryptoHandshakeMessage>* messages() { return &messages_; } | 36 std::vector<CryptoHandshakeMessage>* messages() { return &messages_; } |
38 | 37 |
39 private: | 38 private: |
40 vector<CryptoHandshakeMessage> messages_; | 39 std::vector<CryptoHandshakeMessage> messages_; |
41 | 40 |
42 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoStream); | 41 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoStream); |
43 }; | 42 }; |
44 | 43 |
45 class QuicCryptoStreamTest : public ::testing::Test { | 44 class QuicCryptoStreamTest : public ::testing::Test { |
46 public: | 45 public: |
47 QuicCryptoStreamTest() | 46 QuicCryptoStreamTest() |
48 : connection_(new MockQuicConnection(&helper_, | 47 : connection_(new MockQuicConnection(&helper_, |
49 &alarm_factory_, | 48 &alarm_factory_, |
50 Perspective::IS_CLIENT)), | 49 Perspective::IS_CLIENT)), |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 105 } |
107 | 106 |
108 TEST_F(QuicCryptoStreamTest, NoConnectionLevelFlowControl) { | 107 TEST_F(QuicCryptoStreamTest, NoConnectionLevelFlowControl) { |
109 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( | 108 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( |
110 &stream_)); | 109 &stream_)); |
111 } | 110 } |
112 | 111 |
113 } // namespace | 112 } // namespace |
114 } // namespace test | 113 } // namespace test |
115 } // namespace net | 114 } // namespace net |
OLD | NEW |