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

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

Issue 185773006: Add PrivacyMode support to the QuicStreamFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again 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/crypto/quic_crypto_client_config.cc ('k') | net/quic/quic_client_session_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 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/quic_session_key.h"
9 #include "net/quic/test_tools/quic_test_utils.h" 9 #include "net/quic/test_tools/quic_test_utils.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 EXPECT_EQ(state.source_address_token(), other.source_address_token()); 49 EXPECT_EQ(state.source_address_token(), other.source_address_token());
50 EXPECT_EQ(state.certs(), other.certs()); 50 EXPECT_EQ(state.certs(), other.certs());
51 EXPECT_EQ(1u, other.generation_counter()); 51 EXPECT_EQ(1u, other.generation_counter());
52 } 52 }
53 53
54 TEST(QuicCryptoClientConfigTest, InchoateChlo) { 54 TEST(QuicCryptoClientConfigTest, InchoateChlo) {
55 QuicCryptoClientConfig::CachedState state; 55 QuicCryptoClientConfig::CachedState state;
56 QuicCryptoClientConfig config; 56 QuicCryptoClientConfig config;
57 QuicCryptoNegotiatedParameters params; 57 QuicCryptoNegotiatedParameters params;
58 CryptoHandshakeMessage msg; 58 CryptoHandshakeMessage msg;
59 QuicSessionKey server_key("www.google.com", 80, false); 59 QuicSessionKey server_key("www.google.com", 80, false, kPrivacyModeDisabled);
60 config.FillInchoateClientHello(server_key, QuicVersionMax(), &state, 60 config.FillInchoateClientHello(server_key, QuicVersionMax(), &state,
61 &params, &msg); 61 &params, &msg);
62 62
63 QuicTag cver; 63 QuicTag cver;
64 EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kVER, &cver)); 64 EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kVER, &cver));
65 EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver); 65 EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver);
66 } 66 }
67 67
68 TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) { 68 TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) {
69 QuicVersionVector supported_versions = QuicSupportedVersions(); 69 QuicVersionVector supported_versions = QuicSupportedVersions();
(...skipping 15 matching lines...) Expand all
85 string error; 85 string error;
86 QuicCryptoClientConfig config; 86 QuicCryptoClientConfig config;
87 EXPECT_EQ(QUIC_VERSION_NEGOTIATION_MISMATCH, 87 EXPECT_EQ(QUIC_VERSION_NEGOTIATION_MISMATCH,
88 config.ProcessServerHello(msg, 0, supported_versions, 88 config.ProcessServerHello(msg, 0, supported_versions,
89 &cached, &out_params, &error)); 89 &cached, &out_params, &error));
90 EXPECT_EQ("Downgrade attack detected", error); 90 EXPECT_EQ("Downgrade attack detected", error);
91 } 91 }
92 92
93 TEST(QuicCryptoClientConfigTest, InitializeFrom) { 93 TEST(QuicCryptoClientConfigTest, InitializeFrom) {
94 QuicCryptoClientConfig config; 94 QuicCryptoClientConfig config;
95 QuicSessionKey canonical_key1("www.google.com", 80, false); 95 QuicSessionKey canonical_key1("www.google.com", 80, false,
96 kPrivacyModeDisabled);
96 QuicCryptoClientConfig::CachedState* state = 97 QuicCryptoClientConfig::CachedState* state =
97 config.LookupOrCreate(canonical_key1); 98 config.LookupOrCreate(canonical_key1);
98 // TODO(rch): Populate other fields of |state|. 99 // TODO(rch): Populate other fields of |state|.
99 state->set_source_address_token("TOKEN"); 100 state->set_source_address_token("TOKEN");
100 state->SetProofValid(); 101 state->SetProofValid();
101 102
102 QuicSessionKey other_key("mail.google.com", 80, false); 103 QuicSessionKey other_key("mail.google.com", 80, false, kPrivacyModeDisabled);
103 config.InitializeFrom(other_key, canonical_key1, &config); 104 config.InitializeFrom(other_key, canonical_key1, &config);
104 QuicCryptoClientConfig::CachedState* other = config.LookupOrCreate(other_key); 105 QuicCryptoClientConfig::CachedState* other = config.LookupOrCreate(other_key);
105 106
106 EXPECT_EQ(state->server_config(), other->server_config()); 107 EXPECT_EQ(state->server_config(), other->server_config());
107 EXPECT_EQ(state->source_address_token(), other->source_address_token()); 108 EXPECT_EQ(state->source_address_token(), other->source_address_token());
108 EXPECT_EQ(state->certs(), other->certs()); 109 EXPECT_EQ(state->certs(), other->certs());
109 EXPECT_EQ(1u, other->generation_counter()); 110 EXPECT_EQ(1u, other->generation_counter());
110 } 111 }
111 112
112 } // namespace test 113 } // namespace test
113 } // namespace net 114 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_crypto_client_config.cc ('k') | net/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698