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 <algorithm> | 5 #include <algorithm> |
6 #include <map> | 6 #include <map> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 virtual ~TestEncrypter() {} | 71 virtual ~TestEncrypter() {} |
72 virtual bool SetKey(StringPiece key) OVERRIDE { | 72 virtual bool SetKey(StringPiece key) OVERRIDE { |
73 return true; | 73 return true; |
74 } | 74 } |
75 virtual bool SetNoncePrefix(StringPiece nonce_prefix) OVERRIDE { | 75 virtual bool SetNoncePrefix(StringPiece nonce_prefix) OVERRIDE { |
76 return true; | 76 return true; |
77 } | 77 } |
78 virtual bool Encrypt(StringPiece nonce, | 78 virtual bool Encrypt(StringPiece nonce, |
79 StringPiece associated_data, | 79 StringPiece associated_data, |
80 StringPiece plaintext, | 80 StringPiece plaintext, |
81 unsigned char* output) { | 81 unsigned char* output) OVERRIDE { |
82 CHECK(false) << "Not implemented"; | 82 CHECK(false) << "Not implemented"; |
83 return false; | 83 return false; |
84 } | 84 } |
85 virtual QuicData* EncryptPacket(QuicPacketSequenceNumber sequence_number, | 85 virtual QuicData* EncryptPacket(QuicPacketSequenceNumber sequence_number, |
86 StringPiece associated_data, | 86 StringPiece associated_data, |
87 StringPiece plaintext) { | 87 StringPiece plaintext) OVERRIDE { |
88 sequence_number_ = sequence_number; | 88 sequence_number_ = sequence_number; |
89 associated_data_ = associated_data.as_string(); | 89 associated_data_ = associated_data.as_string(); |
90 plaintext_ = plaintext.as_string(); | 90 plaintext_ = plaintext.as_string(); |
91 return new QuicData(plaintext.data(), plaintext.length()); | 91 return new QuicData(plaintext.data(), plaintext.length()); |
92 } | 92 } |
93 virtual size_t GetKeySize() const OVERRIDE { | 93 virtual size_t GetKeySize() const OVERRIDE { |
94 return 0; | 94 return 0; |
95 } | 95 } |
96 virtual size_t GetNoncePrefixSize() const OVERRIDE { | 96 virtual size_t GetNoncePrefixSize() const OVERRIDE { |
97 return 0; | 97 return 0; |
(...skipping 21 matching lines...) Expand all Loading... |
119 virtual bool SetKey(StringPiece key) OVERRIDE { | 119 virtual bool SetKey(StringPiece key) OVERRIDE { |
120 return true; | 120 return true; |
121 } | 121 } |
122 virtual bool SetNoncePrefix(StringPiece nonce_prefix) OVERRIDE { | 122 virtual bool SetNoncePrefix(StringPiece nonce_prefix) OVERRIDE { |
123 return true; | 123 return true; |
124 } | 124 } |
125 virtual bool Decrypt(StringPiece nonce, | 125 virtual bool Decrypt(StringPiece nonce, |
126 StringPiece associated_data, | 126 StringPiece associated_data, |
127 StringPiece ciphertext, | 127 StringPiece ciphertext, |
128 unsigned char* output, | 128 unsigned char* output, |
129 size_t* output_length) { | 129 size_t* output_length) OVERRIDE { |
130 CHECK(false) << "Not implemented"; | 130 CHECK(false) << "Not implemented"; |
131 return false; | 131 return false; |
132 } | 132 } |
133 virtual QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, | 133 virtual QuicData* DecryptPacket(QuicPacketSequenceNumber sequence_number, |
134 StringPiece associated_data, | 134 StringPiece associated_data, |
135 StringPiece ciphertext) { | 135 StringPiece ciphertext) OVERRIDE { |
136 sequence_number_ = sequence_number; | 136 sequence_number_ = sequence_number; |
137 associated_data_ = associated_data.as_string(); | 137 associated_data_ = associated_data.as_string(); |
138 ciphertext_ = ciphertext.as_string(); | 138 ciphertext_ = ciphertext.as_string(); |
139 return new QuicData(ciphertext.data(), ciphertext.length()); | 139 return new QuicData(ciphertext.data(), ciphertext.length()); |
140 } | 140 } |
141 virtual StringPiece GetKey() const OVERRIDE { | 141 virtual StringPiece GetKey() const OVERRIDE { |
142 return StringPiece(); | 142 return StringPiece(); |
143 } | 143 } |
144 virtual StringPiece GetNoncePrefix() const OVERRIDE { | 144 virtual StringPiece GetNoncePrefix() const OVERRIDE { |
145 return StringPiece(); | 145 return StringPiece(); |
(...skipping 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2791 EXPECT_CALL(visitor, OnAckFrame(_)).Times(0); | 2791 EXPECT_CALL(visitor, OnAckFrame(_)).Times(0); |
2792 EXPECT_CALL(visitor, OnPacketComplete()); | 2792 EXPECT_CALL(visitor, OnPacketComplete()); |
2793 | 2793 |
2794 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); | 2794 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); |
2795 EXPECT_TRUE(framer_.ProcessPacket(encrypted)); | 2795 EXPECT_TRUE(framer_.ProcessPacket(encrypted)); |
2796 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); | 2796 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); |
2797 } | 2797 } |
2798 | 2798 |
2799 } // namespace test | 2799 } // namespace test |
2800 } // namespace net | 2800 } // namespace net |
OLD | NEW |