| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "net/quic/crypto/quic_crypto_client_config.h" | 21 #include "net/quic/crypto/quic_crypto_client_config.h" |
| 22 #include "net/quic/crypto/quic_crypto_server_config.h" | 22 #include "net/quic/crypto/quic_crypto_server_config.h" |
| 23 #include "net/quic/quic_crypto_client_stream.h" | 23 #include "net/quic/quic_crypto_client_stream.h" |
| 24 #include "net/quic/quic_crypto_server_stream.h" | 24 #include "net/quic/quic_crypto_server_stream.h" |
| 25 #include "webrtc/base/common.h" | 25 #include "webrtc/base/common.h" |
| 26 #include "webrtc/base/gunit.h" | 26 #include "webrtc/base/gunit.h" |
| 27 #include "webrtc/p2p/base/faketransportcontroller.h" | 27 #include "webrtc/p2p/base/faketransportcontroller.h" |
| 28 #include "webrtc/p2p/quic/quicconnectionhelper.h" | 28 #include "webrtc/p2p/quic/quicconnectionhelper.h" |
| 29 #include "webrtc/p2p/quic/reliablequicstream.h" | 29 #include "webrtc/p2p/quic/reliablequicstream.h" |
| 30 | 30 |
| 31 using net::IPAddressNumber; | 31 using net::IPAddress; |
| 32 using net::IPEndPoint; | 32 using net::IPEndPoint; |
| 33 using net::PerPacketOptions; |
| 33 using net::Perspective; | 34 using net::Perspective; |
| 34 using net::ProofVerifyContext; | 35 using net::ProofVerifyContext; |
| 35 using net::ProofVerifyDetails; | 36 using net::ProofVerifyDetails; |
| 36 using net::QuicByteCount; | 37 using net::QuicByteCount; |
| 37 using net::QuicClock; | 38 using net::QuicClock; |
| 38 using net::QuicConfig; | 39 using net::QuicConfig; |
| 39 using net::QuicConnection; | 40 using net::QuicConnection; |
| 40 using net::QuicCryptoClientConfig; | 41 using net::QuicCryptoClientConfig; |
| 41 using net::QuicCryptoServerConfig; | 42 using net::QuicCryptoServerConfig; |
| 42 using net::QuicCryptoClientStream; | 43 using net::QuicCryptoClientStream; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 53 | 54 |
| 54 using cricket::FakeTransportChannel; | 55 using cricket::FakeTransportChannel; |
| 55 using cricket::QuicConnectionHelper; | 56 using cricket::QuicConnectionHelper; |
| 56 using cricket::QuicSession; | 57 using cricket::QuicSession; |
| 57 using cricket::ReliableQuicStream; | 58 using cricket::ReliableQuicStream; |
| 58 using cricket::TransportChannel; | 59 using cricket::TransportChannel; |
| 59 | 60 |
| 60 using rtc::Thread; | 61 using rtc::Thread; |
| 61 | 62 |
| 62 // Timeout for running asynchronous operations within unit tests. | 63 // Timeout for running asynchronous operations within unit tests. |
| 63 const int kTimeoutMs = 1000; | 64 static const int kTimeoutMs = 1000; |
| 64 // Testing SpdyPriority value for creating outgoing ReliableQuicStream. | 65 // Testing SpdyPriority value for creating outgoing ReliableQuicStream. |
| 65 const uint8 kDefaultPriority = 3; | 66 static const uint8_t kDefaultPriority = 3; |
| 66 // TExport keying material function | 67 // TExport keying material function |
| 67 const char kExporterLabel[] = "label"; | 68 static const char kExporterLabel[] = "label"; |
| 68 const char kExporterContext[] = "context"; | 69 static const char kExporterContext[] = "context"; |
| 69 const size_t kExporterContextLen = sizeof(kExporterContext); | 70 static const size_t kExporterContextLen = sizeof(kExporterContext); |
| 70 // Identifies QUIC server session | 71 // Identifies QUIC server session |
| 71 const QuicServerId kServerId("www.google.com", 443); | 72 static const QuicServerId kServerId("www.google.com", 443); |
| 72 | 73 |
| 73 // Used by QuicCryptoServerConfig to provide server credentials, returning a | 74 // Used by QuicCryptoServerConfig to provide server credentials, returning a |
| 74 // canned response equal to |success|. | 75 // canned response equal to |success|. |
| 75 class FakeProofSource : public net::ProofSource { | 76 class FakeProofSource : public net::ProofSource { |
| 76 public: | 77 public: |
| 77 explicit FakeProofSource(bool success) : success_(success) {} | 78 explicit FakeProofSource(bool success) : success_(success) {} |
| 78 | 79 |
| 79 // ProofSource override. | 80 // ProofSource override. |
| 80 bool GetProof(const net::IPAddressNumber& server_ip, | 81 bool GetProof(const IPAddress& server_ip, |
| 81 const std::string& hostname, | 82 const std::string& hostname, |
| 82 const std::string& server_config, | 83 const std::string& server_config, |
| 84 net::QuicVersion quic_version, |
| 85 base::StringPiece chlo_hash, |
| 83 bool ecdsa_ok, | 86 bool ecdsa_ok, |
| 84 const std::vector<std::string>** out_certs, | 87 scoped_refptr<net::ProofSource::Chain>* out_certs, |
| 85 std::string* out_signature, | 88 std::string* out_signature, |
| 86 std::string* out_leaf_cert_sct) override { | 89 std::string* out_leaf_cert_sct) override { |
| 87 if (success_) { | 90 if (success_) { |
| 88 std::vector<std::string>* certs = new std::vector<std::string>(); | 91 std::vector<std::string> certs; |
| 89 certs->push_back("Required to establish handshake"); | 92 certs.push_back("Required to establish handshake"); |
| 90 std::string signature("Signature"); | 93 *out_certs = new ProofSource::Chain(certs); |
| 91 | 94 *out_signature = "Signature"; |
| 92 *out_certs = certs; | 95 *out_leaf_cert_sct = "Time"; |
| 93 *out_signature = signature; | |
| 94 } | 96 } |
| 95 return success_; | 97 return success_; |
| 96 } | 98 } |
| 97 | 99 |
| 98 private: | 100 private: |
| 99 // Whether or not obtaining proof source succeeds. | 101 // Whether or not obtaining proof source succeeds. |
| 100 bool success_; | 102 bool success_; |
| 101 }; | 103 }; |
| 102 | 104 |
| 103 // Used by QuicCryptoClientConfig to verify server credentials, returning a | 105 // Used by QuicCryptoClientConfig to verify server credentials, returning a |
| (...skipping 23 matching lines...) Expand all Loading... |
| 127 | 129 |
| 128 // Writes QUIC packets to a fake transport channel that simulates a network. | 130 // Writes QUIC packets to a fake transport channel that simulates a network. |
| 129 class FakeQuicPacketWriter : public QuicPacketWriter { | 131 class FakeQuicPacketWriter : public QuicPacketWriter { |
| 130 public: | 132 public: |
| 131 explicit FakeQuicPacketWriter(FakeTransportChannel* fake_channel) | 133 explicit FakeQuicPacketWriter(FakeTransportChannel* fake_channel) |
| 132 : fake_channel_(fake_channel) {} | 134 : fake_channel_(fake_channel) {} |
| 133 | 135 |
| 134 // Sends packets across the network. | 136 // Sends packets across the network. |
| 135 WriteResult WritePacket(const char* buffer, | 137 WriteResult WritePacket(const char* buffer, |
| 136 size_t buf_len, | 138 size_t buf_len, |
| 137 const IPAddressNumber& self_address, | 139 const IPAddress& self_address, |
| 138 const IPEndPoint& peer_address) override { | 140 const IPEndPoint& peer_address, |
| 141 PerPacketOptions* options) override { |
| 139 rtc::PacketOptions packet_options; | 142 rtc::PacketOptions packet_options; |
| 140 int rv = fake_channel_->SendPacket(buffer, buf_len, packet_options, 0); | 143 int rv = fake_channel_->SendPacket(buffer, buf_len, packet_options, 0); |
| 141 net::WriteStatus status; | 144 net::WriteStatus status; |
| 142 if (rv > 0) { | 145 if (rv > 0) { |
| 143 status = net::WRITE_STATUS_OK; | 146 status = net::WRITE_STATUS_OK; |
| 144 } else if (fake_channel_->GetError() == EWOULDBLOCK) { | 147 } else if (fake_channel_->GetError() == EWOULDBLOCK) { |
| 145 status = net::WRITE_STATUS_BLOCKED; | 148 status = net::WRITE_STATUS_BLOCKED; |
| 146 } else { | 149 } else { |
| 147 status = net::WRITE_STATUS_ERROR; | 150 status = net::WRITE_STATUS_ERROR; |
| 148 } | 151 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 166 // size of a valid QUIC packet. | 169 // size of a valid QUIC packet. |
| 167 QuicByteCount GetMaxPacketSize( | 170 QuicByteCount GetMaxPacketSize( |
| 168 const IPEndPoint& peer_address) const override { | 171 const IPEndPoint& peer_address) const override { |
| 169 return net::kMaxPacketSize; | 172 return net::kMaxPacketSize; |
| 170 } | 173 } |
| 171 | 174 |
| 172 private: | 175 private: |
| 173 FakeTransportChannel* fake_channel_; | 176 FakeTransportChannel* fake_channel_; |
| 174 }; | 177 }; |
| 175 | 178 |
| 176 // Creates a FakePacketWriter for a given QuicConnection instance. | |
| 177 class FakePacketWriterFactory : public QuicConnection::PacketWriterFactory { | |
| 178 public: | |
| 179 explicit FakePacketWriterFactory(FakeTransportChannel* channel) | |
| 180 : channel_(channel) {} | |
| 181 | |
| 182 QuicPacketWriter* Create(QuicConnection* connection) const override { | |
| 183 return new FakeQuicPacketWriter(channel_); | |
| 184 } | |
| 185 | |
| 186 private: | |
| 187 FakeTransportChannel* channel_; | |
| 188 }; | |
| 189 | |
| 190 // Wrapper for QuicSession and transport channel that stores incoming data. | 179 // Wrapper for QuicSession and transport channel that stores incoming data. |
| 191 class QuicSessionForTest : public QuicSession { | 180 class QuicSessionForTest : public QuicSession { |
| 192 public: | 181 public: |
| 193 QuicSessionForTest(scoped_ptr<net::QuicConnection> connection, | 182 QuicSessionForTest(rtc::scoped_ptr<net::QuicConnection> connection, |
| 194 const net::QuicConfig& config, | 183 const net::QuicConfig& config, |
| 195 scoped_ptr<FakeTransportChannel> channel) | 184 rtc::scoped_ptr<FakeTransportChannel> channel) |
| 196 : QuicSession(std::move(connection), config), | 185 : QuicSession(std::move(connection), config), |
| 197 channel_(std::move(channel)) { | 186 channel_(std::move(channel)) { |
| 198 channel_->SignalReadPacket.connect( | 187 channel_->SignalReadPacket.connect( |
| 199 this, &QuicSessionForTest::OnChannelReadPacket); | 188 this, &QuicSessionForTest::OnChannelReadPacket); |
| 200 } | 189 } |
| 201 | 190 |
| 202 // Called when channel has packets to read. | 191 // Called when channel has packets to read. |
| 203 void OnChannelReadPacket(TransportChannel* channel, | 192 void OnChannelReadPacket(TransportChannel* channel, |
| 204 const char* data, | 193 const char* data, |
| 205 size_t size, | 194 size_t size, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 223 std::string data() { return last_received_data_; } | 212 std::string data() { return last_received_data_; } |
| 224 | 213 |
| 225 bool has_data() { return data().size() > 0; } | 214 bool has_data() { return data().size() > 0; } |
| 226 | 215 |
| 227 FakeTransportChannel* channel() { return channel_.get(); } | 216 FakeTransportChannel* channel() { return channel_.get(); } |
| 228 | 217 |
| 229 ReliableQuicStream* incoming_stream() { return last_incoming_stream_; } | 218 ReliableQuicStream* incoming_stream() { return last_incoming_stream_; } |
| 230 | 219 |
| 231 private: | 220 private: |
| 232 // Transports QUIC packets to/from peer. | 221 // Transports QUIC packets to/from peer. |
| 233 scoped_ptr<FakeTransportChannel> channel_; | 222 rtc::scoped_ptr<FakeTransportChannel> channel_; |
| 234 // Stores data received by peer once it is sent from the other peer. | 223 // Stores data received by peer once it is sent from the other peer. |
| 235 std::string last_received_data_; | 224 std::string last_received_data_; |
| 236 // Handles incoming streams from sender. | 225 // Handles incoming streams from sender. |
| 237 ReliableQuicStream* last_incoming_stream_ = nullptr; | 226 ReliableQuicStream* last_incoming_stream_ = nullptr; |
| 238 }; | 227 }; |
| 239 | 228 |
| 240 // Simulates data transfer between two peers using QUIC. | 229 // Simulates data transfer between two peers using QUIC. |
| 241 class QuicSessionTest : public ::testing::Test, | 230 class QuicSessionTest : public ::testing::Test, |
| 242 public QuicCryptoClientStream::ProofHandler { | 231 public QuicCryptoClientStream::ProofHandler { |
| 243 public: | 232 public: |
| 244 QuicSessionTest() : quic_helper_(rtc::Thread::Current()) {} | 233 QuicSessionTest() : quic_helper_(rtc::Thread::Current()) {} |
| 245 | 234 |
| 246 // Instantiates |client_peer_| and |server_peer_|. | 235 // Instantiates |client_peer_| and |server_peer_|. |
| 247 void CreateClientAndServerSessions(); | 236 void CreateClientAndServerSessions(); |
| 248 | 237 |
| 249 scoped_ptr<QuicSessionForTest> CreateSession( | 238 rtc::scoped_ptr<QuicSessionForTest> CreateSession( |
| 250 scoped_ptr<FakeTransportChannel> channel, | 239 rtc::scoped_ptr<FakeTransportChannel> channel, |
| 251 Perspective perspective); | 240 Perspective perspective); |
| 252 | 241 |
| 253 QuicCryptoClientStream* CreateCryptoClientStream(QuicSessionForTest* session, | 242 QuicCryptoClientStream* CreateCryptoClientStream(QuicSessionForTest* session, |
| 254 bool handshake_success); | 243 bool handshake_success); |
| 255 QuicCryptoServerStream* CreateCryptoServerStream(QuicSessionForTest* session, | 244 QuicCryptoServerStream* CreateCryptoServerStream(QuicSessionForTest* session, |
| 256 bool handshake_success); | 245 bool handshake_success); |
| 257 | 246 |
| 258 scoped_ptr<QuicConnection> CreateConnection(FakeTransportChannel* channel, | 247 rtc::scoped_ptr<QuicConnection> CreateConnection( |
| 259 Perspective perspective); | 248 FakeTransportChannel* channel, |
| 249 Perspective perspective); |
| 260 | 250 |
| 261 void StartHandshake(bool client_handshake_success, | 251 void StartHandshake(bool client_handshake_success, |
| 262 bool server_handshake_success); | 252 bool server_handshake_success); |
| 263 | 253 |
| 264 // Test handshake establishment and sending/receiving of data. | 254 // Test handshake establishment and sending/receiving of data. |
| 265 void TestStreamConnection(QuicSessionForTest* from_session, | 255 void TestStreamConnection(QuicSessionForTest* from_session, |
| 266 QuicSessionForTest* to_session); | 256 QuicSessionForTest* to_session); |
| 267 // Test that client and server are not connected after handshake failure. | 257 // Test that client and server are not connected after handshake failure. |
| 268 void TestDisconnectAfterFailedHandshake(); | 258 void TestDisconnectAfterFailedHandshake(); |
| 269 | 259 |
| 270 // QuicCryptoClientStream::ProofHelper overrides. | 260 // QuicCryptoClientStream::ProofHelper overrides. |
| 271 void OnProofValid( | 261 void OnProofValid( |
| 272 const QuicCryptoClientConfig::CachedState& cached) override {} | 262 const QuicCryptoClientConfig::CachedState& cached) override {} |
| 273 void OnProofVerifyDetailsAvailable( | 263 void OnProofVerifyDetailsAvailable( |
| 274 const ProofVerifyDetails& verify_details) override {} | 264 const ProofVerifyDetails& verify_details) override {} |
| 275 | 265 |
| 276 protected: | 266 protected: |
| 277 QuicConnectionHelper quic_helper_; | 267 QuicConnectionHelper quic_helper_; |
| 278 QuicConfig config_; | 268 QuicConfig config_; |
| 279 QuicClock clock_; | 269 QuicClock clock_; |
| 280 | 270 |
| 281 scoped_ptr<QuicSessionForTest> client_peer_; | 271 rtc::scoped_ptr<QuicSessionForTest> client_peer_; |
| 282 scoped_ptr<QuicSessionForTest> server_peer_; | 272 rtc::scoped_ptr<QuicSessionForTest> server_peer_; |
| 283 }; | 273 }; |
| 284 | 274 |
| 285 // Initializes "client peer" who begins crypto handshake and "server peer" who | 275 // Initializes "client peer" who begins crypto handshake and "server peer" who |
| 286 // establishes encryption with client. | 276 // establishes encryption with client. |
| 287 void QuicSessionTest::CreateClientAndServerSessions() { | 277 void QuicSessionTest::CreateClientAndServerSessions() { |
| 288 scoped_ptr<FakeTransportChannel> channel1( | 278 rtc::scoped_ptr<FakeTransportChannel> channel1( |
| 289 new FakeTransportChannel("channel1", 0)); | 279 new FakeTransportChannel("channel1", 0)); |
| 290 scoped_ptr<FakeTransportChannel> channel2( | 280 rtc::scoped_ptr<FakeTransportChannel> channel2( |
| 291 new FakeTransportChannel("channel2", 0)); | 281 new FakeTransportChannel("channel2", 0)); |
| 292 | 282 |
| 293 // Prevent channel1->OnReadPacket and channel2->OnReadPacket from calling | 283 // Prevent channel1->OnReadPacket and channel2->OnReadPacket from calling |
| 294 // themselves in a loop, which causes to future packets to be recursively | 284 // themselves in a loop, which causes to future packets to be recursively |
| 295 // consumed while the current thread blocks consumption of current ones. | 285 // consumed while the current thread blocks consumption of current ones. |
| 296 channel2->SetAsync(true); | 286 channel2->SetAsync(true); |
| 297 | 287 |
| 298 // Configure peers to send packets to each other. | 288 // Configure peers to send packets to each other. |
| 299 channel1->Connect(); | 289 channel1->Connect(); |
| 300 channel2->Connect(); | 290 channel2->Connect(); |
| 301 channel1->SetDestination(channel2.get()); | 291 channel1->SetDestination(channel2.get()); |
| 302 | 292 |
| 303 client_peer_ = CreateSession(std::move(channel1), Perspective::IS_CLIENT); | 293 client_peer_ = CreateSession(std::move(channel1), Perspective::IS_CLIENT); |
| 304 server_peer_ = CreateSession(std::move(channel2), Perspective::IS_SERVER); | 294 server_peer_ = CreateSession(std::move(channel2), Perspective::IS_SERVER); |
| 305 } | 295 } |
| 306 | 296 |
| 307 scoped_ptr<QuicSessionForTest> QuicSessionTest::CreateSession( | 297 rtc::scoped_ptr<QuicSessionForTest> QuicSessionTest::CreateSession( |
| 308 scoped_ptr<FakeTransportChannel> channel, | 298 rtc::scoped_ptr<FakeTransportChannel> channel, |
| 309 Perspective perspective) { | 299 Perspective perspective) { |
| 310 scoped_ptr<QuicConnection> quic_connection = | 300 rtc::scoped_ptr<QuicConnection> quic_connection = |
| 311 CreateConnection(channel.get(), perspective); | 301 CreateConnection(channel.get(), perspective); |
| 312 return scoped_ptr<QuicSessionForTest>(new QuicSessionForTest( | 302 return rtc::scoped_ptr<QuicSessionForTest>(new QuicSessionForTest( |
| 313 std::move(quic_connection), config_, std::move(channel))); | 303 std::move(quic_connection), config_, std::move(channel))); |
| 314 } | 304 } |
| 315 | 305 |
| 316 QuicCryptoClientStream* QuicSessionTest::CreateCryptoClientStream( | 306 QuicCryptoClientStream* QuicSessionTest::CreateCryptoClientStream( |
| 317 QuicSessionForTest* session, | 307 QuicSessionForTest* session, |
| 318 bool handshake_success) { | 308 bool handshake_success) { |
| 319 QuicCryptoClientConfig* client_config = | 309 QuicCryptoClientConfig* client_config = |
| 320 new QuicCryptoClientConfig(new FakeProofVerifier(handshake_success)); | 310 new QuicCryptoClientConfig(new FakeProofVerifier(handshake_success)); |
| 321 return new QuicCryptoClientStream( | 311 return new QuicCryptoClientStream( |
| 322 kServerId, session, new ProofVerifyContext(), client_config, this); | 312 kServerId, session, new ProofVerifyContext(), client_config, this); |
| 323 } | 313 } |
| 324 | 314 |
| 325 QuicCryptoServerStream* QuicSessionTest::CreateCryptoServerStream( | 315 QuicCryptoServerStream* QuicSessionTest::CreateCryptoServerStream( |
| 326 QuicSessionForTest* session, | 316 QuicSessionForTest* session, |
| 327 bool handshake_success) { | 317 bool handshake_success) { |
| 328 QuicCryptoServerConfig* server_config = | 318 QuicCryptoServerConfig* server_config = |
| 329 new QuicCryptoServerConfig("TESTING", QuicRandom::GetInstance(), | 319 new QuicCryptoServerConfig("TESTING", QuicRandom::GetInstance(), |
| 330 new FakeProofSource(handshake_success)); | 320 new FakeProofSource(handshake_success)); |
| 331 // Provide server with serialized config string to prove ownership. | 321 // Provide server with serialized config string to prove ownership. |
| 332 QuicCryptoServerConfig::ConfigOptions options; | 322 QuicCryptoServerConfig::ConfigOptions options; |
| 333 QuicServerConfigProtobuf* primary_config = server_config->GenerateConfig( | 323 QuicServerConfigProtobuf* primary_config = server_config->GenerateConfig( |
| 334 QuicRandom::GetInstance(), &clock_, options); | 324 QuicRandom::GetInstance(), &clock_, options); |
| 335 server_config->AddConfig(primary_config, clock_.WallNow()); | 325 server_config->AddConfig(primary_config, clock_.WallNow()); |
| 336 return new QuicCryptoServerStream(server_config, session); | 326 return new QuicCryptoServerStream(server_config, session); |
| 337 } | 327 } |
| 338 | 328 |
| 339 scoped_ptr<QuicConnection> QuicSessionTest::CreateConnection( | 329 rtc::scoped_ptr<QuicConnection> QuicSessionTest::CreateConnection( |
| 340 FakeTransportChannel* channel, | 330 FakeTransportChannel* channel, |
| 341 Perspective perspective) { | 331 Perspective perspective) { |
| 342 FakePacketWriterFactory writer_factory(channel); | 332 FakeQuicPacketWriter* writer = new FakeQuicPacketWriter(channel); |
| 343 | 333 |
| 344 IPAddressNumber ip(net::kIPv4AddressSize, 0); | 334 IPAddress ip(0, 0, 0, 0); |
| 345 bool owns_writer = true; | 335 bool owns_writer = true; |
| 346 | 336 |
| 347 return scoped_ptr<QuicConnection>(new QuicConnection( | 337 return rtc::scoped_ptr<QuicConnection>(new QuicConnection( |
| 348 0, net::IPEndPoint(ip, 0), &quic_helper_, writer_factory, owns_writer, | 338 0, net::IPEndPoint(ip, 0), &quic_helper_, writer, owns_writer, |
| 349 perspective, net::QuicSupportedVersions())); | 339 perspective, net::QuicSupportedVersions())); |
| 350 } | 340 } |
| 351 | 341 |
| 352 void QuicSessionTest::StartHandshake(bool client_handshake_success, | 342 void QuicSessionTest::StartHandshake(bool client_handshake_success, |
| 353 bool server_handshake_success) { | 343 bool server_handshake_success) { |
| 354 server_peer_->StartServerHandshake( | 344 server_peer_->StartServerHandshake( |
| 355 CreateCryptoServerStream(server_peer_.get(), server_handshake_success)); | 345 CreateCryptoServerStream(server_peer_.get(), server_handshake_success)); |
| 356 client_peer_->StartClientHandshake( | 346 client_peer_->StartClientHandshake( |
| 357 CreateCryptoClientStream(client_peer_.get(), client_handshake_success)); | 347 CreateCryptoClientStream(client_peer_.get(), client_handshake_success)); |
| 358 } | 348 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 StartHandshake(true, false); | 443 StartHandshake(true, false); |
| 454 TestDisconnectAfterFailedHandshake(); | 444 TestDisconnectAfterFailedHandshake(); |
| 455 } | 445 } |
| 456 | 446 |
| 457 // Test that data streams are not created before handshake. | 447 // Test that data streams are not created before handshake. |
| 458 TEST_F(QuicSessionTest, CannotCreateDataStreamBeforeHandshake) { | 448 TEST_F(QuicSessionTest, CannotCreateDataStreamBeforeHandshake) { |
| 459 CreateClientAndServerSessions(); | 449 CreateClientAndServerSessions(); |
| 460 EXPECT_EQ(nullptr, server_peer_->CreateOutgoingDynamicStream(5)); | 450 EXPECT_EQ(nullptr, server_peer_->CreateOutgoingDynamicStream(5)); |
| 461 EXPECT_EQ(nullptr, client_peer_->CreateOutgoingDynamicStream(5)); | 451 EXPECT_EQ(nullptr, client_peer_->CreateOutgoingDynamicStream(5)); |
| 462 } | 452 } |
| OLD | NEW |