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

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

Issue 1448583003: [Cronet] Add QUIC experimental params (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@experiment_ops
Patch Set: Add two more params and address comments Created 5 years, 1 month 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
(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 "\\\"max_number_of_lossy_connections\\\":10,"
33 "\\\"packet_loss_threshold\\\":0.5,"
34 "\\\"connection_options\\\":\\\"TIME,TBBR,REJ\\\"}}\"}";
35 config.LoadFromJSON(args);
36 net::URLRequestContextBuilder builder;
37 config.ConfigureURLRequestContextBuilder(&builder);
38 // Set a ProxyConfigService to avoid DCHECK failure when building.
39 builder.set_proxy_config_service(make_scoped_ptr(
40 new net::ProxyConfigServiceFixed(net::ProxyConfig::CreateDirect())));
41 scoped_ptr<net::URLRequestContext> context(builder.Build());
42 const net::HttpNetworkSession::Params* params =
43 context->GetNetworkSessionParams();
44 // Check Quic Connection options.
45 net::QuicTagVector quic_connection_options;
46 quic_connection_options.push_back(net::kTIME);
47 quic_connection_options.push_back(net::kTBBR);
48 quic_connection_options.push_back(net::kREJ);
49 EXPECT_EQ(quic_connection_options, params->quic_connection_options);
50
51 // Check store_server_configs_in_properties.
52 EXPECT_TRUE(params->quic_store_server_configs_in_properties);
53
54 // Check delay_tcp_race.
55 EXPECT_TRUE(params->quic_delay_tcp_race);
56
57 // Check max_number_of_lossy_connections and packet_loss_threshold.
58 EXPECT_EQ(10, params->quic_max_number_of_lossy_connections);
59 EXPECT_EQ(0.5f, params->quic_packet_loss_threshold);
mef 2015/11/18 21:35:33 You may want to use EXPECT_DOUBLE_EQ due to roundi
xunjieli 2015/11/18 21:52:55 Done. Used EXPECT_FLOAT_EQ since the quic_packet_l
60 }
61
62 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698