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

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: fix Android compile error Created 3 years, 7 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 2788 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 2799
2800 if (ect_type == EFFECTIVE_CONNECTION_TYPE_UNKNOWN || 2800 if (ect_type == EFFECTIVE_CONNECTION_TYPE_UNKNOWN ||
2801 ect_type == EFFECTIVE_CONNECTION_TYPE_OFFLINE) { 2801 ect_type == EFFECTIVE_CONNECTION_TYPE_OFFLINE) {
2802 EXPECT_EQ(nqe::internal::InvalidRTT(), 2802 EXPECT_EQ(nqe::internal::InvalidRTT(),
2803 rtt_throughput_observer.http_rtt()); 2803 rtt_throughput_observer.http_rtt());
2804 EXPECT_EQ(nqe::internal::InvalidRTT(), 2804 EXPECT_EQ(nqe::internal::InvalidRTT(),
2805 rtt_throughput_observer.transport_rtt()); 2805 rtt_throughput_observer.transport_rtt());
2806 EXPECT_EQ(nqe::internal::kInvalidThroughput, 2806 EXPECT_EQ(nqe::internal::kInvalidThroughput,
2807 rtt_throughput_observer.downstream_throughput_kbps()); 2807 rtt_throughput_observer.downstream_throughput_kbps());
2808 } else { 2808 } else {
2809 EXPECT_EQ(estimator.params_.TypicalNetworkQuality(ect_type).http_rtt(), 2809 EXPECT_EQ(estimator.params_->TypicalNetworkQuality(ect_type).http_rtt(),
2810 rtt_throughput_observer.http_rtt()); 2810 rtt_throughput_observer.http_rtt());
2811 EXPECT_EQ( 2811 EXPECT_EQ(
2812 estimator.params_.TypicalNetworkQuality(ect_type).transport_rtt(), 2812 estimator.params_->TypicalNetworkQuality(ect_type).transport_rtt(),
2813 rtt_throughput_observer.transport_rtt()); 2813 rtt_throughput_observer.transport_rtt());
2814 EXPECT_EQ(estimator.params_.TypicalNetworkQuality(ect_type) 2814 EXPECT_EQ(estimator.params_->TypicalNetworkQuality(ect_type)
2815 .downstream_throughput_kbps(), 2815 .downstream_throughput_kbps(),
2816 rtt_throughput_observer.downstream_throughput_kbps()); 2816 rtt_throughput_observer.downstream_throughput_kbps());
2817 } 2817 }
2818 } 2818 }
2819 } 2819 }
2820 } 2820 }
2821 2821
2822 // Test that the typical network qualities are set correctly. 2822 // Test that the typical network qualities are set correctly.
2823 TEST(NetworkQualityEstimatorTest, TypicalNetworkQualities) { 2823 TEST(NetworkQualityEstimatorTest, TypicalNetworkQualities) {
2824 const struct { 2824 const struct {
(...skipping 20 matching lines...) Expand all
2845 context.Init(); 2845 context.Init();
2846 2846
2847 for (size_t effective_connection_type = EFFECTIVE_CONNECTION_TYPE_SLOW_2G; 2847 for (size_t effective_connection_type = EFFECTIVE_CONNECTION_TYPE_SLOW_2G;
2848 effective_connection_type <= EFFECTIVE_CONNECTION_TYPE_4G; 2848 effective_connection_type <= EFFECTIVE_CONNECTION_TYPE_4G;
2849 ++effective_connection_type) { 2849 ++effective_connection_type) {
2850 // Set the RTT and throughput values to the typical values for 2850 // Set the RTT and throughput values to the typical values for
2851 // |effective_connection_type|. The effective connection type should be 2851 // |effective_connection_type|. The effective connection type should be
2852 // computed as |effective_connection_type|. 2852 // computed as |effective_connection_type|.
2853 estimator.set_start_time_null_http_rtt( 2853 estimator.set_start_time_null_http_rtt(
2854 estimator.params_ 2854 estimator.params_
2855 .TypicalNetworkQuality(static_cast<EffectiveConnectionType>( 2855 ->TypicalNetworkQuality(static_cast<EffectiveConnectionType>(
2856 effective_connection_type)) 2856 effective_connection_type))
2857 .http_rtt()); 2857 .http_rtt());
2858 estimator.set_start_time_null_transport_rtt( 2858 estimator.set_start_time_null_transport_rtt(
2859 estimator.params_ 2859 estimator.params_
2860 .TypicalNetworkQuality(static_cast<EffectiveConnectionType>( 2860 ->TypicalNetworkQuality(static_cast<EffectiveConnectionType>(
2861 effective_connection_type)) 2861 effective_connection_type))
2862 .transport_rtt()); 2862 .transport_rtt());
2863 estimator.set_start_time_null_downlink_throughput_kbps(INT32_MAX); 2863 estimator.set_start_time_null_downlink_throughput_kbps(INT32_MAX);
2864 2864
2865 // Force recomputation of effective connection type by starting a main 2865 // Force recomputation of effective connection type by starting a main
2866 // frame request. 2866 // frame request.
2867 std::unique_ptr<URLRequest> request( 2867 std::unique_ptr<URLRequest> request(
2868 context.CreateRequest(estimator.GetEchoURL(), DEFAULT_PRIORITY, 2868 context.CreateRequest(estimator.GetEchoURL(), DEFAULT_PRIORITY,
2869 &test_delegate, TRAFFIC_ANNOTATION_FOR_TESTS)); 2869 &test_delegate, TRAFFIC_ANNOTATION_FOR_TESTS));
2870 request->SetLoadFlags(request->load_flags() | LOAD_MAIN_FRAME_DEPRECATED); 2870 request->SetLoadFlags(request->load_flags() | LOAD_MAIN_FRAME_DEPRECATED);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3079 3079
3080 // Cleanup. 3080 // Cleanup.
3081 estimator.RemoveRTTObserver(&rtt_observer); 3081 estimator.RemoveRTTObserver(&rtt_observer);
3082 estimator.RemoveThroughputObserver(&throughput_observer); 3082 estimator.RemoveThroughputObserver(&throughput_observer);
3083 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer); 3083 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer);
3084 estimator.RemoveEffectiveConnectionTypeObserver( 3084 estimator.RemoveEffectiveConnectionTypeObserver(
3085 &effective_connection_type_observer); 3085 &effective_connection_type_observer);
3086 } 3086 }
3087 3087
3088 } // namespace net 3088 } // 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