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

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

Issue 2907463002: Split HttpNetworkSession::Params into two structs. (Closed)
Patch Set: Response to comments 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
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 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2150 2150
2151 estimator.AddRTTObserver(&rtt_observer); 2151 estimator.AddRTTObserver(&rtt_observer);
2152 // |observer| may be notified as soon as it is added. Run the loop to so that 2152 // |observer| may be notified as soon as it is added. Run the loop to so that
2153 // the notification to |observer| is finished. 2153 // the notification to |observer| is finished.
2154 base::RunLoop().RunUntilIdle(); 2154 base::RunLoop().RunUntilIdle();
2155 2155
2156 TestDelegate test_delegate; 2156 TestDelegate test_delegate;
2157 TestURLRequestContext context(true); 2157 TestURLRequestContext context(true);
2158 context.set_network_quality_estimator(&estimator); 2158 context.set_network_quality_estimator(&estimator);
2159 2159
2160 std::unique_ptr<HttpNetworkSession::Params> params( 2160 std::unique_ptr<HttpNetworkSession::Context> session_context(
2161 new HttpNetworkSession::Params); 2161 new HttpNetworkSession::Context);
2162 // |estimator| should be notified of TCP RTT observations. 2162 // |estimator| should be notified of TCP RTT observations.
2163 params->socket_performance_watcher_factory = 2163 session_context->socket_performance_watcher_factory =
2164 estimator.GetSocketPerformanceWatcherFactory(); 2164 estimator.GetSocketPerformanceWatcherFactory();
2165 context.set_http_network_session_params(std::move(params)); 2165 context.set_http_network_session_context(std::move(session_context));
2166 context.Init(); 2166 context.Init();
2167 2167
2168 EXPECT_EQ(0U, rtt_observer.observations().size()); 2168 EXPECT_EQ(0U, rtt_observer.observations().size());
2169 base::TimeDelta rtt; 2169 base::TimeDelta rtt;
2170 EXPECT_TRUE(estimator.GetRecentHttpRTT(base::TimeTicks(), &rtt)); 2170 EXPECT_TRUE(estimator.GetRecentHttpRTT(base::TimeTicks(), &rtt));
2171 EXPECT_TRUE(estimator.GetRecentTransportRTT(base::TimeTicks(), &rtt)); 2171 EXPECT_TRUE(estimator.GetRecentTransportRTT(base::TimeTicks(), &rtt));
2172 EXPECT_EQ(rtt, estimator.GetTransportRTT().value()); 2172 EXPECT_EQ(rtt, estimator.GetTransportRTT().value());
2173 2173
2174 // Send two requests. Verify that the completion of each request generates at 2174 // Send two requests. Verify that the completion of each request generates at
2175 // least one TCP RTT observation. 2175 // least one TCP RTT observation.
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
3091 3091
3092 // Cleanup. 3092 // Cleanup.
3093 estimator.RemoveRTTObserver(&rtt_observer); 3093 estimator.RemoveRTTObserver(&rtt_observer);
3094 estimator.RemoveThroughputObserver(&throughput_observer); 3094 estimator.RemoveThroughputObserver(&throughput_observer);
3095 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer); 3095 estimator.RemoveRTTAndThroughputEstimatesObserver(&rtt_throughput_observer);
3096 estimator.RemoveEffectiveConnectionTypeObserver( 3096 estimator.RemoveEffectiveConnectionTypeObserver(
3097 &effective_connection_type_observer); 3097 &effective_connection_type_observer);
3098 } 3098 }
3099 3099
3100 } // namespace net 3100 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_unittest.cc ('k') | net/proxy/proxy_script_fetcher_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698