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_framer.h" | 5 #include "net/quic/quic_framer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 QuicPacketSequenceNumber sequence_number_; | 134 QuicPacketSequenceNumber sequence_number_; |
135 string associated_data_; | 135 string associated_data_; |
136 string plaintext_; | 136 string plaintext_; |
137 }; | 137 }; |
138 | 138 |
139 class TestDecrypter : public QuicDecrypter { | 139 class TestDecrypter : public QuicDecrypter { |
140 public: | 140 public: |
141 ~TestDecrypter() override {} | 141 ~TestDecrypter() override {} |
142 bool SetKey(StringPiece key) override { return true; } | 142 bool SetKey(StringPiece key) override { return true; } |
143 bool SetNoncePrefix(StringPiece nonce_prefix) override { return true; } | 143 bool SetNoncePrefix(StringPiece nonce_prefix) override { return true; } |
144 bool Decrypt(StringPiece nonce, | |
145 StringPiece associated_data, | |
146 StringPiece ciphertext, | |
147 unsigned char* output, | |
148 size_t* output_length) override { | |
149 CHECK(false) << "Not implemented"; | |
150 return false; | |
151 } | |
152 QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, | 144 QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, |
153 StringPiece associated_data, | 145 StringPiece associated_data, |
154 StringPiece ciphertext) override { | 146 StringPiece ciphertext) override { |
155 sequence_number_ = sequence_number; | 147 sequence_number_ = sequence_number; |
156 associated_data_ = associated_data.as_string(); | 148 associated_data_ = associated_data.as_string(); |
157 ciphertext_ = ciphertext.as_string(); | 149 ciphertext_ = ciphertext.as_string(); |
158 return new QuicData(ciphertext.data(), ciphertext.length()); | 150 return new QuicData(ciphertext.data(), ciphertext.length()); |
159 } | 151 } |
160 StringPiece GetKey() const override { return StringPiece(); } | 152 StringPiece GetKey() const override { return StringPiece(); } |
161 StringPiece GetNoncePrefix() const override { return StringPiece(); } | 153 StringPiece GetNoncePrefix() const override { return StringPiece(); } |
(...skipping 4083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4245 EXPECT_CALL(visitor, OnPacketComplete()); | 4237 EXPECT_CALL(visitor, OnPacketComplete()); |
4246 EXPECT_CALL(visitor, OnUnauthenticatedPublicHeader(_)).WillOnce(Return(true)); | 4238 EXPECT_CALL(visitor, OnUnauthenticatedPublicHeader(_)).WillOnce(Return(true)); |
4247 | 4239 |
4248 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); | 4240 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); |
4249 EXPECT_TRUE(framer_.ProcessPacket(encrypted)); | 4241 EXPECT_TRUE(framer_.ProcessPacket(encrypted)); |
4250 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); | 4242 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); |
4251 } | 4243 } |
4252 | 4244 |
4253 } // namespace test | 4245 } // namespace test |
4254 } // namespace net | 4246 } // namespace net |
OLD | NEW |