Enable NQE when Cronet Engine is built
Enabling NQE as soon as Cronet Engine is built makes it
possible to set NQE's delegate as socket performance watcher
factor in Http network session params. This in turn ensures
that NQE is notified of RTT observations from TCP and QUIC
sockets.
The previous API and the related tests will be removed after
the existing consumers of that API transfer to using Cronet
config for enabling NQE.
Also, update the network quality listeners API. Now, RTT
and throughput listeners are required to provide an
executor in their constructor. The listeners are then
provided the observations on the same executor.
This CL does not modify UrlRequestFinishedListener, which
is already in use by multiple embedders. Those embedders
would continue to work.
BUG=618030
Review-Url: https://codereview.chromium.org/2045703003
Cr-Commit-Position: refs/heads/master@{#402029}
diff --git a/net/nqe/throughput_analyzer.h b/net/nqe/throughput_analyzer.h
index 649d76b..a93be45 100644
--- a/net/nqe/throughput_analyzer.h
+++ b/net/nqe/throughput_analyzer.h
@@ -70,6 +70,17 @@
// Notifies |this| of a change in connection type.
void OnConnectionTypeChanged();
+ // |use_localhost_requests| should only be true when testing against local
+ // HTTP server and allows the requests to local host to be used for network
+ // quality estimation.
+ void SetUseLocalHostRequestsForTesting(bool use_localhost_requests);
+
+ // |use_smaller_responses_for_tests| should only be true when testing, and
+ // allows the responses smaller than |kMinTransferSizeInBits| or shorter than
+ // |kMinRequestDurationMicroseconds| to be used for network quality
+ // estimation.
+ void SetUseSmallResponsesForTesting(bool use_small_responses);
+
protected:
// Exposed for testing.
bool disable_throughput_measurements() const {
@@ -155,12 +166,12 @@
// Determines if the requests to local host can be used in estimating the
// network quality. Set to true only for tests.
- const bool use_localhost_requests_for_tests_;
+ bool use_localhost_requests_for_tests_;
// Determines if the responses smaller than |kMinTransferSizeInBits|
// or shorter than |kMinTransferSizeInBits| can be used in estimating the
// network quality. Set to true only for tests.
- const bool use_small_responses_for_tests_;
+ bool use_small_responses_for_tests_;
base::ThreadChecker thread_checker_;