| 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 67f855b2da2baa77dee1bf4075c808f8d8eadf52..3a23866d464fecd37e0e88437eb51cc0cc70eff9 100644
|
| --- a/net/quic/quic_network_transaction_unittest.cc
|
| +++ b/net/quic/quic_network_transaction_unittest.cc
|
| @@ -2,6 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include <stdint.h>
|
| +
|
| #include <vector>
|
|
|
| #include "base/compiler_specific.h"
|
| @@ -182,6 +184,30 @@ class TestRTTObserver : public NetworkQualityEstimator::RTTObserver {
|
| bool rtt_notification_received_;
|
| };
|
|
|
| +class TestPacketLossObserver
|
| + : public NetworkQualityEstimator::PacketLossObserver {
|
| + public:
|
| + TestPacketLossObserver() : notification_received_(false) {}
|
| +
|
| + bool notification_received() const { return notification_received_; }
|
| +
|
| + // NetworkQualityEstimator::PacketLossObserver implementation:
|
| + void OnPacketLossObservation(
|
| + uint64_t num_packets_lost,
|
| + uint64_t num_packets_received_in_order,
|
| + uint64_t num_packets_received_not_in_order,
|
| + const base::TimeTicks& timestamp,
|
| + net::NetworkQualityEstimator::ObservationSource source) override {
|
| + if (source != NetworkQualityEstimator::QUIC) {
|
| + NOTIMPLEMENTED();
|
| + }
|
| + notification_received_ = true;
|
| + }
|
| +
|
| + private:
|
| + bool notification_received_;
|
| +};
|
| +
|
| class QuicNetworkTransactionTest
|
| : public PlatformTest,
|
| public ::testing::WithParamInterface<QuicVersion> {
|
| @@ -440,6 +466,8 @@ class QuicNetworkTransactionTest
|
| }
|
|
|
| test_network_quality_estimator_->AddRTTObserver(&rtt_observer_);
|
| + test_network_quality_estimator_->AddPacketLossObserver(
|
| + &packet_loss_observer_);
|
|
|
| if (use_next_protos) {
|
| params_.enable_spdy31 = true;
|
| @@ -569,6 +597,7 @@ class QuicNetworkTransactionTest
|
| scoped_ptr<CTVerifier> cert_transparency_verifier_;
|
| scoped_ptr<TestNetworkQualityEstimator> test_network_quality_estimator_;
|
| TestRTTObserver rtt_observer_;
|
| + TestPacketLossObserver packet_loss_observer_;
|
| scoped_refptr<SSLConfigServiceDefaults> ssl_config_service_;
|
| scoped_ptr<ProxyService> proxy_service_;
|
| scoped_ptr<HttpAuthHandlerFactory> auth_handler_factory_;
|
| @@ -627,8 +656,10 @@ TEST_P(QuicNetworkTransactionTest, ForceQuic) {
|
| CreateSession();
|
|
|
| EXPECT_FALSE(rtt_observer_.rtt_notification_received());
|
| + EXPECT_FALSE(packet_loss_observer_.notification_received());
|
| SendRequestAndExpectQuicResponse("hello!");
|
| EXPECT_TRUE(rtt_observer_.rtt_notification_received());
|
| + EXPECT_TRUE(packet_loss_observer_.notification_received());
|
|
|
| // Check that the NetLog was filled reasonably.
|
| TestNetLogEntry::List entries;
|
| @@ -689,6 +720,7 @@ TEST_P(QuicNetworkTransactionTest, QuicProxy) {
|
| mock_quic_data.AddSocketDataToFactory(&socket_factory_);
|
|
|
| EXPECT_FALSE(rtt_observer_.rtt_notification_received());
|
| + EXPECT_FALSE(packet_loss_observer_.notification_received());
|
| // There is no need to set up an alternate protocol job, because
|
| // no attempt will be made to speak to the proxy over TCP.
|
|
|
| @@ -697,6 +729,7 @@ TEST_P(QuicNetworkTransactionTest, QuicProxy) {
|
|
|
| SendRequestAndExpectQuicResponseFromProxyOnPort("hello!", 70);
|
| EXPECT_TRUE(rtt_observer_.rtt_notification_received());
|
| + EXPECT_TRUE(packet_loss_observer_.notification_received());
|
| }
|
|
|
| // Regression test for https://crbug.com/492458. Test that for an HTTP
|
| @@ -2242,6 +2275,7 @@ TEST_P(QuicNetworkTransactionTest, ConnectionCloseDuringConnect) {
|
| TEST_P(QuicNetworkTransactionTest, SecureResourceOverSecureQuic) {
|
| maker_.set_hostname("www.example.org");
|
| EXPECT_FALSE(rtt_observer_.rtt_notification_received());
|
| + EXPECT_FALSE(packet_loss_observer_.notification_received());
|
| MockQuicData mock_quic_data;
|
| mock_quic_data.AddWrite(
|
| ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true,
|
| @@ -2260,6 +2294,7 @@ TEST_P(QuicNetworkTransactionTest, SecureResourceOverSecureQuic) {
|
| AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE);
|
| SendRequestAndExpectQuicResponse("hello!");
|
| EXPECT_TRUE(rtt_observer_.rtt_notification_received());
|
| + EXPECT_TRUE(packet_loss_observer_.notification_received());
|
| }
|
|
|
| TEST_P(QuicNetworkTransactionTest, QuicUpload) {
|
|
|