| OLD | NEW |
| 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 2768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2779 estimator.RunOneRequest(); | 2779 estimator.RunOneRequest(); |
| 2780 EXPECT_EQ(0u, observer.get_notification_received_and_reset()); | 2780 EXPECT_EQ(0u, observer.get_notification_received_and_reset()); |
| 2781 } | 2781 } |
| 2782 | 2782 |
| 2783 // Tests that the value of the effective connection type can be forced through | 2783 // Tests that the value of the effective connection type can be forced through |
| 2784 // field trial parameters. | 2784 // field trial parameters. |
| 2785 TEST(NetworkQualityEstimatorTest, | 2785 TEST(NetworkQualityEstimatorTest, |
| 2786 ForceEffectiveConnectionTypeThroughFieldTrial) { | 2786 ForceEffectiveConnectionTypeThroughFieldTrial) { |
| 2787 for (int i = 0; i < EFFECTIVE_CONNECTION_TYPE_LAST; ++i) { | 2787 for (int i = 0; i < EFFECTIVE_CONNECTION_TYPE_LAST; ++i) { |
| 2788 std::map<std::string, std::string> variation_params; | 2788 std::map<std::string, std::string> variation_params; |
| 2789 variation_params["force_effective_connection_type"] = | 2789 variation_params[kForceEffectiveConnectionType] = |
| 2790 GetNameForEffectiveConnectionType( | 2790 GetNameForEffectiveConnectionType( |
| 2791 static_cast<EffectiveConnectionType>(i)); | 2791 static_cast<EffectiveConnectionType>(i)); |
| 2792 TestNetworkQualityEstimator estimator(variation_params); | 2792 TestNetworkQualityEstimator estimator(variation_params); |
| 2793 | 2793 |
| 2794 TestEffectiveConnectionTypeObserver observer; | 2794 TestEffectiveConnectionTypeObserver observer; |
| 2795 estimator.AddEffectiveConnectionTypeObserver(&observer); | 2795 estimator.AddEffectiveConnectionTypeObserver(&observer); |
| 2796 // |observer| may be notified as soon as it is added. Run the loop to so | 2796 // |observer| may be notified as soon as it is added. Run the loop to so |
| 2797 // that the notification to |observer| is finished. | 2797 // that the notification to |observer| is finished. |
| 2798 base::RunLoop().RunUntilIdle(); | 2798 base::RunLoop().RunUntilIdle(); |
| 2799 | 2799 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3140 | 3140 |
| 3141 // Cleanup. | 3141 // Cleanup. |
| 3142 estimator.RemoveRTTObserver(&rtt_observer); | 3142 estimator.RemoveRTTObserver(&rtt_observer); |
| 3143 estimator.RemoveThroughputObserver(&throughput_observer); | 3143 estimator.RemoveThroughputObserver(&throughput_observer); |
| 3144 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer); | 3144 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer); |
| 3145 estimator.RemoveEffectiveConnectionTypeObserver( | 3145 estimator.RemoveEffectiveConnectionTypeObserver( |
| 3146 &effective_connection_type_observer); | 3146 &effective_connection_type_observer); |
| 3147 } | 3147 } |
| 3148 | 3148 |
| 3149 } // namespace net | 3149 } // namespace net |
| OLD | NEW |