OLD | NEW |
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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 // Returns the header from the last packet written. | 61 // Returns the header from the last packet written. |
62 const QuicPacketHeader& header() { return header_; } | 62 const QuicPacketHeader& header() { return header_; } |
63 | 63 |
64 private: | 64 private: |
65 QuicVersion version_; | 65 QuicVersion version_; |
66 QuicPacketHeader header_; | 66 QuicPacketHeader header_; |
67 }; | 67 }; |
68 | 68 |
69 class FakeChannelIDKey : public ChannelIDKey { | |
70 public: | |
71 // ChannelIDKey implementation | |
72 virtual bool Sign(base::StringPiece signed_data, | |
73 std::string* out_signature) const OVERRIDE { | |
74 *out_signature = ""; | |
75 return true; | |
76 } | |
77 | |
78 virtual std::string SerializeKey() const OVERRIDE { | |
79 return ""; | |
80 } | |
81 }; | |
82 | |
83 class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> { | 69 class QuicClientSessionTest : public ::testing::TestWithParam<QuicVersion> { |
84 protected: | 70 protected: |
85 QuicClientSessionTest() | 71 QuicClientSessionTest() |
86 : writer_(new TestPacketWriter(GetParam())), | 72 : writer_(new TestPacketWriter(GetParam())), |
87 connection_( | 73 connection_( |
88 new PacketSavingConnection(false, SupportedVersions(GetParam()))), | 74 new PacketSavingConnection(false, SupportedVersions(GetParam()))), |
89 session_(connection_, GetSocket().Pass(), writer_.Pass(), NULL, NULL, | 75 session_(connection_, GetSocket().Pass(), writer_.Pass(), NULL, NULL, |
90 make_scoped_ptr((QuicServerInfo*)NULL), | 76 make_scoped_ptr((QuicServerInfo*)NULL), |
91 QuicServerId(kServerHostname, kServerPort, false, | 77 QuicServerId(kServerHostname, kServerPort, false, |
92 PRIVACY_MODE_DISABLED), | 78 PRIVACY_MODE_DISABLED), |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 base::FilePath certs_dir = GetTestCertsDirectory(); | 202 base::FilePath certs_dir = GetTestCertsDirectory(); |
217 | 203 |
218 CertVerifyResult result; | 204 CertVerifyResult result; |
219 ProofVerifyDetailsChromium details; | 205 ProofVerifyDetailsChromium details; |
220 details.cert_verify_result.verified_cert = | 206 details.cert_verify_result.verified_cert = |
221 ImportCertFromFile(certs_dir, "spdy_pooling.pem"); | 207 ImportCertFromFile(certs_dir, "spdy_pooling.pem"); |
222 ASSERT_TRUE(details.cert_verify_result.verified_cert); | 208 ASSERT_TRUE(details.cert_verify_result.verified_cert); |
223 | 209 |
224 session_.OnProofVerifyDetailsAvailable(details); | 210 session_.OnProofVerifyDetailsAvailable(details); |
225 CompleteCryptoHandshake(); | 211 CompleteCryptoHandshake(); |
226 QuicClientSessionPeer::SetChannelIDKey(&session_, new FakeChannelIDKey); | 212 QuicClientSessionPeer::SetChannelIDSent(&session_, true); |
227 | 213 |
228 EXPECT_TRUE(session_.CanPool("www.example.org")); | 214 EXPECT_TRUE(session_.CanPool("www.example.org")); |
229 EXPECT_TRUE(session_.CanPool("mail.example.org")); | 215 EXPECT_TRUE(session_.CanPool("mail.example.org")); |
230 EXPECT_FALSE(session_.CanPool("mail.example.com")); | 216 EXPECT_FALSE(session_.CanPool("mail.example.com")); |
231 EXPECT_FALSE(session_.CanPool("mail.google.com")); | 217 EXPECT_FALSE(session_.CanPool("mail.google.com")); |
232 } | 218 } |
233 | 219 |
234 } // namespace | 220 } // namespace |
235 } // namespace test | 221 } // namespace test |
236 } // namespace net | 222 } // namespace net |
OLD | NEW |