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_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "net/base/test_data_directory.h" | 10 #include "net/base/test_data_directory.h" |
(...skipping 3643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3654 // EXPY | 3654 // EXPY |
3655 0x45, 0x58, 0x50, 0x59, | 3655 0x45, 0x58, 0x50, 0x59, |
3656 // EXPY end offset | 3656 // EXPY end offset |
3657 0x08, 0x00, 0x00, 0x00, | 3657 0x08, 0x00, 0x00, 0x00, |
3658 // Value | 3658 // Value |
3659 '1', '2', '3', '4', '5', '6', '7', '8'}; | 3659 '1', '2', '3', '4', '5', '6', '7', '8'}; |
3660 | 3660 |
3661 // Create temporary strings becasue Persist() clears string data in |state|. | 3661 // Create temporary strings becasue Persist() clears string data in |state|. |
3662 string server_config(reinterpret_cast<const char*>(&scfg), sizeof(scfg)); | 3662 string server_config(reinterpret_cast<const char*>(&scfg), sizeof(scfg)); |
3663 string source_address_token("test_source_address_token"); | 3663 string source_address_token("test_source_address_token"); |
| 3664 string cert_sct("test_cert_sct"); |
| 3665 string chlo_hash("test_chlo_hash"); |
3664 string signature("test_signature"); | 3666 string signature("test_signature"); |
3665 string test_cert("test_cert"); | 3667 string test_cert("test_cert"); |
3666 vector<string> certs; | 3668 vector<string> certs; |
3667 certs.push_back(test_cert); | 3669 certs.push_back(test_cert); |
3668 state->server_config = server_config; | 3670 state->server_config = server_config; |
3669 state->source_address_token = source_address_token; | 3671 state->source_address_token = source_address_token; |
| 3672 state->cert_sct = cert_sct; |
| 3673 state->chlo_hash = chlo_hash; |
3670 state->server_config_sig = signature; | 3674 state->server_config_sig = signature; |
3671 state->certs = certs; | 3675 state->certs = certs; |
3672 | 3676 |
3673 quic_server_info->Persist(); | 3677 quic_server_info->Persist(); |
3674 | 3678 |
3675 QuicStreamFactoryPeer::MaybeInitialize(factory_.get()); | 3679 QuicStreamFactoryPeer::MaybeInitialize(factory_.get()); |
3676 EXPECT_TRUE(QuicStreamFactoryPeer::HasInitializedData(factory_.get())); | 3680 EXPECT_TRUE(QuicStreamFactoryPeer::HasInitializedData(factory_.get())); |
3677 EXPECT_TRUE(QuicStreamFactoryPeer::SupportsQuicAtStartUp(factory_.get(), | 3681 EXPECT_TRUE(QuicStreamFactoryPeer::SupportsQuicAtStartUp(factory_.get(), |
3678 host_port_pair_)); | 3682 host_port_pair_)); |
3679 EXPECT_FALSE(QuicStreamFactoryPeer::CryptoConfigCacheIsEmpty(factory_.get(), | 3683 EXPECT_FALSE(QuicStreamFactoryPeer::CryptoConfigCacheIsEmpty(factory_.get(), |
3680 quic_server_id)); | 3684 quic_server_id)); |
3681 QuicCryptoClientConfig* crypto_config = | 3685 QuicCryptoClientConfig* crypto_config = |
3682 QuicStreamFactoryPeer::GetCryptoConfig(factory_.get()); | 3686 QuicStreamFactoryPeer::GetCryptoConfig(factory_.get()); |
3683 QuicCryptoClientConfig::CachedState* cached = | 3687 QuicCryptoClientConfig::CachedState* cached = |
3684 crypto_config->LookupOrCreate(quic_server_id); | 3688 crypto_config->LookupOrCreate(quic_server_id); |
3685 EXPECT_FALSE(cached->server_config().empty()); | 3689 EXPECT_FALSE(cached->server_config().empty()); |
3686 EXPECT_TRUE(cached->GetServerConfig()); | 3690 EXPECT_TRUE(cached->GetServerConfig()); |
3687 EXPECT_EQ(server_config, cached->server_config()); | 3691 EXPECT_EQ(server_config, cached->server_config()); |
3688 EXPECT_EQ(source_address_token, cached->source_address_token()); | 3692 EXPECT_EQ(source_address_token, cached->source_address_token()); |
| 3693 EXPECT_EQ(cert_sct, cached->cert_sct()); |
| 3694 EXPECT_EQ(chlo_hash, cached->chlo_hash()); |
3689 EXPECT_EQ(signature, cached->signature()); | 3695 EXPECT_EQ(signature, cached->signature()); |
3690 ASSERT_EQ(1U, cached->certs().size()); | 3696 ASSERT_EQ(1U, cached->certs().size()); |
3691 EXPECT_EQ(test_cert, cached->certs()[0]); | 3697 EXPECT_EQ(test_cert, cached->certs()[0]); |
3692 } | 3698 } |
3693 | 3699 |
3694 TEST_P(QuicStreamFactoryTest, QuicDoingZeroRTT) { | 3700 TEST_P(QuicStreamFactoryTest, QuicDoingZeroRTT) { |
3695 Initialize(); | 3701 Initialize(); |
3696 | 3702 |
3697 factory_->set_require_confirmation(true); | 3703 factory_->set_require_confirmation(true); |
3698 QuicServerId quic_server_id(host_port_pair_, PRIVACY_MODE_DISABLED); | 3704 QuicServerId quic_server_id(host_port_pair_, PRIVACY_MODE_DISABLED); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3902 EXPECT_TRUE(stream2.get()); | 3908 EXPECT_TRUE(stream2.get()); |
3903 | 3909 |
3904 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); | 3910 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); |
3905 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); | 3911 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); |
3906 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 3912 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
3907 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 3913 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
3908 } | 3914 } |
3909 | 3915 |
3910 } // namespace test | 3916 } // namespace test |
3911 } // namespace net | 3917 } // namespace net |
OLD | NEW |