| 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_client_stream.h" | 5 #include "net/quic/quic_crypto_client_stream.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "net/quic/crypto/aes_128_gcm_encrypter.h" | 8 #include "net/quic/crypto/aes_128_gcm_encrypter.h" |
| 9 #include "net/quic/crypto/quic_decrypter.h" | 9 #include "net/quic/crypto/quic_decrypter.h" |
| 10 #include "net/quic/crypto/quic_encrypter.h" | 10 #include "net/quic/crypto/quic_encrypter.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 QuicConfig config_; | 91 QuicConfig config_; |
| 92 QuicCryptoClientConfig crypto_config_; | 92 QuicCryptoClientConfig crypto_config_; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 TEST_F(QuicCryptoClientStreamTest, NotInitiallyConected) { | 95 TEST_F(QuicCryptoClientStreamTest, NotInitiallyConected) { |
| 96 if (!Aes128GcmEncrypter::IsSupported()) { | 96 if (!Aes128GcmEncrypter::IsSupported()) { |
| 97 LOG(INFO) << "AES GCM not supported. Test skipped."; | 97 LOG(INFO) << "AES GCM not supported. Test skipped."; |
| 98 return; | 98 return; |
| 99 } | 99 } |
| 100 | 100 |
| 101 EXPECT_FALSE(stream_.handshake_complete()); | 101 EXPECT_FALSE(stream_.encryption_established()); |
| 102 EXPECT_FALSE(stream_.handshake_confirmed()); |
| 102 } | 103 } |
| 103 | 104 |
| 104 TEST_F(QuicCryptoClientStreamTest, ConnectedAfterSHLO) { | 105 TEST_F(QuicCryptoClientStreamTest, ConnectedAfterSHLO) { |
| 105 if (!Aes128GcmEncrypter::IsSupported()) { | 106 if (!Aes128GcmEncrypter::IsSupported()) { |
| 106 LOG(INFO) << "AES GCM not supported. Test skipped."; | 107 LOG(INFO) << "AES GCM not supported. Test skipped."; |
| 107 return; | 108 return; |
| 108 } | 109 } |
| 109 | 110 |
| 110 CompleteCryptoHandshake(); | 111 CompleteCryptoHandshake(); |
| 111 EXPECT_TRUE(stream_.handshake_complete()); | 112 EXPECT_TRUE(stream_.encryption_established()); |
| 113 EXPECT_TRUE(stream_.handshake_confirmed()); |
| 112 } | 114 } |
| 113 | 115 |
| 114 TEST_F(QuicCryptoClientStreamTest, MessageAfterHandshake) { | 116 TEST_F(QuicCryptoClientStreamTest, MessageAfterHandshake) { |
| 115 if (!Aes128GcmEncrypter::IsSupported()) { | 117 if (!Aes128GcmEncrypter::IsSupported()) { |
| 116 LOG(INFO) << "AES GCM not supported. Test skipped."; | 118 LOG(INFO) << "AES GCM not supported. Test skipped."; |
| 117 return; | 119 return; |
| 118 } | 120 } |
| 119 | 121 |
| 120 CompleteCryptoHandshake(); | 122 CompleteCryptoHandshake(); |
| 121 | 123 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 159 |
| 158 const QuicCryptoNegotiatedParameters& crypto_params( | 160 const QuicCryptoNegotiatedParameters& crypto_params( |
| 159 stream_.crypto_negotiated_params()); | 161 stream_.crypto_negotiated_params()); |
| 160 EXPECT_EQ(kAESG, crypto_params.aead); | 162 EXPECT_EQ(kAESG, crypto_params.aead); |
| 161 EXPECT_EQ(kC255, crypto_params.key_exchange); | 163 EXPECT_EQ(kC255, crypto_params.key_exchange); |
| 162 } | 164 } |
| 163 | 165 |
| 164 } // namespace | 166 } // namespace |
| 165 } // namespace test | 167 } // namespace test |
| 166 } // namespace net | 168 } // namespace net |
| OLD | NEW |