| 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_crypto_server_stream.h" | 5 #include "net/quic/quic_crypto_server_stream.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); | 136 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); |
| 137 | 137 |
| 138 QuicConfig client_config; | 138 QuicConfig client_config; |
| 139 client_config.SetDefaults(); | 139 client_config.SetDefaults(); |
| 140 scoped_ptr<TestSession> client_session( | 140 scoped_ptr<TestSession> client_session( |
| 141 new TestSession(client_conn, client_config)); | 141 new TestSession(client_conn, client_config)); |
| 142 QuicCryptoClientConfig client_crypto_config; | 142 QuicCryptoClientConfig client_crypto_config; |
| 143 client_crypto_config.SetDefaults(); | 143 client_crypto_config.SetDefaults(); |
| 144 | 144 |
| 145 scoped_ptr<QuicCryptoClientStream> client(new QuicCryptoClientStream( | 145 scoped_ptr<QuicCryptoClientStream> client(new QuicCryptoClientStream( |
| 146 "test.example.com", client_session.get(), &client_crypto_config)); | 146 "test.example.com", 80, client_session.get(), &client_crypto_config)); |
| 147 client_session->SetCryptoStream(client.get()); | 147 client_session->SetCryptoStream(client.get()); |
| 148 | 148 |
| 149 // Do a first handshake in order to prime the client config with the server's | 149 // Do a first handshake in order to prime the client config with the server's |
| 150 // information. | 150 // information. |
| 151 CHECK(client->CryptoConnect()); | 151 CHECK(client->CryptoConnect()); |
| 152 CHECK_EQ(1u, client_conn->packets_.size()); | 152 CHECK_EQ(1u, client_conn->packets_.size()); |
| 153 | 153 |
| 154 scoped_ptr<TestSession> server_session(new TestSession(server_conn, config_)); | 154 scoped_ptr<TestSession> server_session(new TestSession(server_conn, config_)); |
| 155 scoped_ptr<QuicCryptoServerStream> server( | 155 scoped_ptr<QuicCryptoServerStream> server( |
| 156 new QuicCryptoServerStream(crypto_config_, server_session.get())); | 156 new QuicCryptoServerStream(crypto_config_, server_session.get())); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 169 // authoritative in this time span. | 169 // authoritative in this time span. |
| 170 client_conn->AdvanceTime(QuicTime::Delta::FromSeconds(102000)); | 170 client_conn->AdvanceTime(QuicTime::Delta::FromSeconds(102000)); |
| 171 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(102000)); | 171 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(102000)); |
| 172 | 172 |
| 173 // This causes the client's nonce to be different and thus stops the | 173 // This causes the client's nonce to be different and thus stops the |
| 174 // strike-register from rejecting the repeated nonce. | 174 // strike-register from rejecting the repeated nonce. |
| 175 reinterpret_cast<MockRandom*>(client_conn->random_generator())->ChangeValue(); | 175 reinterpret_cast<MockRandom*>(client_conn->random_generator())->ChangeValue(); |
| 176 client_session.reset(new TestSession(client_conn, client_config)); | 176 client_session.reset(new TestSession(client_conn, client_config)); |
| 177 server_session.reset(new TestSession(server_conn, config_)); | 177 server_session.reset(new TestSession(server_conn, config_)); |
| 178 client.reset(new QuicCryptoClientStream( | 178 client.reset(new QuicCryptoClientStream( |
| 179 "test.example.com", client_session.get(), &client_crypto_config)); | 179 "test.example.com", 80, client_session.get(), &client_crypto_config)); |
| 180 client_session->SetCryptoStream(client.get()); | 180 client_session->SetCryptoStream(client.get()); |
| 181 | 181 |
| 182 server.reset(new QuicCryptoServerStream(crypto_config_, | 182 server.reset(new QuicCryptoServerStream(crypto_config_, |
| 183 server_session.get())); | 183 server_session.get())); |
| 184 server_session->SetCryptoStream(server.get()); | 184 server_session->SetCryptoStream(server.get()); |
| 185 | 185 |
| 186 CHECK(client->CryptoConnect()); | 186 CHECK(client->CryptoConnect()); |
| 187 | 187 |
| 188 if (AsyncStrikeRegisterVerification()) { | 188 if (AsyncStrikeRegisterVerification()) { |
| 189 EXPECT_FALSE(client->handshake_confirmed()); | 189 EXPECT_FALSE(client->handshake_confirmed()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // CompleteCryptoHandshake verifies | 253 // CompleteCryptoHandshake verifies |
| 254 // stream_.crypto_negotiated_params().channel_id is correct. | 254 // stream_.crypto_negotiated_params().channel_id is correct. |
| 255 EXPECT_EQ(2, CompleteCryptoHandshake()); | 255 EXPECT_EQ(2, CompleteCryptoHandshake()); |
| 256 EXPECT_TRUE(stream_.encryption_established()); | 256 EXPECT_TRUE(stream_.encryption_established()); |
| 257 EXPECT_TRUE(stream_.handshake_confirmed()); | 257 EXPECT_TRUE(stream_.handshake_confirmed()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 } // namespace | 260 } // namespace |
| 261 } // namespace test | 261 } // namespace test |
| 262 } // namespace net | 262 } // namespace net |
| OLD | NEW |