| 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 "components/cronet/url_request_context_config.h" | 5 #include "components/cronet/url_request_context_config.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "net/cert/cert_verifier.h" | 9 #include "net/cert/cert_verifier.h" |
| 10 #include "net/http/http_network_session.h" | 10 #include "net/http/http_network_session.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 "fake agent", | 39 "fake agent", |
| 40 // JSON encoded experimental options. | 40 // JSON encoded experimental options. |
| 41 "{\"QUIC\":{\"max_server_configs_stored_in_properties\":2," | 41 "{\"QUIC\":{\"max_server_configs_stored_in_properties\":2," |
| 42 "\"delay_tcp_race\":true," | 42 "\"delay_tcp_race\":true," |
| 43 "\"max_number_of_lossy_connections\":10," | 43 "\"max_number_of_lossy_connections\":10," |
| 44 "\"prefer_aes\":true," | 44 "\"prefer_aes\":true," |
| 45 "\"user_agent_id\":\"Custom QUIC UAID\"," | 45 "\"user_agent_id\":\"Custom QUIC UAID\"," |
| 46 "\"packet_loss_threshold\":0.5," | 46 "\"packet_loss_threshold\":0.5," |
| 47 "\"idle_connection_timeout_seconds\":300," | 47 "\"idle_connection_timeout_seconds\":300," |
| 48 "\"close_sessions_on_ip_change\":true," | 48 "\"close_sessions_on_ip_change\":true," |
| 49 "\"race_cert_verification\":true," |
| 49 "\"connection_options\":\"TIME,TBBR,REJ\"}," | 50 "\"connection_options\":\"TIME,TBBR,REJ\"}," |
| 50 "\"AsyncDNS\":{\"enable\":true}}", | 51 "\"AsyncDNS\":{\"enable\":true}}", |
| 51 // Data reduction proxy key. | 52 // Data reduction proxy key. |
| 52 "", | 53 "", |
| 53 // Data reduction proxy. | 54 // Data reduction proxy. |
| 54 "", | 55 "", |
| 55 // Fallback data reduction proxy. | 56 // Fallback data reduction proxy. |
| 56 "", | 57 "", |
| 57 // Data reduction proxy secure proxy check URL. | 58 // Data reduction proxy secure proxy check URL. |
| 58 "", | 59 "", |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Check max_number_of_lossy_connections and packet_loss_threshold. | 97 // Check max_number_of_lossy_connections and packet_loss_threshold. |
| 97 EXPECT_EQ(10, params->quic_max_number_of_lossy_connections); | 98 EXPECT_EQ(10, params->quic_max_number_of_lossy_connections); |
| 98 EXPECT_FLOAT_EQ(0.5f, params->quic_packet_loss_threshold); | 99 EXPECT_FLOAT_EQ(0.5f, params->quic_packet_loss_threshold); |
| 99 | 100 |
| 100 // Check idle_connection_timeout_seconds. | 101 // Check idle_connection_timeout_seconds. |
| 101 EXPECT_EQ(300, params->quic_idle_connection_timeout_seconds); | 102 EXPECT_EQ(300, params->quic_idle_connection_timeout_seconds); |
| 102 | 103 |
| 103 EXPECT_TRUE(params->quic_close_sessions_on_ip_change); | 104 EXPECT_TRUE(params->quic_close_sessions_on_ip_change); |
| 104 EXPECT_FALSE(params->quic_migrate_sessions_on_network_change); | 105 EXPECT_FALSE(params->quic_migrate_sessions_on_network_change); |
| 105 | 106 |
| 107 // Check race_cert_verification. |
| 108 EXPECT_TRUE(params->quic_race_cert_verification); |
| 109 |
| 106 // Check AsyncDNS resolver is enabled. | 110 // Check AsyncDNS resolver is enabled. |
| 107 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); | 111 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); |
| 108 } | 112 } |
| 109 | 113 |
| 110 TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationOptions) { | 114 TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationOptions) { |
| 111 URLRequestContextConfig config( | 115 URLRequestContextConfig config( |
| 112 // Enable QUIC. | 116 // Enable QUIC. |
| 113 true, | 117 true, |
| 114 // QUIC User Agent ID. | 118 // QUIC User Agent ID. |
| 115 "Default QUIC User Agent ID", | 119 "Default QUIC User Agent ID", |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 std::unique_ptr<net::URLRequestContext> context(builder.Build()); | 161 std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 158 const net::HttpNetworkSession::Params* params = | 162 const net::HttpNetworkSession::Params* params = |
| 159 context->GetNetworkSessionParams(); | 163 context->GetNetworkSessionParams(); |
| 160 | 164 |
| 161 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); | 165 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); |
| 162 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); | 166 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); |
| 163 EXPECT_TRUE(params->quic_migrate_sessions_early); | 167 EXPECT_TRUE(params->quic_migrate_sessions_early); |
| 164 } | 168 } |
| 165 | 169 |
| 166 } // namespace cronet | 170 } // namespace cronet |
| OLD | NEW |