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

Unified Diff: net/nqe/network_quality_estimator_unittest.cc

Issue 2005143005: Record network quality UMA metrics on main frame requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed rebase issues Created 4 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
« no previous file with comments | « net/nqe/network_quality_estimator.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/nqe/network_quality_estimator_unittest.cc
diff --git a/net/nqe/network_quality_estimator_unittest.cc b/net/nqe/network_quality_estimator_unittest.cc
index 91397d50a5691b0eaff1d19a3df772b12357e6a5..e19c15e9ce265957406950bcd00857abe246164d 100644
--- a/net/nqe/network_quality_estimator_unittest.cc
+++ b/net/nqe/network_quality_estimator_unittest.cc
@@ -301,6 +301,13 @@ TEST(NetworkQualityEstimatorTest, TestKbpsRTTUpdates) {
EXPECT_FALSE(estimator.GetHttpRTTEstimate(&rtt));
EXPECT_FALSE(estimator.GetDownlinkThroughputKbpsEstimate(&kbps));
+ // Verify that metrics are logged correctly on main-frame requests.
+ histogram_tester.ExpectTotalCount("NQE.MainFrame.RTT.Percentile50.Unknown",
+ 1);
+ histogram_tester.ExpectTotalCount(
+ "NQE.MainFrame.TransportRTT.Percentile50.Unknown", 0);
+ histogram_tester.ExpectTotalCount("NQE.MainFrame.Kbps.Percentile50.Unknown",
+ 1);
estimator.SimulateNetworkChangeTo(
NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, std::string());
histogram_tester.ExpectTotalCount("NQE.PeakKbps.Unknown", 1);
@@ -1388,7 +1395,8 @@ TEST(NetworkQualityEstimatorTest, MAYBE_TestTCPSocketRTT) {
// Send two requests. Verify that the completion of each request generates at
// least one TCP RTT observation.
- for (size_t i = 0; i < 2; ++i) {
+ const size_t num_requests = 2;
+ for (size_t i = 0; i < num_requests; ++i) {
size_t before_count_tcp_rtt_observations = 0;
for (const auto& observation : rtt_observer.observations()) {
if (observation.source == NETWORK_QUALITY_OBSERVATION_SOURCE_TCP)
@@ -1397,6 +1405,7 @@ TEST(NetworkQualityEstimatorTest, MAYBE_TestTCPSocketRTT) {
std::unique_ptr<URLRequest> request(context.CreateRequest(
estimator.GetEchoURL(), DEFAULT_PRIORITY, &test_delegate));
+ request->SetLoadFlags(request->load_flags() | LOAD_MAIN_FRAME);
request->Start();
base::RunLoop().Run();
@@ -1424,6 +1433,10 @@ TEST(NetworkQualityEstimatorTest, MAYBE_TestTCPSocketRTT) {
histogram_tester.ExpectTotalCount("NQE.TransportRTT.Percentile90.Unknown", 1);
histogram_tester.ExpectTotalCount("NQE.TransportRTT.Percentile100.Unknown",
1);
+
+ // Verify that metrics are logged correctly on main-frame requests.
+ histogram_tester.ExpectTotalCount(
+ "NQE.MainFrame.TransportRTT.Percentile50.Unknown", num_requests);
}
} // namespace net
« no previous file with comments | « net/nqe/network_quality_estimator.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698