Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/cronet/url_request_context_config.h" | |
| 6 | |
| 7 #include "net/http/http_network_session.h" | |
| 8 #include "net/proxy/proxy_config.h" | |
| 9 #include "net/proxy/proxy_config_service_fixed.h" | |
| 10 #include "net/url_request/url_request_context.h" | |
| 11 #include "net/url_request/url_request_context_builder.h" | |
| 12 #include "testing/gtest/include/gtest/gtest.h" | |
| 13 | |
| 14 namespace cronet { | |
| 15 | |
| 16 TEST(URLRequestContextConfigTest, SetQuicExperimentalOptions) { | |
| 17 URLRequestContextConfig config; | |
| 18 | |
| 19 std::string args = | |
| 20 "{\"QUIC_HINTS\":[{\"QUIC_HINT_ALT_PORT\":6121,\"QUIC_HINT_PORT\":6121," | |
| 21 "\"QUIC_HINT_HOST\":\"test.example.com\"}]," | |
| 22 "\"HTTP_CACHE\":\"HTTP_CACHE_DISK\",\"ENABLE_SDCH\":false," | |
| 23 "\"ENABLE_LEGACY_MODE\":false,\"HTTP_CACHE_MAX_SIZE\":1024000," | |
| 24 "\"NATIVE_LIBRARY_NAME\":\"cronet_tests\",\"USER_AGENT\":\"fake agent\"," | |
| 25 "\"STORAGE_PATH\":" | |
| 26 "\"\\/data\\/data\\/org.chromium.net\\/app_cronet_test\\/test_storage\"," | |
| 27 "\"ENABLE_SPDY\":true," | |
| 28 "\"ENABLE_QUIC\":true,\"LOAD_DISABLE_CACHE\":true," | |
| 29 "\"EXPERIMENTAL_OPTIONS\":" | |
| 30 "\"{\\\"QUIC\\\":{\\\"store_server_configs_in_properties\\\":true," | |
| 31 "\\\"delay_tcp_race\\\":true," | |
| 32 "\\\"connection_options\\\":\\\"TIME,TBBR,REJ\\\"}}\"}"; | |
| 33 config.LoadFromJSON(args); | |
| 34 net::URLRequestContextBuilder builder; | |
| 35 config.ConfigureURLRequestContextBuilder(&builder); | |
| 36 // Set a ProxyConfigService to advoid DCHECK failure when building. | |
|
ramant (doing other things)
2015/11/18 20:22:08
nit: advoid -> avoid.
xunjieli
2015/11/18 20:58:44
Done.
| |
| 37 builder.set_proxy_config_service(make_scoped_ptr( | |
| 38 new net::ProxyConfigServiceFixed(net::ProxyConfig::CreateDirect()))); | |
| 39 scoped_ptr<net::URLRequestContext> context(builder.Build()); | |
| 40 const net::HttpNetworkSession::Params* params = | |
| 41 context->GetNetworkSessionParams(); | |
| 42 // Check Quic Connection options. | |
| 43 net::QuicTagVector quic_connection_options; | |
| 44 quic_connection_options.push_back(net::kTIME); | |
| 45 quic_connection_options.push_back(net::kTBBR); | |
| 46 quic_connection_options.push_back(net::kREJ); | |
| 47 EXPECT_EQ(quic_connection_options, params->quic_connection_options); | |
| 48 | |
| 49 // Check store_server_configs_in_properties | |
|
mef
2015/11/18 20:33:25
nit: End comment with period, also below.
xunjieli
2015/11/18 20:58:44
Done.
| |
| 50 EXPECT_TRUE(params->quic_store_server_configs_in_properties); | |
| 51 | |
| 52 // Check delay_tcp_race | |
| 53 EXPECT_TRUE(params->quic_delay_tcp_race); | |
| 54 } | |
| 55 | |
| 56 } // namespace cronet | |
| OLD | NEW |