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

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

Issue 2899453002: Pass parsed network quality estimator params when constructing NQE (Closed)
Patch Set: Rebased Created 3 years, 6 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_test_util.cc ('k') | net/nqe/throughput_analyzer.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 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after
2835 2835
2836 if (ect_type == EFFECTIVE_CONNECTION_TYPE_UNKNOWN || 2836 if (ect_type == EFFECTIVE_CONNECTION_TYPE_UNKNOWN ||
2837 ect_type == EFFECTIVE_CONNECTION_TYPE_OFFLINE) { 2837 ect_type == EFFECTIVE_CONNECTION_TYPE_OFFLINE) {
2838 EXPECT_EQ(nqe::internal::InvalidRTT(), 2838 EXPECT_EQ(nqe::internal::InvalidRTT(),
2839 rtt_throughput_observer.http_rtt()); 2839 rtt_throughput_observer.http_rtt());
2840 EXPECT_EQ(nqe::internal::InvalidRTT(), 2840 EXPECT_EQ(nqe::internal::InvalidRTT(),
2841 rtt_throughput_observer.transport_rtt()); 2841 rtt_throughput_observer.transport_rtt());
2842 EXPECT_EQ(nqe::internal::kInvalidThroughput, 2842 EXPECT_EQ(nqe::internal::kInvalidThroughput,
2843 rtt_throughput_observer.downstream_throughput_kbps()); 2843 rtt_throughput_observer.downstream_throughput_kbps());
2844 } else { 2844 } else {
2845 EXPECT_EQ(estimator.params_.TypicalNetworkQuality(ect_type).http_rtt(), 2845 EXPECT_EQ(estimator.params_->TypicalNetworkQuality(ect_type).http_rtt(),
2846 rtt_throughput_observer.http_rtt()); 2846 rtt_throughput_observer.http_rtt());
2847 EXPECT_EQ( 2847 EXPECT_EQ(
2848 estimator.params_.TypicalNetworkQuality(ect_type).transport_rtt(), 2848 estimator.params_->TypicalNetworkQuality(ect_type).transport_rtt(),
2849 rtt_throughput_observer.transport_rtt()); 2849 rtt_throughput_observer.transport_rtt());
2850 EXPECT_EQ(estimator.params_.TypicalNetworkQuality(ect_type) 2850 EXPECT_EQ(estimator.params_->TypicalNetworkQuality(ect_type)
2851 .downstream_throughput_kbps(), 2851 .downstream_throughput_kbps(),
2852 rtt_throughput_observer.downstream_throughput_kbps()); 2852 rtt_throughput_observer.downstream_throughput_kbps());
2853 } 2853 }
2854 } 2854 }
2855 } 2855 }
2856 } 2856 }
2857 2857
2858 // Test that the typical network qualities are set correctly. 2858 // Test that the typical network qualities are set correctly.
2859 TEST(NetworkQualityEstimatorTest, TypicalNetworkQualities) { 2859 TEST(NetworkQualityEstimatorTest, TypicalNetworkQualities) {
2860 const struct { 2860 const struct {
(...skipping 20 matching lines...) Expand all
2881 context.Init(); 2881 context.Init();
2882 2882
2883 for (size_t effective_connection_type = EFFECTIVE_CONNECTION_TYPE_SLOW_2G; 2883 for (size_t effective_connection_type = EFFECTIVE_CONNECTION_TYPE_SLOW_2G;
2884 effective_connection_type <= EFFECTIVE_CONNECTION_TYPE_4G; 2884 effective_connection_type <= EFFECTIVE_CONNECTION_TYPE_4G;
2885 ++effective_connection_type) { 2885 ++effective_connection_type) {
2886 // Set the RTT and throughput values to the typical values for 2886 // Set the RTT and throughput values to the typical values for
2887 // |effective_connection_type|. The effective connection type should be 2887 // |effective_connection_type|. The effective connection type should be
2888 // computed as |effective_connection_type|. 2888 // computed as |effective_connection_type|.
2889 estimator.set_start_time_null_http_rtt( 2889 estimator.set_start_time_null_http_rtt(
2890 estimator.params_ 2890 estimator.params_
2891 .TypicalNetworkQuality(static_cast<EffectiveConnectionType>( 2891 ->TypicalNetworkQuality(static_cast<EffectiveConnectionType>(
2892 effective_connection_type)) 2892 effective_connection_type))
2893 .http_rtt()); 2893 .http_rtt());
2894 estimator.set_start_time_null_transport_rtt( 2894 estimator.set_start_time_null_transport_rtt(
2895 estimator.params_ 2895 estimator.params_
2896 .TypicalNetworkQuality(static_cast<EffectiveConnectionType>( 2896 ->TypicalNetworkQuality(static_cast<EffectiveConnectionType>(
2897 effective_connection_type)) 2897 effective_connection_type))
2898 .transport_rtt()); 2898 .transport_rtt());
2899 estimator.set_start_time_null_downlink_throughput_kbps(INT32_MAX); 2899 estimator.set_start_time_null_downlink_throughput_kbps(INT32_MAX);
2900 2900
2901 // Force recomputation of effective connection type by starting a main 2901 // Force recomputation of effective connection type by starting a main
2902 // frame request. 2902 // frame request.
2903 std::unique_ptr<URLRequest> request( 2903 std::unique_ptr<URLRequest> request(
2904 context.CreateRequest(estimator.GetEchoURL(), DEFAULT_PRIORITY, 2904 context.CreateRequest(estimator.GetEchoURL(), DEFAULT_PRIORITY,
2905 &test_delegate, TRAFFIC_ANNOTATION_FOR_TESTS)); 2905 &test_delegate, TRAFFIC_ANNOTATION_FOR_TESTS));
2906 request->SetLoadFlags(request->load_flags() | LOAD_MAIN_FRAME_DEPRECATED); 2906 request->SetLoadFlags(request->load_flags() | LOAD_MAIN_FRAME_DEPRECATED);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3115 3115
3116 // Cleanup. 3116 // Cleanup.
3117 estimator.RemoveRTTObserver(&rtt_observer); 3117 estimator.RemoveRTTObserver(&rtt_observer);
3118 estimator.RemoveThroughputObserver(&throughput_observer); 3118 estimator.RemoveThroughputObserver(&throughput_observer);
3119 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer); 3119 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer);
3120 estimator.RemoveEffectiveConnectionTypeObserver( 3120 estimator.RemoveEffectiveConnectionTypeObserver(
3121 &effective_connection_type_observer); 3121 &effective_connection_type_observer);
3122 } 3122 }
3123 3123
3124 } // namespace net 3124 } // namespace net
OLDNEW
« no previous file with comments | « net/nqe/network_quality_estimator_test_util.cc ('k') | net/nqe/throughput_analyzer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698