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

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

Issue 2724403004: NQE: Add net log event if the metric changes substantially (Closed)
Patch Set: 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
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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 TestEffectiveConnectionTypeObserver observer; 404 TestEffectiveConnectionTypeObserver observer;
405 estimator.AddEffectiveConnectionTypeObserver(&observer); 405 estimator.AddEffectiveConnectionTypeObserver(&observer);
406 TestRTTObserver rtt_observer; 406 TestRTTObserver rtt_observer;
407 estimator.AddRTTObserver(&rtt_observer); 407 estimator.AddRTTObserver(&rtt_observer);
408 TestThroughputObserver throughput_observer; 408 TestThroughputObserver throughput_observer;
409 estimator.AddThroughputObserver(&throughput_observer); 409 estimator.AddThroughputObserver(&throughput_observer);
410 410
411 // |observer| should be notified as soon as it is added. 411 // |observer| should be notified as soon as it is added.
412 base::RunLoop().RunUntilIdle(); 412 base::RunLoop().RunUntilIdle();
413 EXPECT_EQ(1U, observer.effective_connection_types().size()); 413 EXPECT_EQ(1U, observer.effective_connection_types().size());
414 EXPECT_EQ( 414 EXPECT_LE(
RyanSturm 2017/03/03 22:10:21 why is this LE now?
tbansal1 2017/03/03 23:06:35 With this CL, it is difficult to precisely determi
415 2, estimator.GetEntriesCount(NetLogEventType::NETWORK_QUALITY_CHANGED)); 415 2, estimator.GetEntriesCount(NetLogEventType::NETWORK_QUALITY_CHANGED));
416 416
417 estimator.SimulateNetworkChange( 417 estimator.SimulateNetworkChange(
418 NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test"); 418 NetworkChangeNotifier::ConnectionType::CONNECTION_2G, "test");
419 histogram_tester.ExpectBucketCount( 419 histogram_tester.ExpectBucketCount(
420 "NQE.RTT.ObservationSource", 420 "NQE.RTT.ObservationSource",
421 NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE, 1); 421 NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE, 1);
422 histogram_tester.ExpectBucketCount( 422 histogram_tester.ExpectBucketCount(
423 "NQE.Kbps.ObservationSource", 423 "NQE.Kbps.ObservationSource",
424 NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE, 1); 424 NETWORK_QUALITY_OBSERVATION_SOURCE_HTTP_CACHED_ESTIMATE, 1);
(...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after
3114 3114
3115 // Cleanup. 3115 // Cleanup.
3116 estimator.RemoveRTTObserver(&rtt_observer); 3116 estimator.RemoveRTTObserver(&rtt_observer);
3117 estimator.RemoveThroughputObserver(&throughput_observer); 3117 estimator.RemoveThroughputObserver(&throughput_observer);
3118 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer); 3118 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer);
3119 estimator.RemoveEffectiveConnectionTypeObserver( 3119 estimator.RemoveEffectiveConnectionTypeObserver(
3120 &effective_connection_type_observer); 3120 &effective_connection_type_observer);
3121 } 3121 }
3122 3122
3123 } // namespace net 3123 } // namespace net
OLDNEW
« net/nqe/event_creator.cc ('K') | « net/nqe/network_quality_estimator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698