| 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_server_stream.h" | 5 #include "net/quic/quic_crypto_server_stream.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 CryptoHandshakeMessage message_; | 108 CryptoHandshakeMessage message_; |
| 109 scoped_ptr<QuicData> message_data_; | 109 scoped_ptr<QuicData> message_data_; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 TEST_F(QuicCryptoServerStreamTest, NotInitiallyConected) { | 112 TEST_F(QuicCryptoServerStreamTest, NotInitiallyConected) { |
| 113 if (!Aes128GcmEncrypter::IsSupported()) { | 113 if (!Aes128GcmEncrypter::IsSupported()) { |
| 114 LOG(INFO) << "AES GCM not supported. Test skipped."; | 114 LOG(INFO) << "AES GCM not supported. Test skipped."; |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 | 117 |
| 118 EXPECT_FALSE(stream_.handshake_complete()); | 118 EXPECT_FALSE(stream_.encryption_established()); |
| 119 EXPECT_FALSE(stream_.handshake_confirmed()); |
| 119 } | 120 } |
| 120 | 121 |
| 121 TEST_F(QuicCryptoServerStreamTest, ConnectedAfterCHLO) { | 122 TEST_F(QuicCryptoServerStreamTest, ConnectedAfterCHLO) { |
| 122 if (!Aes128GcmEncrypter::IsSupported()) { | 123 if (!Aes128GcmEncrypter::IsSupported()) { |
| 123 LOG(INFO) << "AES GCM not supported. Test skipped."; | 124 LOG(INFO) << "AES GCM not supported. Test skipped."; |
| 124 return; | 125 return; |
| 125 } | 126 } |
| 126 | 127 |
| 127 // CompleteCryptoHandshake returns the number of client hellos sent. This | 128 // CompleteCryptoHandshake returns the number of client hellos sent. This |
| 128 // test should send: | 129 // test should send: |
| 129 // * One to get a source-address token. | 130 // * One to get a source-address token. |
| 130 // * One to complete the handshake. | 131 // * One to complete the handshake. |
| 131 // TODO(rtenneti): Until we set the crypto_config.SetProofVerifier to enable | 132 // TODO(rtenneti): Until we set the crypto_config.SetProofVerifier to enable |
| 132 // ProofVerifier in CryptoTestUtils::HandshakeWithFakeClient, we would not | 133 // ProofVerifier in CryptoTestUtils::HandshakeWithFakeClient, we would not |
| 133 // have sent the following client hello. | 134 // have sent the following client hello. |
| 134 // * One to get the server's certificates | 135 // * One to get the server's certificates |
| 135 EXPECT_EQ(2, CompleteCryptoHandshake()); | 136 EXPECT_EQ(2, CompleteCryptoHandshake()); |
| 136 EXPECT_TRUE(stream_.handshake_complete()); | 137 EXPECT_TRUE(stream_.encryption_established()); |
| 138 EXPECT_TRUE(stream_.handshake_confirmed()); |
| 137 } | 139 } |
| 138 | 140 |
| 139 TEST_F(QuicCryptoServerStreamTest, ZeroRTT) { | 141 TEST_F(QuicCryptoServerStreamTest, ZeroRTT) { |
| 140 if (!Aes128GcmEncrypter::IsSupported()) { | 142 if (!Aes128GcmEncrypter::IsSupported()) { |
| 141 LOG(INFO) << "AES GCM not supported. Test skipped."; | 143 LOG(INFO) << "AES GCM not supported. Test skipped."; |
| 142 return; | 144 return; |
| 143 } | 145 } |
| 144 | 146 |
| 145 QuicGuid guid(1); | 147 QuicGuid guid(1); |
| 146 IPAddressNumber ip; | 148 IPAddressNumber ip; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 message_.set_tag(kSHLO); | 232 message_.set_tag(kSHLO); |
| 231 ConstructHandshakeMessage(); | 233 ConstructHandshakeMessage(); |
| 232 EXPECT_CALL(*connection_, SendConnectionClose( | 234 EXPECT_CALL(*connection_, SendConnectionClose( |
| 233 QUIC_INVALID_CRYPTO_MESSAGE_TYPE)); | 235 QUIC_INVALID_CRYPTO_MESSAGE_TYPE)); |
| 234 stream_.ProcessData(message_data_->data(), message_data_->length()); | 236 stream_.ProcessData(message_data_->data(), message_data_->length()); |
| 235 } | 237 } |
| 236 | 238 |
| 237 } // namespace | 239 } // namespace |
| 238 } // namespace test | 240 } // namespace test |
| 239 } // namespace net | 241 } // namespace net |
| OLD | NEW |