Index: net/quic/quic_network_transaction_unittest.cc |
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc |
index 5219d1e6ccb3cd4190666290039627b5e6316756..14a931c6227711eaa2108867c27120cd663b8371 100644 |
--- a/net/quic/quic_network_transaction_unittest.cc |
+++ b/net/quic/quic_network_transaction_unittest.cc |
@@ -44,6 +44,9 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "testing/platform_test.h" |
+using std::ostream; |
+using std::vector; |
+ |
//----------------------------------------------------------------------------- |
namespace { |
@@ -61,6 +64,37 @@ static const char kQuicAlternateProtocolHttpsHeader[] = |
namespace net { |
namespace test { |
+namespace { |
+ |
+// Run all tests with all the combinations of versions and |
+// enable_connection_racing. |
+struct TestParams { |
+ TestParams(const QuicVersion version, bool enable_connection_racing) |
+ : version(version), enable_connection_racing(enable_connection_racing) {} |
+ |
+ friend ostream& operator<<(ostream& os, const TestParams& p) { |
+ os << "{ version: " << QuicVersionToString(p.version); |
+ os << " enable_connection_racing: " << p.enable_connection_racing << " }"; |
+ return os; |
+ } |
+ |
+ QuicVersion version; |
+ bool enable_connection_racing; |
+}; |
+ |
+// Constructs various test permutations. |
+vector<TestParams> GetTestParams() { |
+ vector<TestParams> params; |
+ QuicVersionVector all_supported_versions = QuicSupportedVersions(); |
+ for (const QuicVersion version : all_supported_versions) { |
+ params.push_back(TestParams(version, false)); |
+ params.push_back(TestParams(version, true)); |
+ } |
+ return params; |
+} |
+ |
+} // namespace anonymous |
+ |
// Helper class to encapsulate MockReads and MockWrites for QUIC. |
// Simplify ownership issues and the interaction with the MockSocketFactory. |
class MockQuicData { |
@@ -104,11 +138,11 @@ class MockQuicData { |
class QuicNetworkTransactionTest |
: public PlatformTest, |
- public ::testing::WithParamInterface<QuicVersion> { |
+ public ::testing::WithParamInterface<TestParams> { |
protected: |
QuicNetworkTransactionTest() |
: clock_(new MockClock), |
- maker_(GetParam(), 0, clock_), |
+ maker_(GetParam().version, 0, clock_), |
ssl_config_service_(new SSLConfigServiceDefaults), |
proxy_service_(ProxyService::CreateDirect()), |
auth_handler_factory_( |
@@ -213,7 +247,7 @@ class QuicNetworkTransactionTest |
params_.ssl_config_service = ssl_config_service_.get(); |
params_.http_auth_handler_factory = auth_handler_factory_.get(); |
params_.http_server_properties = http_server_properties.GetWeakPtr(); |
- params_.quic_supported_versions = SupportedVersions(GetParam()); |
+ params_.quic_supported_versions = SupportedVersions(GetParam().version); |
if (use_next_protos) { |
params_.use_alternate_protocols = true; |
@@ -222,6 +256,8 @@ class QuicNetworkTransactionTest |
session_ = new HttpNetworkSession(params_); |
session_->quic_stream_factory()->set_require_confirmation(false); |
+ session_->quic_stream_factory()->set_enable_connection_racing( |
+ GetParam().enable_connection_racing); |
Ryan Hamilton
2015/02/04 20:10:29
I'm a bit surprised that these tests pass with con
ramant (doing other things)
2015/02/05 03:39:41
Acknowledged.
ramant (doing other things)
2015/02/05 20:06:28
Undid the changes to this file.
|
} |
void CheckWasQuicResponse(const scoped_ptr<HttpNetworkTransaction>& trans) { |
@@ -326,8 +362,9 @@ class QuicNetworkTransactionTest |
StaticSocketDataProvider hanging_data_; |
}; |
-INSTANTIATE_TEST_CASE_P(Version, QuicNetworkTransactionTest, |
- ::testing::ValuesIn(QuicSupportedVersions())); |
+INSTANTIATE_TEST_CASE_P(Version, |
+ QuicNetworkTransactionTest, |
+ ::testing::ValuesIn(GetTestParams())); |
TEST_P(QuicNetworkTransactionTest, ForceQuic) { |
params_.origin_to_force_quic_on = |