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

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

Issue 217053010: Revert of Rename PrivateMode enum values: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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_client_session_test.cc ('k') | net/quic/quic_crypto_server_stream_test.cc » ('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_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_12_encrypter.h" 8 #include "net/quic/crypto/aes_128_gcm_12_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 10 matching lines...) Expand all
21 namespace { 21 namespace {
22 22
23 const char kServerHostname[] = "example.com"; 23 const char kServerHostname[] = "example.com";
24 const uint16 kServerPort = 80; 24 const uint16 kServerPort = 80;
25 25
26 class QuicCryptoClientStreamTest : public ::testing::Test { 26 class QuicCryptoClientStreamTest : public ::testing::Test {
27 public: 27 public:
28 QuicCryptoClientStreamTest() 28 QuicCryptoClientStreamTest()
29 : connection_(new PacketSavingConnection(false)), 29 : connection_(new PacketSavingConnection(false)),
30 session_(new TestClientSession(connection_, DefaultQuicConfig())), 30 session_(new TestClientSession(connection_, DefaultQuicConfig())),
31 server_key_(kServerHostname, kServerPort, false, PRIVACY_MODE_DISABLED), 31 server_key_(kServerHostname, kServerPort, false, kPrivacyModeDisabled),
32 stream_(new QuicCryptoClientStream( 32 stream_(new QuicCryptoClientStream(
33 server_key_, session_.get(), NULL, &crypto_config_)) { 33 server_key_, session_.get(), NULL, &crypto_config_)) {
34 session_->SetCryptoStream(stream_.get()); 34 session_->SetCryptoStream(stream_.get());
35 session_->config()->SetDefaults(); 35 session_->config()->SetDefaults();
36 crypto_config_.SetDefaults(); 36 crypto_config_.SetDefaults();
37 } 37 }
38 38
39 void CompleteCryptoHandshake() { 39 void CompleteCryptoHandshake() {
40 EXPECT_TRUE(stream_->CryptoConnect()); 40 EXPECT_TRUE(stream_->CryptoConnect());
41 CryptoTestUtils::HandshakeWithFakeServer(connection_, stream_.get()); 41 CryptoTestUtils::HandshakeWithFakeServer(connection_, stream_.get());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 config->max_streams_per_connection()); 99 config->max_streams_per_connection());
100 EXPECT_EQ(0, config->keepalive_timeout().ToSeconds()); 100 EXPECT_EQ(0, config->keepalive_timeout().ToSeconds());
101 101
102 const QuicCryptoNegotiatedParameters& crypto_params( 102 const QuicCryptoNegotiatedParameters& crypto_params(
103 stream_->crypto_negotiated_params()); 103 stream_->crypto_negotiated_params());
104 EXPECT_EQ(crypto_config_.aead[0], crypto_params.aead); 104 EXPECT_EQ(crypto_config_.aead[0], crypto_params.aead);
105 EXPECT_EQ(crypto_config_.kexs[0], crypto_params.key_exchange); 105 EXPECT_EQ(crypto_config_.kexs[0], crypto_params.key_exchange);
106 } 106 }
107 107
108 TEST_F(QuicCryptoClientStreamTest, InvalidHostname) { 108 TEST_F(QuicCryptoClientStreamTest, InvalidHostname) {
109 QuicSessionKey server_key("invalid", 80, false, PRIVACY_MODE_DISABLED); 109 QuicSessionKey server_key("invalid", 80, false, kPrivacyModeDisabled);
110 stream_.reset(new QuicCryptoClientStream(server_key, session_.get(), NULL, 110 stream_.reset(new QuicCryptoClientStream(server_key, session_.get(), NULL,
111 &crypto_config_)); 111 &crypto_config_));
112 session_->SetCryptoStream(stream_.get()); 112 session_->SetCryptoStream(stream_.get());
113 113
114 CompleteCryptoHandshake(); 114 CompleteCryptoHandshake();
115 EXPECT_TRUE(stream_->encryption_established()); 115 EXPECT_TRUE(stream_->encryption_established());
116 EXPECT_TRUE(stream_->handshake_confirmed()); 116 EXPECT_TRUE(stream_->handshake_confirmed());
117 } 117 }
118 118
119 TEST_F(QuicCryptoClientStreamTest, ExpiredServerConfig) { 119 TEST_F(QuicCryptoClientStreamTest, ExpiredServerConfig) {
(...skipping 15 matching lines...) Expand all
135 135
136 // Check that a client hello was sent and that CryptoConnect doesn't fail 136 // Check that a client hello was sent and that CryptoConnect doesn't fail
137 // with an error. 137 // with an error.
138 EXPECT_TRUE(stream_->CryptoConnect()); 138 EXPECT_TRUE(stream_->CryptoConnect());
139 ASSERT_EQ(1u, connection_->packets_.size()); 139 ASSERT_EQ(1u, connection_->packets_.size());
140 } 140 }
141 141
142 } // namespace 142 } // namespace
143 } // namespace test 143 } // namespace test
144 } // namespace net 144 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_client_session_test.cc ('k') | net/quic/quic_crypto_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698