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/test_tools/quic_test_utils.h" | 5 #include "net/quic/test_tools/quic_test_utils.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "net/quic/core/crypto/crypto_framer.h" | 10 #include "net/quic/core/crypto/crypto_framer.h" |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 QuicCryptoServerStreamBase* | 438 QuicCryptoServerStreamBase* |
439 TestQuicSpdyServerSession::CreateQuicCryptoServerStream( | 439 TestQuicSpdyServerSession::CreateQuicCryptoServerStream( |
440 const QuicCryptoServerConfig* crypto_config, | 440 const QuicCryptoServerConfig* crypto_config, |
441 QuicCompressedCertsCache* compressed_certs_cache) { | 441 QuicCompressedCertsCache* compressed_certs_cache) { |
442 return new QuicCryptoServerStream( | 442 return new QuicCryptoServerStream( |
443 crypto_config, compressed_certs_cache, | 443 crypto_config, compressed_certs_cache, |
444 FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support, this, | 444 FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support, this, |
445 &helper_); | 445 &helper_); |
446 } | 446 } |
447 | 447 |
448 QuicCryptoServerStream* TestQuicSpdyServerSession::GetCryptoStream() { | 448 QuicCryptoServerStream* TestQuicSpdyServerSession::GetMutableCryptoStream() { |
449 return static_cast<QuicCryptoServerStream*>( | 449 return static_cast<QuicCryptoServerStream*>( |
| 450 QuicServerSessionBase::GetMutableCryptoStream()); |
| 451 } |
| 452 |
| 453 const QuicCryptoServerStream* TestQuicSpdyServerSession::GetCryptoStream() |
| 454 const { |
| 455 return static_cast<const QuicCryptoServerStream*>( |
450 QuicServerSessionBase::GetCryptoStream()); | 456 QuicServerSessionBase::GetCryptoStream()); |
451 } | 457 } |
452 | 458 |
453 TestQuicSpdyClientSession::TestQuicSpdyClientSession( | 459 TestQuicSpdyClientSession::TestQuicSpdyClientSession( |
454 QuicConnection* connection, | 460 QuicConnection* connection, |
455 const QuicConfig& config, | 461 const QuicConfig& config, |
456 const QuicServerId& server_id, | 462 const QuicServerId& server_id, |
457 QuicCryptoClientConfig* crypto_config) | 463 QuicCryptoClientConfig* crypto_config) |
458 : QuicClientSessionBase(connection, &push_promise_index_, config) { | 464 : QuicClientSessionBase(connection, &push_promise_index_, config) { |
459 crypto_stream_.reset(new QuicCryptoClientStream( | 465 crypto_stream_.reset(new QuicCryptoClientStream( |
460 server_id, this, crypto_test_utils::ProofVerifyContextForTesting(), | 466 server_id, this, crypto_test_utils::ProofVerifyContextForTesting(), |
461 crypto_config, this)); | 467 crypto_config, this)); |
462 Initialize(); | 468 Initialize(); |
463 } | 469 } |
464 | 470 |
465 TestQuicSpdyClientSession::~TestQuicSpdyClientSession() {} | 471 TestQuicSpdyClientSession::~TestQuicSpdyClientSession() {} |
466 | 472 |
467 bool TestQuicSpdyClientSession::IsAuthorized(const string& authority) { | 473 bool TestQuicSpdyClientSession::IsAuthorized(const string& authority) { |
468 return true; | 474 return true; |
469 } | 475 } |
470 | 476 |
471 QuicCryptoClientStream* TestQuicSpdyClientSession::GetCryptoStream() { | 477 QuicCryptoClientStream* TestQuicSpdyClientSession::GetMutableCryptoStream() { |
472 return crypto_stream_.get(); | 478 return crypto_stream_.get(); |
473 } | 479 } |
474 | 480 |
| 481 const QuicCryptoClientStream* TestQuicSpdyClientSession::GetCryptoStream() |
| 482 const { |
| 483 return crypto_stream_.get(); |
| 484 } |
| 485 |
475 TestPushPromiseDelegate::TestPushPromiseDelegate(bool match) | 486 TestPushPromiseDelegate::TestPushPromiseDelegate(bool match) |
476 : match_(match), rendezvous_fired_(false), rendezvous_stream_(nullptr) {} | 487 : match_(match), rendezvous_fired_(false), rendezvous_stream_(nullptr) {} |
477 | 488 |
478 bool TestPushPromiseDelegate::CheckVary( | 489 bool TestPushPromiseDelegate::CheckVary( |
479 const SpdyHeaderBlock& client_request, | 490 const SpdyHeaderBlock& client_request, |
480 const SpdyHeaderBlock& promise_request, | 491 const SpdyHeaderBlock& promise_request, |
481 const SpdyHeaderBlock& promise_response) { | 492 const SpdyHeaderBlock& promise_response) { |
482 QUIC_DVLOG(1) << "match " << match_; | 493 QUIC_DVLOG(1) << "match " << match_; |
483 return match_; | 494 return match_; |
484 } | 495 } |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 // strike register worries that we've just overflowed a uint32_t time. | 850 // strike register worries that we've just overflowed a uint32_t time. |
840 (*server_connection)->AdvanceTime(connection_start_time); | 851 (*server_connection)->AdvanceTime(connection_start_time); |
841 } | 852 } |
842 | 853 |
843 QuicStreamId QuicClientDataStreamId(int i) { | 854 QuicStreamId QuicClientDataStreamId(int i) { |
844 return kClientDataStreamId1 + 2 * i; | 855 return kClientDataStreamId1 + 2 * i; |
845 } | 856 } |
846 | 857 |
847 } // namespace test | 858 } // namespace test |
848 } // namespace net | 859 } // namespace net |
OLD | NEW |