Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: net/quic/quic_crypto_server_stream_test.cc

Issue 14287009: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with Tot Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_data_writer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "net/quic/crypto/aes_128_gcm_encrypter.h" 11 #include "net/quic/crypto/aes_128_gcm_encrypter.h"
12 #include "net/quic/crypto/crypto_framer.h" 12 #include "net/quic/crypto/crypto_framer.h"
13 #include "net/quic/crypto/crypto_handshake.h" 13 #include "net/quic/crypto/crypto_handshake.h"
14 #include "net/quic/crypto/crypto_protocol.h" 14 #include "net/quic/crypto/crypto_protocol.h"
15 #include "net/quic/crypto/crypto_server_config.h" 15 #include "net/quic/crypto/crypto_server_config.h"
16 #include "net/quic/crypto/crypto_utils.h" 16 #include "net/quic/crypto/crypto_utils.h"
17 #include "net/quic/crypto/quic_decrypter.h" 17 #include "net/quic/crypto/quic_decrypter.h"
18 #include "net/quic/crypto/quic_encrypter.h" 18 #include "net/quic/crypto/quic_encrypter.h"
19 #include "net/quic/quic_crypto_client_stream.h" 19 #include "net/quic/quic_crypto_client_stream.h"
20 #include "net/quic/quic_crypto_server_stream.h"
21 #include "net/quic/quic_protocol.h" 20 #include "net/quic/quic_protocol.h"
22 #include "net/quic/quic_session.h" 21 #include "net/quic/quic_session.h"
23 #include "net/quic/test_tools/crypto_test_utils.h" 22 #include "net/quic/test_tools/crypto_test_utils.h"
24 #include "net/quic/test_tools/quic_test_utils.h" 23 #include "net/quic/test_tools/quic_test_utils.h"
25 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
26 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
27 26
28 namespace net { 27 namespace net {
29 class QuicConnection; 28 class QuicConnection;
30 class ReliableQuicStream; 29 class ReliableQuicStream;
31 } // namespace net 30 } // namespace net
32 31
33 using testing::_; 32 using testing::_;
34 33
35 namespace net { 34 namespace net {
36 namespace test { 35 namespace test {
37 namespace { 36 namespace {
38 37
39 // TODO(agl): Use rch's utility class for parsing a message when committed. 38 // TODO(agl): Use rch's utility class for parsing a message when committed.
40 class TestQuicVisitor : public NoOpFramerVisitor { 39 class TestQuicVisitor : public NoOpFramerVisitor {
41 public: 40 public:
42 TestQuicVisitor() {} 41 TestQuicVisitor() {}
43 42
44 // NoOpFramerVisitor 43 // NoOpFramerVisitor
45 virtual void OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE { 44 virtual bool OnStreamFrame(const QuicStreamFrame& frame) OVERRIDE {
46 frame_ = frame; 45 frame_ = frame;
46 return true;
47 } 47 }
48 48
49 QuicStreamFrame* frame() { return &frame_; } 49 QuicStreamFrame* frame() { return &frame_; }
50 50
51 private: 51 private:
52 QuicStreamFrame frame_; 52 QuicStreamFrame frame_;
53 53
54 DISALLOW_COPY_AND_ASSIGN(TestQuicVisitor); 54 DISALLOW_COPY_AND_ASSIGN(TestQuicVisitor);
55 }; 55 };
56 56
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 EXPECT_FALSE(stream_.handshake_complete()); 118 EXPECT_FALSE(stream_.handshake_complete());
119 } 119 }
120 120
121 TEST_F(QuicCryptoServerStreamTest, ConnectedAfterCHLO) { 121 TEST_F(QuicCryptoServerStreamTest, ConnectedAfterCHLO) {
122 if (!Aes128GcmEncrypter::IsSupported()) { 122 if (!Aes128GcmEncrypter::IsSupported()) {
123 LOG(INFO) << "AES GCM not supported. Test skipped."; 123 LOG(INFO) << "AES GCM not supported. Test skipped.";
124 return; 124 return;
125 } 125 }
126 126
127 // CompleteCryptoHandshake returns the number of client hellos sent. This
128 // test should send:
129 // * One to get a source-address token.
130 // * One to complete the handshake.
131 // TODO(rtenneti): Until we set the crypto_config.SetProofVerifier to enable
132 // ProofVerifier in CryptoTestUtils::HandshakeWithFakeClient, we would not
133 // have sent the following client hello.
134 // * One to get the server's certificates
127 EXPECT_EQ(2, CompleteCryptoHandshake()); 135 EXPECT_EQ(2, CompleteCryptoHandshake());
128 EXPECT_TRUE(stream_.handshake_complete()); 136 EXPECT_TRUE(stream_.handshake_complete());
129 } 137 }
130 138
131 TEST_F(QuicCryptoServerStreamTest, ZeroRTT) { 139 TEST_F(QuicCryptoServerStreamTest, ZeroRTT) {
132 if (!Aes128GcmEncrypter::IsSupported()) { 140 if (!Aes128GcmEncrypter::IsSupported()) {
133 LOG(INFO) << "AES GCM not supported. Test skipped."; 141 LOG(INFO) << "AES GCM not supported. Test skipped.";
134 return; 142 return;
135 } 143 }
136 144
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 message_.set_tag(kSHLO); 230 message_.set_tag(kSHLO);
223 ConstructHandshakeMessage(); 231 ConstructHandshakeMessage();
224 EXPECT_CALL(*connection_, SendConnectionClose( 232 EXPECT_CALL(*connection_, SendConnectionClose(
225 QUIC_INVALID_CRYPTO_MESSAGE_TYPE)); 233 QUIC_INVALID_CRYPTO_MESSAGE_TYPE));
226 stream_.ProcessData(message_data_->data(), message_data_->length()); 234 stream_.ProcessData(message_data_->data(), message_data_->length());
227 } 235 }
228 236
229 } // namespace 237 } // namespace
230 } // namespace test 238 } // namespace test
231 } // namespace net 239 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_data_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698