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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "net/quic/crypto/crypto_handshake.h" | 11 #include "net/quic/crypto/crypto_handshake.h" |
12 #include "net/quic/crypto/crypto_protocol.h" | 12 #include "net/quic/crypto/crypto_protocol.h" |
13 #include "net/quic/quic_flags.h" | 13 #include "net/quic/quic_flags.h" |
14 #include "net/quic/test_tools/crypto_test_utils.h" | 14 #include "net/quic/test_tools/crypto_test_utils.h" |
15 #include "net/quic/test_tools/quic_test_utils.h" | 15 #include "net/quic/test_tools/quic_test_utils.h" |
| 16 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 using std::string; | 20 using std::string; |
20 using std::vector; | 21 using std::vector; |
21 | 22 |
22 namespace net { | 23 namespace net { |
23 namespace test { | 24 namespace test { |
24 namespace { | 25 namespace { |
25 | 26 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 sizeof(uint16) + // number of tag-value pairs | 96 sizeof(uint16) + // number of tag-value pairs |
96 sizeof(uint16); // padding | 97 sizeof(uint16); // padding |
97 EXPECT_EQ(1, bad[kFirstTagIndex]); | 98 EXPECT_EQ(1, bad[kFirstTagIndex]); |
98 bad[kFirstTagIndex] = 0x7F; // out of order tag | 99 bad[kFirstTagIndex] = 0x7F; // out of order tag |
99 | 100 |
100 EXPECT_CALL(*connection_, | 101 EXPECT_CALL(*connection_, |
101 SendConnectionClose(QUIC_CRYPTO_TAGS_OUT_OF_ORDER)); | 102 SendConnectionClose(QUIC_CRYPTO_TAGS_OUT_OF_ORDER)); |
102 EXPECT_EQ(0u, stream_.ProcessRawData(bad.data(), bad.length())); | 103 EXPECT_EQ(0u, stream_.ProcessRawData(bad.data(), bad.length())); |
103 } | 104 } |
104 | 105 |
105 TEST_F(QuicCryptoStreamTest, NoFlowControl) { | 106 TEST_F(QuicCryptoStreamTest, NoConnectionLevelFlowControl) { |
106 EXPECT_FALSE(stream_.flow_controller()->IsEnabled()); | 107 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control_2, |
| 108 true); |
| 109 if (connection_->version() <= QUIC_VERSION_20) { |
| 110 EXPECT_FALSE(stream_.flow_controller()->IsEnabled()); |
| 111 } else { |
| 112 EXPECT_TRUE(stream_.flow_controller()->IsEnabled()); |
| 113 } |
| 114 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( |
| 115 &stream_)); |
107 } | 116 } |
108 | 117 |
109 } // namespace | 118 } // namespace |
110 } // namespace test | 119 } // namespace test |
111 } // namespace net | 120 } // namespace net |
OLD | NEW |