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

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

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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
« no previous file with comments | « net/quic/quic_client_session.cc ('k') | net/quic/quic_connection_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_client_session.h" 5 #include "net/quic/quic_client_session.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // www.example.com 149 // www.example.com
150 150
151 ProofVerifyDetailsChromium details; 151 ProofVerifyDetailsChromium details;
152 details.cert_verify_result.verified_cert = 152 details.cert_verify_result.verified_cert =
153 ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem"); 153 ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem");
154 ASSERT_TRUE(details.cert_verify_result.verified_cert.get()); 154 ASSERT_TRUE(details.cert_verify_result.verified_cert.get());
155 155
156 session_.OnProofVerifyDetailsAvailable(details); 156 session_.OnProofVerifyDetailsAvailable(details);
157 CompleteCryptoHandshake(); 157 CompleteCryptoHandshake();
158 158
159 159 EXPECT_TRUE(session_.CanPool("www.example.org", PRIVACY_MODE_DISABLED));
160 EXPECT_TRUE(session_.CanPool("www.example.org")); 160 EXPECT_FALSE(session_.CanPool("www.example.org", PRIVACY_MODE_ENABLED));
161 EXPECT_TRUE(session_.CanPool("mail.example.org")); 161 EXPECT_TRUE(session_.CanPool("mail.example.org", PRIVACY_MODE_DISABLED));
162 EXPECT_TRUE(session_.CanPool("mail.example.com")); 162 EXPECT_TRUE(session_.CanPool("mail.example.com", PRIVACY_MODE_DISABLED));
163 EXPECT_FALSE(session_.CanPool("mail.google.com")); 163 EXPECT_FALSE(session_.CanPool("mail.google.com", PRIVACY_MODE_DISABLED));
164 } 164 }
165 165
166 TEST_P(QuicClientSessionTest, ConnectionPooledWithTlsChannelId) { 166 TEST_P(QuicClientSessionTest, ConnectionPooledWithTlsChannelId) {
167 // Load a cert that is valid for: 167 // Load a cert that is valid for:
168 // www.example.org 168 // www.example.org
169 // mail.example.org 169 // mail.example.org
170 // www.example.com 170 // www.example.com
171 171
172 ProofVerifyDetailsChromium details; 172 ProofVerifyDetailsChromium details;
173 details.cert_verify_result.verified_cert = 173 details.cert_verify_result.verified_cert =
174 ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem"); 174 ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem");
175 ASSERT_TRUE(details.cert_verify_result.verified_cert.get()); 175 ASSERT_TRUE(details.cert_verify_result.verified_cert.get());
176 176
177 session_.OnProofVerifyDetailsAvailable(details); 177 session_.OnProofVerifyDetailsAvailable(details);
178 CompleteCryptoHandshake(); 178 CompleteCryptoHandshake();
179 QuicClientSessionPeer::SetChannelIDSent(&session_, true); 179 QuicClientSessionPeer::SetChannelIDSent(&session_, true);
180 180
181 EXPECT_TRUE(session_.CanPool("www.example.org")); 181 EXPECT_TRUE(session_.CanPool("www.example.org", PRIVACY_MODE_DISABLED));
182 EXPECT_TRUE(session_.CanPool("mail.example.org")); 182 EXPECT_TRUE(session_.CanPool("mail.example.org", PRIVACY_MODE_DISABLED));
183 EXPECT_FALSE(session_.CanPool("mail.example.com")); 183 EXPECT_FALSE(session_.CanPool("mail.example.com", PRIVACY_MODE_DISABLED));
184 EXPECT_FALSE(session_.CanPool("mail.google.com")); 184 EXPECT_FALSE(session_.CanPool("mail.google.com", PRIVACY_MODE_DISABLED));
185 } 185 }
186 186
187 TEST_P(QuicClientSessionTest, ConnectionNotPooledWithDifferentPin) { 187 TEST_P(QuicClientSessionTest, ConnectionNotPooledWithDifferentPin) {
188 uint8 primary_pin = 1; 188 uint8 primary_pin = 1;
189 uint8 backup_pin = 2; 189 uint8 backup_pin = 2;
190 uint8 bad_pin = 3; 190 uint8 bad_pin = 3;
191 AddPin(&transport_security_state_, "mail.example.org", primary_pin, 191 AddPin(&transport_security_state_, "mail.example.org", primary_pin,
192 backup_pin); 192 backup_pin);
193 193
194 ProofVerifyDetailsChromium details; 194 ProofVerifyDetailsChromium details;
195 details.cert_verify_result.verified_cert = 195 details.cert_verify_result.verified_cert =
196 ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem"); 196 ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem");
197 details.cert_verify_result.is_issued_by_known_root = true; 197 details.cert_verify_result.is_issued_by_known_root = true;
198 details.cert_verify_result.public_key_hashes.push_back( 198 details.cert_verify_result.public_key_hashes.push_back(
199 GetTestHashValue(bad_pin)); 199 GetTestHashValue(bad_pin));
200 200
201 ASSERT_TRUE(details.cert_verify_result.verified_cert.get()); 201 ASSERT_TRUE(details.cert_verify_result.verified_cert.get());
202 202
203 session_.OnProofVerifyDetailsAvailable(details); 203 session_.OnProofVerifyDetailsAvailable(details);
204 CompleteCryptoHandshake(); 204 CompleteCryptoHandshake();
205 QuicClientSessionPeer::SetChannelIDSent(&session_, true); 205 QuicClientSessionPeer::SetChannelIDSent(&session_, true);
206 206
207 EXPECT_FALSE(session_.CanPool("mail.example.org")); 207 EXPECT_FALSE(session_.CanPool("mail.example.org", PRIVACY_MODE_DISABLED));
208 } 208 }
209 209
210 TEST_P(QuicClientSessionTest, ConnectionPooledWithMatchingPin) { 210 TEST_P(QuicClientSessionTest, ConnectionPooledWithMatchingPin) {
211 uint8 primary_pin = 1; 211 uint8 primary_pin = 1;
212 uint8 backup_pin = 2; 212 uint8 backup_pin = 2;
213 AddPin(&transport_security_state_, "mail.example.org", primary_pin, 213 AddPin(&transport_security_state_, "mail.example.org", primary_pin,
214 backup_pin); 214 backup_pin);
215 215
216 ProofVerifyDetailsChromium details; 216 ProofVerifyDetailsChromium details;
217 details.cert_verify_result.verified_cert = 217 details.cert_verify_result.verified_cert =
218 ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem"); 218 ImportCertFromFile(GetTestCertsDirectory(), "spdy_pooling.pem");
219 details.cert_verify_result.is_issued_by_known_root = true; 219 details.cert_verify_result.is_issued_by_known_root = true;
220 details.cert_verify_result.public_key_hashes.push_back( 220 details.cert_verify_result.public_key_hashes.push_back(
221 GetTestHashValue(primary_pin)); 221 GetTestHashValue(primary_pin));
222 222
223 ASSERT_TRUE(details.cert_verify_result.verified_cert.get()); 223 ASSERT_TRUE(details.cert_verify_result.verified_cert.get());
224 224
225 session_.OnProofVerifyDetailsAvailable(details); 225 session_.OnProofVerifyDetailsAvailable(details);
226 CompleteCryptoHandshake(); 226 CompleteCryptoHandshake();
227 QuicClientSessionPeer::SetChannelIDSent(&session_, true); 227 QuicClientSessionPeer::SetChannelIDSent(&session_, true);
228 228
229 EXPECT_TRUE(session_.CanPool("mail.example.org")); 229 EXPECT_TRUE(session_.CanPool("mail.example.org", PRIVACY_MODE_DISABLED));
230 } 230 }
231 231
232 } // namespace 232 } // namespace
233 } // namespace test 233 } // namespace test
234 } // namespace net 234 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_client_session.cc ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698