#include "net/nqe/network_quality_estimator_test_util.h"
#include "base/files/file_path.h"
#include "base/run_loop.h"
#include "net/base/load_flags.h"
#include "net/log/net_log.h"
#include "net/log/net_log_with_source.h"
#include "net/log/test_net_log_util.h"
#include "net/nqe/network_quality_estimator_params.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
namespace {
const base::FilePath::CharType kTestFilePath[] = …);
}
namespace net {
TestNetworkQualityEstimator::TestNetworkQualityEstimator()
: … { … }
TestNetworkQualityEstimator::TestNetworkQualityEstimator(
const std::map<std::string, std::string>& variation_params)
: … { … }
TestNetworkQualityEstimator::TestNetworkQualityEstimator(
const std::map<std::string, std::string>& variation_params,
bool allow_local_host_requests_for_tests,
bool allow_smaller_responses_for_tests)
: … { … }
TestNetworkQualityEstimator::TestNetworkQualityEstimator(
const std::map<std::string, std::string>& variation_params,
bool allow_local_host_requests_for_tests,
bool allow_smaller_responses_for_tests,
bool suppress_notifications_for_testing)
: … { … }
TestNetworkQualityEstimator::TestNetworkQualityEstimator(
std::unique_ptr<NetworkQualityEstimatorParams> params)
: … { … }
TestNetworkQualityEstimator::~TestNetworkQualityEstimator() = default;
void TestNetworkQualityEstimator::RunOneRequest() { … }
void TestNetworkQualityEstimator::SimulateNetworkChange(
NetworkChangeNotifier::ConnectionType new_connection_type,
const std::string& network_id) { … }
const GURL TestNetworkQualityEstimator::GetEchoURL() { … }
const GURL TestNetworkQualityEstimator::GetRedirectURL() { … }
EffectiveConnectionType
TestNetworkQualityEstimator::GetEffectiveConnectionType() const { … }
EffectiveConnectionType
TestNetworkQualityEstimator::GetRecentEffectiveConnectionTypeUsingMetrics(
base::TimeDelta* http_rtt,
base::TimeDelta* transport_rtt,
base::TimeDelta* end_to_end_rtt,
int32_t* downstream_throughput_kbps,
size_t* observations_count,
size_t* end_to_end_rtt_observation_count) const { … }
bool TestNetworkQualityEstimator::GetRecentRTT(
nqe::internal::ObservationCategory observation_category,
const base::TimeTicks& start_time,
base::TimeDelta* rtt,
size_t* observations_count) const { … }
std::optional<base::TimeDelta> TestNetworkQualityEstimator::GetTransportRTT()
const { … }
bool TestNetworkQualityEstimator::GetRecentDownlinkThroughputKbps(
const base::TimeTicks& start_time,
int32_t* kbps) const { … }
base::TimeDelta TestNetworkQualityEstimator::GetRTTEstimateInternal(
base::TimeTicks start_time,
nqe::internal::ObservationCategory observation_category,
int percentile,
size_t* observations_count) const { … }
int TestNetworkQualityEstimator::GetEntriesCount(NetLogEventType type) const { … }
std::string TestNetworkQualityEstimator::GetNetLogLastStringValue(
NetLogEventType type,
const std::string& key) const { … }
int TestNetworkQualityEstimator::GetNetLogLastIntegerValue(
NetLogEventType type,
const std::string& key) const { … }
void TestNetworkQualityEstimator::
NotifyObserversOfRTTOrThroughputEstimatesComputed(
const net::nqe::internal::NetworkQuality& network_quality) { … }
void TestNetworkQualityEstimator::
SetAndNotifyObserversOfEffectiveConnectionType(
EffectiveConnectionType type) { … }
std::optional<net::EffectiveConnectionType>
TestNetworkQualityEstimator::GetOverrideECT() const { … }
void TestNetworkQualityEstimator::
SetAndNotifyObserversOfP2PActiveConnectionsCountChange(uint32_t count) { … }
void TestNetworkQualityEstimator::RecordSpdyPingLatency(
const HostPortPair& host_port_pair,
base::TimeDelta rtt) { … }
const NetworkQualityEstimatorParams* TestNetworkQualityEstimator::params()
const { … }
nqe::internal::NetworkID TestNetworkQualityEstimator::GetCurrentNetworkID()
const { … }
TestNetworkQualityEstimator::LocalHttpTestServer::LocalHttpTestServer(
const base::FilePath& document_root) { … }
void TestNetworkQualityEstimator::NotifyObserversOfRTTOrThroughputComputed()
const { … }
void TestNetworkQualityEstimator::
NotifyRTTAndThroughputEstimatesObserverIfPresent(
RTTAndThroughputEstimatesObserver* observer) const { … }
void TestNetworkQualityEstimator::SetStartTimeNullHttpRtt(
const base::TimeDelta http_rtt) { … }
void TestNetworkQualityEstimator::SetStartTimeNullTransportRtt(
const base::TimeDelta transport_rtt) { … }
}