Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: components/cronet/url_request_context_config_unittest.cc

Issue 1665503002: [Cronet] Expose quic_user_agent_id and quic_prefer_aes config options. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/values.h" 7 #include "base/values.h"
8 #include "net/cert/cert_verifier.h" 8 #include "net/cert/cert_verifier.h"
9 #include "net/http/http_network_session.h" 9 #include "net/http/http_network_session.h"
10 #include "net/proxy/proxy_config.h" 10 #include "net/proxy/proxy_config.h"
11 #include "net/proxy/proxy_config_service_fixed.h" 11 #include "net/proxy/proxy_config_service_fixed.h"
12 #include "net/url_request/url_request_context.h" 12 #include "net/url_request/url_request_context.h"
13 #include "net/url_request/url_request_context_builder.h" 13 #include "net/url_request/url_request_context_builder.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace cronet { 16 namespace cronet {
17 17
18 TEST(URLRequestContextConfigTest, SetQuicExperimentalOptions) { 18 TEST(URLRequestContextConfigTest, SetQuicExperimentalOptions) {
19 URLRequestContextConfig config( 19 URLRequestContextConfig config(
20 // Enable QUIC. 20 // Enable QUIC.
21 true, 21 true,
22 // QUIC User Agent ID.
23 "QUIC User Agent ID",
22 // Enable SPDY. 24 // Enable SPDY.
23 true, 25 true,
24 // Enable SDCH. 26 // Enable SDCH.
25 false, 27 false,
26 // Type of http cache. 28 // Type of http cache.
27 URLRequestContextConfig::HttpCacheType::DISK, 29 URLRequestContextConfig::HttpCacheType::DISK,
28 // Max size of http cache in bytes. 30 // Max size of http cache in bytes.
29 1024000, 31 1024000,
30 // Disable caching for HTTP responses. Other information may be stored in 32 // Disable caching for HTTP responses. Other information may be stored in
31 // the cache. 33 // the cache.
32 false, 34 false,
33 // Storage path for http cache and cookie storage. 35 // Storage path for http cache and cookie storage.
34 "/data/data/org.chromium.net/app_cronet_test/test_storage", 36 "/data/data/org.chromium.net/app_cronet_test/test_storage",
35 // User-Agent request header field. 37 // User-Agent request header field.
36 "fake agent", 38 "fake agent",
37 // JSON encoded experimental options. 39 // JSON encoded experimental options.
38 "{\"QUIC\":{\"max_server_configs_stored_in_properties\":2," 40 "{\"QUIC\":{\"max_server_configs_stored_in_properties\":2,"
39 "\"delay_tcp_race\":true," 41 "\"delay_tcp_race\":true,"
40 "\"max_number_of_lossy_connections\":10," 42 "\"max_number_of_lossy_connections\":10,"
43 "\"prefer_aes\":true,"
41 "\"packet_loss_threshold\":0.5," 44 "\"packet_loss_threshold\":0.5,"
42 "\"idle_connection_timeout_seconds\":300," 45 "\"idle_connection_timeout_seconds\":300,"
43 "\"connection_options\":\"TIME,TBBR,REJ\"}," 46 "\"connection_options\":\"TIME,TBBR,REJ\"},"
44 "\"AsyncDNS\":{\"enable\":true}}", 47 "\"AsyncDNS\":{\"enable\":true}}",
45 // Data reduction proxy key. 48 // Data reduction proxy key.
46 "", 49 "",
47 // Data reduction proxy. 50 // Data reduction proxy.
48 "", 51 "",
49 // Fallback data reduction proxy. 52 // Fallback data reduction proxy.
50 "", 53 "",
(...skipping 11 matching lines...) Expand all
62 scoped_ptr<net::URLRequestContext> context(builder.Build()); 65 scoped_ptr<net::URLRequestContext> context(builder.Build());
63 const net::HttpNetworkSession::Params* params = 66 const net::HttpNetworkSession::Params* params =
64 context->GetNetworkSessionParams(); 67 context->GetNetworkSessionParams();
65 // Check Quic Connection options. 68 // Check Quic Connection options.
66 net::QuicTagVector quic_connection_options; 69 net::QuicTagVector quic_connection_options;
67 quic_connection_options.push_back(net::kTIME); 70 quic_connection_options.push_back(net::kTIME);
68 quic_connection_options.push_back(net::kTBBR); 71 quic_connection_options.push_back(net::kTBBR);
69 quic_connection_options.push_back(net::kREJ); 72 quic_connection_options.push_back(net::kREJ);
70 EXPECT_EQ(quic_connection_options, params->quic_connection_options); 73 EXPECT_EQ(quic_connection_options, params->quic_connection_options);
71 74
75 // Check QUIC User Agent Id.
76 EXPECT_EQ("QUIC User Agent ID", params->quic_user_agent_id);
77
72 // Check max_server_configs_stored_in_properties. 78 // Check max_server_configs_stored_in_properties.
73 EXPECT_EQ(2u, params->quic_max_server_configs_stored_in_properties); 79 EXPECT_EQ(2u, params->quic_max_server_configs_stored_in_properties);
74 80
75 // Check delay_tcp_race. 81 // Check delay_tcp_race.
76 EXPECT_TRUE(params->quic_delay_tcp_race); 82 EXPECT_TRUE(params->quic_delay_tcp_race);
77 83
84 // Check prefer_aes.
85 EXPECT_TRUE(params->quic_prefer_aes);
86
78 // Check max_number_of_lossy_connections and packet_loss_threshold. 87 // Check max_number_of_lossy_connections and packet_loss_threshold.
79 EXPECT_EQ(10, params->quic_max_number_of_lossy_connections); 88 EXPECT_EQ(10, params->quic_max_number_of_lossy_connections);
80 EXPECT_FLOAT_EQ(0.5f, params->quic_packet_loss_threshold); 89 EXPECT_FLOAT_EQ(0.5f, params->quic_packet_loss_threshold);
81 90
82 // Check idle_connection_timeout_seconds. 91 // Check idle_connection_timeout_seconds.
83 EXPECT_EQ(300, params->quic_idle_connection_timeout_seconds); 92 EXPECT_EQ(300, params->quic_idle_connection_timeout_seconds);
84 93
85 // Check AsyncDNS resolver is enabled. 94 // Check AsyncDNS resolver is enabled.
86 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); 95 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue());
87 } 96 }
88 97
89 } // namespace cronet 98 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698