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

Side by Side Diff: net/quic/crypto/quic_crypto_client_config_test.cc

Issue 192583004: QUIC - use QuicSessionKey tuple (host, port, is_https) instead of server_hostname (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with TOT Created 6 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/crypto/quic_crypto_client_config.h" 5 #include "net/quic/crypto/quic_crypto_client_config.h"
6 6
7 #include "net/quic/crypto/proof_verifier.h" 7 #include "net/quic/crypto/proof_verifier.h"
8 #include "net/quic/quic_session_key.h"
8 #include "net/quic/test_tools/quic_test_utils.h" 9 #include "net/quic/test_tools/quic_test_utils.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 using std::string; 12 using std::string;
12 13
13 namespace net { 14 namespace net {
14 namespace test { 15 namespace test {
15 16
16 TEST(QuicCryptoClientConfigTest, CachedState_IsEmpty) { 17 TEST(QuicCryptoClientConfigTest, CachedState_IsEmpty) {
17 QuicCryptoClientConfig::CachedState state; 18 QuicCryptoClientConfig::CachedState state;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 string error; 84 string error;
84 QuicCryptoClientConfig config; 85 QuicCryptoClientConfig config;
85 EXPECT_EQ(QUIC_VERSION_NEGOTIATION_MISMATCH, 86 EXPECT_EQ(QUIC_VERSION_NEGOTIATION_MISMATCH,
86 config.ProcessServerHello(msg, 0, supported_versions, 87 config.ProcessServerHello(msg, 0, supported_versions,
87 &cached, &out_params, &error)); 88 &cached, &out_params, &error));
88 EXPECT_EQ("Downgrade attack detected", error); 89 EXPECT_EQ("Downgrade attack detected", error);
89 } 90 }
90 91
91 TEST(QuicCryptoClientConfigTest, InitializeFrom) { 92 TEST(QuicCryptoClientConfigTest, InitializeFrom) {
92 QuicCryptoClientConfig config; 93 QuicCryptoClientConfig config;
94 QuicSessionKey canonical_key1("www.google.com", 80, false);
93 QuicCryptoClientConfig::CachedState* state = 95 QuicCryptoClientConfig::CachedState* state =
94 config.LookupOrCreate("www.google.com"); 96 config.LookupOrCreate(canonical_key1);
95 // TODO(rch): Populate other fields of |state|. 97 // TODO(rch): Populate other fields of |state|.
96 state->set_source_address_token("TOKEN"); 98 state->set_source_address_token("TOKEN");
97 state->SetProofValid(); 99 state->SetProofValid();
98 100
99 config.InitializeFrom("mail.google.com", "www.google.com", &config); 101 QuicSessionKey other_key("mail.google.com", 80, false);
100 QuicCryptoClientConfig::CachedState* other = 102 config.InitializeFrom(other_key, canonical_key1, &config);
101 config.LookupOrCreate("mail.google.com"); 103 QuicCryptoClientConfig::CachedState* other = config.LookupOrCreate(other_key);
102 104
103 EXPECT_EQ(state->server_config(), other->server_config()); 105 EXPECT_EQ(state->server_config(), other->server_config());
104 EXPECT_EQ(state->source_address_token(), other->source_address_token()); 106 EXPECT_EQ(state->source_address_token(), other->source_address_token());
105 EXPECT_EQ(state->certs(), other->certs()); 107 EXPECT_EQ(state->certs(), other->certs());
106 EXPECT_EQ(1u, other->generation_counter()); 108 EXPECT_EQ(1u, other->generation_counter());
107 } 109 }
108 110
109 } // namespace test 111 } // namespace test
110 } // namespace net 112 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698