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 2740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2751 estimator.RunOneRequest(); | 2751 estimator.RunOneRequest(); |
2752 EXPECT_EQ(0u, observer.get_notification_received_and_reset()); | 2752 EXPECT_EQ(0u, observer.get_notification_received_and_reset()); |
2753 } | 2753 } |
2754 | 2754 |
2755 // Tests that the value of the effective connection type can be forced through | 2755 // Tests that the value of the effective connection type can be forced through |
2756 // field trial parameters. | 2756 // field trial parameters. |
2757 TEST(NetworkQualityEstimatorTest, | 2757 TEST(NetworkQualityEstimatorTest, |
2758 ForceEffectiveConnectionTypeThroughFieldTrial) { | 2758 ForceEffectiveConnectionTypeThroughFieldTrial) { |
2759 for (int i = 0; i < EFFECTIVE_CONNECTION_TYPE_LAST; ++i) { | 2759 for (int i = 0; i < EFFECTIVE_CONNECTION_TYPE_LAST; ++i) { |
2760 std::map<std::string, std::string> variation_params; | 2760 std::map<std::string, std::string> variation_params; |
2761 variation_params["force_effective_connection_type"] = | 2761 variation_params[kForceEffectiveConnectionType] = |
2762 GetNameForEffectiveConnectionType( | 2762 GetNameForEffectiveConnectionType( |
2763 static_cast<EffectiveConnectionType>(i)); | 2763 static_cast<EffectiveConnectionType>(i)); |
2764 TestNetworkQualityEstimator estimator(variation_params); | 2764 TestNetworkQualityEstimator estimator(variation_params); |
2765 | 2765 |
2766 TestEffectiveConnectionTypeObserver observer; | 2766 TestEffectiveConnectionTypeObserver observer; |
2767 estimator.AddEffectiveConnectionTypeObserver(&observer); | 2767 estimator.AddEffectiveConnectionTypeObserver(&observer); |
2768 // |observer| may be notified as soon as it is added. Run the loop to so | 2768 // |observer| may be notified as soon as it is added. Run the loop to so |
2769 // that the notification to |observer| is finished. | 2769 // that the notification to |observer| is finished. |
2770 base::RunLoop().RunUntilIdle(); | 2770 base::RunLoop().RunUntilIdle(); |
2771 | 2771 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 | 3112 |
3113 // Cleanup. | 3113 // Cleanup. |
3114 estimator.RemoveRTTObserver(&rtt_observer); | 3114 estimator.RemoveRTTObserver(&rtt_observer); |
3115 estimator.RemoveThroughputObserver(&throughput_observer); | 3115 estimator.RemoveThroughputObserver(&throughput_observer); |
3116 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer); | 3116 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer); |
3117 estimator.RemoveEffectiveConnectionTypeObserver( | 3117 estimator.RemoveEffectiveConnectionTypeObserver( |
3118 &effective_connection_type_observer); | 3118 &effective_connection_type_observer); |
3119 } | 3119 } |
3120 | 3120 |
3121 } // namespace net | 3121 } // namespace net |
OLD | NEW |