| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/crypto/properties_based_quic_server_info.h" | 5 #include "net/quic/crypto/properties_based_quic_server_info.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/http/http_server_properties_impl.h" | 10 #include "net/http/http_server_properties_impl.h" |
| 11 #include "net/quic/crypto/quic_server_info.h" | 11 #include "net/quic/crypto/quic_server_info.h" |
| 12 #include "net/quic/quic_server_id.h" | 12 #include "net/quic/quic_server_id.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 const std::string kServerConfigA("server_config_a"); | 19 const std::string kServerConfigA("server_config_a"); |
| 20 const std::string kSourceAddressTokenA("source_address_token_a"); | 20 const std::string kSourceAddressTokenA("source_address_token_a"); |
| 21 const std::string kServerConfigSigA("server_config_sig_a"); | 21 const std::string kServerConfigSigA("server_config_sig_a"); |
| 22 const std::string kCertA("cert_a"); | 22 const std::string kCertA("cert_a"); |
| 23 const std::string kCertB("cert_b"); | 23 const std::string kCertB("cert_b"); |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 class PropertiesBasedQuicServerInfoTest : public ::testing::Test { | 26 class PropertiesBasedQuicServerInfoTest : public ::testing::Test { |
| 27 protected: | 27 protected: |
| 28 PropertiesBasedQuicServerInfoTest() | 28 PropertiesBasedQuicServerInfoTest() |
| 29 : server_id_("www.google.com", 443, true, PRIVACY_MODE_DISABLED), | 29 : server_id_("www.google.com", 443, PRIVACY_MODE_DISABLED), |
| 30 server_info_(server_id_, http_server_properties_.GetWeakPtr()) {} | 30 server_info_(server_id_, http_server_properties_.GetWeakPtr()) {} |
| 31 | 31 |
| 32 // Initialize |server_info_| object and persist it. | 32 // Initialize |server_info_| object and persist it. |
| 33 void InitializeAndPersist() { | 33 void InitializeAndPersist() { |
| 34 server_info_.Start(); | 34 server_info_.Start(); |
| 35 EXPECT_TRUE(server_info_.IsDataReady()); | 35 EXPECT_TRUE(server_info_.IsDataReady()); |
| 36 QuicServerInfo::State* state = server_info_.mutable_state(); | 36 QuicServerInfo::State* state = server_info_.mutable_state(); |
| 37 EXPECT_TRUE(state->certs.empty()); | 37 EXPECT_TRUE(state->certs.empty()); |
| 38 | 38 |
| 39 state->server_config = kServerConfigA; | 39 state->server_config = kServerConfigA; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // Verify updated data. | 93 // Verify updated data. |
| 94 const QuicServerInfo::State& state3 = server_info2.state(); | 94 const QuicServerInfo::State& state3 = server_info2.state(); |
| 95 VerifyInitialData(state3); | 95 VerifyInitialData(state3); |
| 96 EXPECT_EQ(2U, state3.certs.size()); | 96 EXPECT_EQ(2U, state3.certs.size()); |
| 97 EXPECT_EQ(kCertB, state3.certs[1]); | 97 EXPECT_EQ(kCertB, state3.certs[1]); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace test | 100 } // namespace test |
| 101 } // namespace net | 101 } // namespace net |
| OLD | NEW |