Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Unified Diff: net/nqe/network_quality_estimator_test_util.cc

Issue 2863973003: Expose RTT and downlink bandwidth using experimental Javascript API (Closed)
Patch Set: kinuko comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/nqe/network_quality_estimator_test_util.cc
diff --git a/net/nqe/network_quality_estimator_test_util.cc b/net/nqe/network_quality_estimator_test_util.cc
index c6005bb1052aeca1f0530aca939b4475f96db99f..460abd6f8ff90db00cd210030b2679330ca34a8b 100644
--- a/net/nqe/network_quality_estimator_test_util.cc
+++ b/net/nqe/network_quality_estimator_test_util.cc
@@ -9,7 +9,6 @@
#include "base/run_loop.h"
#include "net/base/load_flags.h"
#include "net/log/net_log_with_source.h"
-#include "net/log/test_net_log.h"
#include "net/log/test_net_log_entry.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
@@ -51,6 +50,22 @@ TestNetworkQualityEstimator::TestNetworkQualityEstimator(
bool allow_smaller_responses_for_tests,
bool add_default_platform_observations,
std::unique_ptr<BoundTestNetLog> net_log)
+ : TestNetworkQualityEstimator(std::move(external_estimate_provider),
+ variation_params,
+ allow_local_host_requests_for_tests,
+ allow_smaller_responses_for_tests,
+ add_default_platform_observations,
+ false,
+ std::move(net_log)) {}
+
+TestNetworkQualityEstimator::TestNetworkQualityEstimator(
+ std::unique_ptr<net::ExternalEstimateProvider> external_estimate_provider,
+ const std::map<std::string, std::string>& variation_params,
+ bool allow_local_host_requests_for_tests,
+ bool allow_smaller_responses_for_tests,
+ bool add_default_platform_observations,
+ bool suppress_notifications_for_testing,
+ std::unique_ptr<BoundTestNetLog> net_log)
: NetworkQualityEstimator(std::move(external_estimate_provider),
variation_params,
allow_local_host_requests_for_tests,
@@ -61,6 +76,7 @@ TestNetworkQualityEstimator::TestNetworkQualityEstimator(
accuracy_recording_intervals_set_(false),
rand_double_(0.0),
embedded_test_server_(base::FilePath(kTestFilePath)),
+ suppress_notifications_for_testing_(suppress_notifications_for_testing),
net_log_(std::move(net_log)) {
// Set up the embedded test server.
EXPECT_TRUE(embedded_test_server_.Start());
@@ -279,4 +295,22 @@ TestNetworkQualityEstimator::LocalHttpTestServer::LocalHttpTestServer(
AddDefaultHandlers(document_root);
}
+void TestNetworkQualityEstimator::NotifyObserversOfRTTOrThroughputComputed()
+ const {
+ if (suppress_notifications_for_testing_)
+ return;
+
+ NetworkQualityEstimator::NotifyObserversOfRTTOrThroughputComputed();
+}
+
+void TestNetworkQualityEstimator::
+ NotifyRTTAndThroughputEstimatesObserverIfPresent(
+ RTTAndThroughputEstimatesObserver* observer) const {
+ if (suppress_notifications_for_testing_)
+ return;
+
+ NetworkQualityEstimator::NotifyRTTAndThroughputEstimatesObserverIfPresent(
+ observer);
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698