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" |
(...skipping 29 matching lines...) Expand all Loading... |
40 private: | 40 private: |
41 vector<CryptoHandshakeMessage> messages_; | 41 vector<CryptoHandshakeMessage> messages_; |
42 | 42 |
43 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoStream); | 43 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoStream); |
44 }; | 44 }; |
45 | 45 |
46 class QuicCryptoStreamTest : public ::testing::Test { | 46 class QuicCryptoStreamTest : public ::testing::Test { |
47 public: | 47 public: |
48 QuicCryptoStreamTest() | 48 QuicCryptoStreamTest() |
49 : connection_(new MockConnection(false)), | 49 : connection_(new MockConnection(false)), |
50 session_(connection_, true), | 50 session_(connection_), |
51 stream_(&session_) { | 51 stream_(&session_) { |
52 message_.set_tag(kSHLO); | 52 message_.set_tag(kSHLO); |
53 message_.SetStringPiece(1, "abc"); | 53 message_.SetStringPiece(1, "abc"); |
54 message_.SetStringPiece(2, "def"); | 54 message_.SetStringPiece(2, "def"); |
55 ConstructHandshakeMessage(); | 55 ConstructHandshakeMessage(); |
56 } | 56 } |
57 | 57 |
58 void ConstructHandshakeMessage() { | 58 void ConstructHandshakeMessage() { |
59 CryptoFramer framer; | 59 CryptoFramer framer; |
60 message_data_.reset(framer.ConstructHandshakeMessage(message_)); | 60 message_data_.reset(framer.ConstructHandshakeMessage(message_)); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 bad[kFirstTagIndex] = 0x7F; // out of order tag | 97 bad[kFirstTagIndex] = 0x7F; // out of order tag |
98 | 98 |
99 EXPECT_CALL(*connection_, | 99 EXPECT_CALL(*connection_, |
100 SendConnectionClose(QUIC_CRYPTO_TAGS_OUT_OF_ORDER)); | 100 SendConnectionClose(QUIC_CRYPTO_TAGS_OUT_OF_ORDER)); |
101 EXPECT_EQ(0u, stream_.ProcessRawData(bad.data(), bad.length())); | 101 EXPECT_EQ(0u, stream_.ProcessRawData(bad.data(), bad.length())); |
102 } | 102 } |
103 | 103 |
104 } // namespace | 104 } // namespace |
105 } // namespace test | 105 } // namespace test |
106 } // namespace net | 106 } // namespace net |
OLD | NEW |