This repository has been archived by the owner on Apr 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cronet] Add QUIC experimental params
This CL plumbs four QUIC experimental params ( quic_store_server_configs_in_properties, quic_delay_tcp_race, quic_max_number_of_lossy_connections, quic_packet_loss_threshold) from Cronet's setExperimentalOptions API to net::HttpNetworkSession. This CL also adds a unittests target to run the unittests. A followup CL will enable the unittests on the cronet bots. BUG=545118 NOTRY=true NOPRESUBMIT=true Committed: https://crrev.com/fde0b72c603cd111c36ca4cc416d82a7395bcf6c Cr-Commit-Position: refs/heads/master@{#360454} Committed: https://crrev.com/8ece3aa6845350c1971a3e824bf148f3e8de3253 Cr-Commit-Position: refs/heads/master@{#360875} Review URL: https://codereview.chromium.org/1448583003 Cr-Commit-Position: refs/heads/master@{#361138} (cherry picked from commit f24ee5f) Review URL: https://codereview.chromium.org/1483103002 Cr-Commit-Position: refs/branch-heads/2564@{#161} Cr-Branched-From: 1283eca-refs/heads/master@{#359700}
- Loading branch information
xunjieli
authored and
Commit bot
committed
Nov 30, 2015
1 parent
0499800
commit 21daec0
Showing
8 changed files
with
185 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "base/bind.h" | ||
#include "base/test/launcher/unit_test_launcher.h" | ||
#include "base/test/test_suite.h" | ||
|
||
int main(int argc, char** argv) { | ||
base::TestSuite test_suite(argc, argv); | ||
return base::LaunchUnitTests( | ||
argc, argv, | ||
base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "components/cronet/url_request_context_config.h" | ||
|
||
#include "net/http/http_network_session.h" | ||
#include "net/proxy/proxy_config.h" | ||
#include "net/proxy/proxy_config_service_fixed.h" | ||
#include "net/url_request/url_request_context.h" | ||
#include "net/url_request/url_request_context_builder.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
namespace cronet { | ||
|
||
TEST(URLRequestContextConfigTest, SetQuicExperimentalOptions) { | ||
URLRequestContextConfig config; | ||
|
||
std::string args = | ||
"{\"QUIC_HINTS\":[{\"QUIC_HINT_ALT_PORT\":6121,\"QUIC_HINT_PORT\":6121," | ||
"\"QUIC_HINT_HOST\":\"test.example.com\"}]," | ||
"\"HTTP_CACHE\":\"HTTP_CACHE_DISK\",\"ENABLE_SDCH\":false," | ||
"\"ENABLE_LEGACY_MODE\":false,\"HTTP_CACHE_MAX_SIZE\":1024000," | ||
"\"NATIVE_LIBRARY_NAME\":\"cronet_tests\",\"USER_AGENT\":\"fake agent\"," | ||
"\"STORAGE_PATH\":" | ||
"\"\\/data\\/data\\/org.chromium.net\\/app_cronet_test\\/test_storage\"," | ||
"\"ENABLE_SPDY\":true," | ||
"\"ENABLE_QUIC\":true,\"LOAD_DISABLE_CACHE\":true," | ||
"\"EXPERIMENTAL_OPTIONS\":" | ||
"\"{\\\"QUIC\\\":{\\\"store_server_configs_in_properties\\\":true," | ||
"\\\"delay_tcp_race\\\":true," | ||
"\\\"max_number_of_lossy_connections\\\":10," | ||
"\\\"packet_loss_threshold\\\":0.5," | ||
"\\\"connection_options\\\":\\\"TIME,TBBR,REJ\\\"}}\"}"; | ||
config.LoadFromJSON(args); | ||
net::URLRequestContextBuilder builder; | ||
config.ConfigureURLRequestContextBuilder(&builder); | ||
// Set a ProxyConfigService to avoid DCHECK failure when building. | ||
builder.set_proxy_config_service(make_scoped_ptr( | ||
new net::ProxyConfigServiceFixed(net::ProxyConfig::CreateDirect()))); | ||
scoped_ptr<net::URLRequestContext> context(builder.Build()); | ||
const net::HttpNetworkSession::Params* params = | ||
context->GetNetworkSessionParams(); | ||
// Check Quic Connection options. | ||
net::QuicTagVector quic_connection_options; | ||
quic_connection_options.push_back(net::kTIME); | ||
quic_connection_options.push_back(net::kTBBR); | ||
quic_connection_options.push_back(net::kREJ); | ||
EXPECT_EQ(quic_connection_options, params->quic_connection_options); | ||
|
||
// Check store_server_configs_in_properties. | ||
EXPECT_TRUE(params->quic_store_server_configs_in_properties); | ||
|
||
// Check delay_tcp_race. | ||
EXPECT_TRUE(params->quic_delay_tcp_race); | ||
|
||
// Check max_number_of_lossy_connections and packet_loss_threshold. | ||
EXPECT_EQ(10, params->quic_max_number_of_lossy_connections); | ||
EXPECT_FLOAT_EQ(0.5f, params->quic_packet_loss_threshold); | ||
} | ||
|
||
} // namespace cronet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters