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

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

Issue 333803007: Rather than passing initial_flow_control_window all the way down the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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_server_id.h" 8 #include "net/quic/quic_server_id.h"
9 #include "net/quic/test_tools/mock_random.h" 9 #include "net/quic/test_tools/mock_random.h"
10 #include "net/quic/test_tools/quic_test_utils.h" 10 #include "net/quic/test_tools/quic_test_utils.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 QuicTag pdmd; 103 QuicTag pdmd;
104 EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kPDMD, &pdmd)); 104 EXPECT_EQ(QUIC_NO_ERROR, msg.GetUint32(kPDMD, &pdmd));
105 EXPECT_EQ(kX59R, pdmd); 105 EXPECT_EQ(kX59R, pdmd);
106 } 106 }
107 107
108 TEST(QuicCryptoClientConfigTest, FillClientHello) { 108 TEST(QuicCryptoClientConfigTest, FillClientHello) {
109 QuicCryptoClientConfig::CachedState state; 109 QuicCryptoClientConfig::CachedState state;
110 QuicCryptoClientConfig config; 110 QuicCryptoClientConfig config;
111 QuicCryptoNegotiatedParameters params; 111 QuicCryptoNegotiatedParameters params;
112 QuicConnectionId kConnectionId = 1234; 112 QuicConnectionId kConnectionId = 1234;
113 uint32 kInitialFlowControlWindow = 5678;
114 string error_details; 113 string error_details;
115 MockRandom rand; 114 MockRandom rand;
116 CryptoHandshakeMessage chlo; 115 CryptoHandshakeMessage chlo;
117 QuicServerId server_id("www.google.com", 80, false, PRIVACY_MODE_DISABLED); 116 QuicServerId server_id("www.google.com", 80, false, PRIVACY_MODE_DISABLED);
118 config.FillClientHello(server_id, 117 config.FillClientHello(server_id,
119 kConnectionId, 118 kConnectionId,
120 QuicVersionMax(), 119 QuicVersionMax(),
121 kInitialFlowControlWindow,
122 &state, 120 &state,
123 QuicWallTime::Zero(), 121 QuicWallTime::Zero(),
124 &rand, 122 &rand,
125 NULL, // channel_id_key 123 NULL, // channel_id_key
126 &params, 124 &params,
127 &chlo, 125 &chlo,
128 &error_details); 126 &error_details);
129 127
130 // Verify that certain QuicTags have been set correctly in the CHLO. 128 // Verify that certain QuicTags have been set correctly in the CHLO.
131 QuicTag cver; 129 QuicTag cver;
132 EXPECT_EQ(QUIC_NO_ERROR, chlo.GetUint32(kVER, &cver)); 130 EXPECT_EQ(QUIC_NO_ERROR, chlo.GetUint32(kVER, &cver));
133 EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver); 131 EXPECT_EQ(QuicVersionToQuicTag(QuicVersionMax()), cver);
134
135 QuicTag ifcw;
136 EXPECT_EQ(QUIC_NO_ERROR, chlo.GetUint32(kIFCW, &ifcw));
137 EXPECT_EQ(kInitialFlowControlWindow, ifcw);
138 } 132 }
139 133
140 TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) { 134 TEST(QuicCryptoClientConfigTest, ProcessServerDowngradeAttack) {
141 QuicVersionVector supported_versions = QuicSupportedVersions(); 135 QuicVersionVector supported_versions = QuicSupportedVersions();
142 if (supported_versions.size() == 1) { 136 if (supported_versions.size() == 1) {
143 // No downgrade attack is possible if the client only supports one version. 137 // No downgrade attack is possible if the client only supports one version.
144 return; 138 return;
145 } 139 }
146 QuicTagVector supported_version_tags; 140 QuicTagVector supported_version_tags;
147 for (size_t i = supported_versions.size(); i > 0; --i) { 141 for (size_t i = supported_versions.size(); i > 0; --i) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 EXPECT_EQ(state, cleared_cache); 250 EXPECT_EQ(state, cleared_cache);
257 EXPECT_FALSE(cleared_cache->proof_valid()); 251 EXPECT_FALSE(cleared_cache->proof_valid());
258 EXPECT_TRUE(cleared_cache->server_config().empty()); 252 EXPECT_TRUE(cleared_cache->server_config().empty());
259 EXPECT_TRUE(cleared_cache->certs().empty()); 253 EXPECT_TRUE(cleared_cache->certs().empty());
260 EXPECT_TRUE(cleared_cache->signature().empty()); 254 EXPECT_TRUE(cleared_cache->signature().empty());
261 EXPECT_EQ(2u, cleared_cache->generation_counter()); 255 EXPECT_EQ(2u, cleared_cache->generation_counter());
262 } 256 }
263 257
264 } // namespace test 258 } // namespace test
265 } // namespace net 259 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_crypto_client_config.cc ('k') | net/quic/crypto/quic_crypto_server_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698