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

Side by Side Diff: net/nqe/network_quality_estimator_unittest.cc

Issue 2731333003: Record UMA only when network quality is eligible for caching (Closed)
Patch Set: rebase, ryansturm comment Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « net/nqe/network_quality_estimator.cc ('k') | net/nqe/network_quality_store.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/nqe/network_quality_estimator.h" 5 #include "net/nqe/network_quality_estimator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 0); 309 0);
310 histogram_tester.ExpectTotalCount( 310 histogram_tester.ExpectTotalCount(
311 "NQE.MainFrame.TransportRTT.Percentile50.Unknown", 0); 311 "NQE.MainFrame.TransportRTT.Percentile50.Unknown", 0);
312 histogram_tester.ExpectTotalCount("NQE.MainFrame.Kbps.Percentile50", 1); 312 histogram_tester.ExpectTotalCount("NQE.MainFrame.Kbps.Percentile50", 1);
313 histogram_tester.ExpectTotalCount("NQE.MainFrame.Kbps.Percentile50.Unknown", 313 histogram_tester.ExpectTotalCount("NQE.MainFrame.Kbps.Percentile50.Unknown",
314 1); 314 1);
315 315
316 estimator.SimulateNetworkChange( 316 estimator.SimulateNetworkChange(
317 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, std::string()); 317 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI, std::string());
318 histogram_tester.ExpectUniqueSample("NQE.CachedNetworkQualityAvailable", 318 histogram_tester.ExpectUniqueSample("NQE.CachedNetworkQualityAvailable",
319 false, 3); 319 false, 2);
320 histogram_tester.ExpectTotalCount("NQE.PeakKbps.Unknown", 1); 320 histogram_tester.ExpectTotalCount("NQE.PeakKbps.Unknown", 1);
321 histogram_tester.ExpectTotalCount("NQE.FastestRTT.Unknown", 1); 321 histogram_tester.ExpectTotalCount("NQE.FastestRTT.Unknown", 1);
322 322
323 EXPECT_FALSE(estimator.GetRecentHttpRTT(base::TimeTicks(), &rtt)); 323 EXPECT_FALSE(estimator.GetRecentHttpRTT(base::TimeTicks(), &rtt));
324 EXPECT_FALSE( 324 EXPECT_FALSE(
325 estimator.GetRecentDownlinkThroughputKbps(base::TimeTicks(), &kbps)); 325 estimator.GetRecentDownlinkThroughputKbps(base::TimeTicks(), &kbps));
326 326
327 std::unique_ptr<URLRequest> request3(context.CreateRequest( 327 std::unique_ptr<URLRequest> request3(context.CreateRequest(
328 estimator.GetEchoURL(), DEFAULT_PRIORITY, &test_delegate)); 328 estimator.GetEchoURL(), DEFAULT_PRIORITY, &test_delegate));
329 request3->SetLoadFlags(request2->load_flags() | LOAD_MAIN_FRAME_DEPRECATED); 329 request3->SetLoadFlags(request2->load_flags() | LOAD_MAIN_FRAME_DEPRECATED);
(...skipping 10 matching lines...) Expand all
340 histogram_tester.ExpectUniqueSample( 340 histogram_tester.ExpectUniqueSample(
341 "NQE.EstimateAvailable.MainFrame.TransportRTT", 0, 3); 341 "NQE.EstimateAvailable.MainFrame.TransportRTT", 0, 3);
342 histogram_tester.ExpectBucketCount("NQE.EstimateAvailable.MainFrame.Kbps", 0, 342 histogram_tester.ExpectBucketCount("NQE.EstimateAvailable.MainFrame.Kbps", 0,
343 2); 343 2);
344 histogram_tester.ExpectBucketCount("NQE.EstimateAvailable.MainFrame.Kbps", 1, 344 histogram_tester.ExpectBucketCount("NQE.EstimateAvailable.MainFrame.Kbps", 1,
345 1); 345 1);
346 346
347 estimator.SimulateNetworkChange( 347 estimator.SimulateNetworkChange(
348 NetworkChangeNotifier::ConnectionType::CONNECTION_UNKNOWN, "test"); 348 NetworkChangeNotifier::ConnectionType::CONNECTION_UNKNOWN, "test");
349 histogram_tester.ExpectBucketCount("NQE.CachedNetworkQualityAvailable", false, 349 histogram_tester.ExpectBucketCount("NQE.CachedNetworkQualityAvailable", false,
350 3); 350 2);
351 histogram_tester.ExpectBucketCount("NQE.CachedNetworkQualityAvailable", true, 351 histogram_tester.ExpectBucketCount("NQE.CachedNetworkQualityAvailable", true,
352 1); 352 1);
353 } 353 }
354 354
355 // Tests that the network quality estimator writes and reads network quality 355 // Tests that the network quality estimator writes and reads network quality
356 // from the cache store correctly. 356 // from the cache store correctly.
357 TEST(NetworkQualityEstimatorTest, Caching) { 357 TEST(NetworkQualityEstimatorTest, Caching) {
358 base::HistogramTester histogram_tester; 358 base::HistogramTester histogram_tester;
359 std::map<std::string, std::string> variation_params; 359 std::map<std::string, std::string> variation_params;
360 variation_params["persistent_cache_reading_enabled"] = "true"; 360 variation_params["persistent_cache_reading_enabled"] = "true";
(...skipping 2756 matching lines...) Expand 10 before | Expand all | Expand 10 after
3117 3117
3118 // Cleanup. 3118 // Cleanup.
3119 estimator.RemoveRTTObserver(&rtt_observer); 3119 estimator.RemoveRTTObserver(&rtt_observer);
3120 estimator.RemoveThroughputObserver(&throughput_observer); 3120 estimator.RemoveThroughputObserver(&throughput_observer);
3121 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer); 3121 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer);
3122 estimator.RemoveEffectiveConnectionTypeObserver( 3122 estimator.RemoveEffectiveConnectionTypeObserver(
3123 &effective_connection_type_observer); 3123 &effective_connection_type_observer);
3124 } 3124 }
3125 3125
3126 } // namespace net 3126 } // namespace net
OLDNEW
« no previous file with comments | « net/nqe/network_quality_estimator.cc ('k') | net/nqe/network_quality_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698