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

Side by Side Diff: content/browser/net_info_browsertest.cc

Issue 2908233002: NetInfo default values (Closed)
Patch Set: ps 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 | « no previous file | net/nqe/network_quality_estimator_test_util.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // doesn't get created in content_browsertests. Insert a mock 59 // doesn't get created in content_browsertests. Insert a mock
60 // NetworkChangeNotifier. 60 // NetworkChangeNotifier.
61 net::NetworkChangeNotifier::CreateMock(); 61 net::NetworkChangeNotifier::CreateMock();
62 #endif 62 #endif
63 63
64 content::ContentBrowserTest::SetUp(); 64 content::ContentBrowserTest::SetUp();
65 } 65 }
66 66
67 void SetUpOnMainThread() override { 67 void SetUpOnMainThread() override {
68 base::RunLoop().RunUntilIdle(); 68 base::RunLoop().RunUntilIdle();
69 estimator_ = base::MakeUnique<net::TestNetworkQualityEstimator>(
70 nullptr, std::map<std::string, std::string>(), false, false, true,
71 base::MakeUnique<net::BoundTestNetLog>());
72 impl_ = base::MakeUnique<NetworkQualityObserverImpl>(estimator_.get());
69 } 73 }
70 74
71 static void SetConnectionType( 75 static void SetConnectionType(
72 net::NetworkChangeNotifier::ConnectionType type, 76 net::NetworkChangeNotifier::ConnectionType type,
73 net::NetworkChangeNotifier::ConnectionSubtype subtype) { 77 net::NetworkChangeNotifier::ConnectionSubtype subtype) {
74 net::NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChangeForTests( 78 net::NetworkChangeNotifier::NotifyObserversOfMaxBandwidthChangeForTests(
75 net::NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype( 79 net::NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
76 subtype), 80 subtype),
77 type); 81 type);
78 base::RunLoop().RunUntilIdle(); 82 base::RunLoop().RunUntilIdle();
79 } 83 }
80 84
81 std::string RunScriptExtractString(const std::string& script) { 85 std::string RunScriptExtractString(const std::string& script) {
82 std::string data; 86 std::string data;
83 EXPECT_TRUE(ExecuteScriptAndExtractString(shell(), script, &data)); 87 EXPECT_TRUE(ExecuteScriptAndExtractString(shell(), script, &data));
84 return data; 88 return data;
85 } 89 }
86 90
87 bool RunScriptExtractBool(const std::string& script) { 91 bool RunScriptExtractBool(const std::string& script) {
88 bool data; 92 bool data;
89 EXPECT_TRUE(ExecuteScriptAndExtractBool(shell(), script, &data)); 93 EXPECT_TRUE(ExecuteScriptAndExtractBool(shell(), script, &data));
90 return data; 94 return data;
91 } 95 }
92 96
93 double RunScriptExtractDouble(const std::string& script) { 97 double RunScriptExtractDouble(const std::string& script) {
94 double data = 0.0; 98 double data = 0.0;
95 EXPECT_TRUE(base::StringToDouble(RunScriptExtractString(script), &data)); 99 EXPECT_TRUE(base::StringToDouble(RunScriptExtractString(script), &data));
96 return data; 100 return data;
97 } 101 }
102
103 net::TestNetworkQualityEstimator* estimator() { return estimator_.get(); }
104
105 private:
106 std::unique_ptr<net::TestNetworkQualityEstimator> estimator_;
107 std::unique_ptr<NetworkQualityObserverImpl> impl_;
98 }; 108 };
99 109
100 // Make sure the type is correct when the page is first opened. 110 // Make sure the type is correct when the page is first opened.
101 IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, VerifyNetworkStateInitialized) { 111 IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, VerifyNetworkStateInitialized) {
102 SetConnectionType(net::NetworkChangeNotifier::CONNECTION_ETHERNET, 112 SetConnectionType(net::NetworkChangeNotifier::CONNECTION_ETHERNET,
103 net::NetworkChangeNotifier::SUBTYPE_GIGABIT_ETHERNET); 113 net::NetworkChangeNotifier::SUBTYPE_GIGABIT_ETHERNET);
104 NavigateToURL(shell(), content::GetTestUrl("", "net_info.html")); 114 NavigateToURL(shell(), content::GetTestUrl("", "net_info.html"));
105 EXPECT_TRUE(RunScriptExtractBool("getOnLine()")); 115 EXPECT_TRUE(RunScriptExtractBool("getOnLine()"));
106 EXPECT_EQ("ethernet", RunScriptExtractString("getType()")); 116 EXPECT_EQ("ethernet", RunScriptExtractString("getType()"));
107 EXPECT_EQ(net::NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype( 117 EXPECT_EQ(net::NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 EXPECT_FALSE(RunScriptExtractBool("getOnLine()")); 166 EXPECT_FALSE(RunScriptExtractBool("getOnLine()"));
157 167
158 // Open the same page in a new window on the same process. 168 // Open the same page in a new window on the same process.
159 EXPECT_TRUE(ExecuteScript(shell(), "window.open(\"net_info.html\")")); 169 EXPECT_TRUE(ExecuteScript(shell(), "window.open(\"net_info.html\")"));
160 170
161 // The network state should not have reinitialized to what it was when opening 171 // The network state should not have reinitialized to what it was when opening
162 // the first window (online). 172 // the first window (online).
163 EXPECT_FALSE(RunScriptExtractBool("getOnLine()")); 173 EXPECT_FALSE(RunScriptExtractBool("getOnLine()"));
164 } 174 }
165 175
166 // Verify that when the network quality notifications are not sent, the
167 // Javascript API returns invalid estimate.
168 IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest,
169 NetworkQualityEstimatorNotInitialized) {
170 base::HistogramTester histogram_tester;
171 net::TestNetworkQualityEstimator estimator(
172 nullptr, std::map<std::string, std::string>(), false, false, true, true,
173 base::MakeUnique<net::BoundTestNetLog>());
174 NetworkQualityObserverImpl impl(&estimator);
175
176 EXPECT_TRUE(embedded_test_server()->Start());
177 EXPECT_TRUE(
178 NavigateToURL(shell(), embedded_test_server()->GetURL("/net_info.html")));
179
180 EXPECT_EQ(0, RunScriptExtractDouble("getRtt()"));
181 EXPECT_EQ(std::numeric_limits<double>::infinity(),
182 RunScriptExtractDouble("getDownlink()"));
183 EXPECT_EQ("4g", RunScriptExtractString("getEffectiveType()"));
184 }
185
186 // Make sure the changes in the effective connection typeare notified to the 176 // Make sure the changes in the effective connection typeare notified to the
187 // render thread. 177 // render thread.
188 IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, 178 IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest,
189 EffectiveConnectionTypeChangeNotfied) { 179 EffectiveConnectionTypeChangeNotfied) {
190 base::HistogramTester histogram_tester; 180 base::HistogramTester histogram_tester;
191 net::TestNetworkQualityEstimator estimator( 181 estimator()->SetSuppressNotificationsForTesting(true);
192 nullptr, std::map<std::string, std::string>(), false, false, true, true,
193 base::MakeUnique<net::BoundTestNetLog>());
194 NetworkQualityObserverImpl impl(&estimator);
195 182
196 net::nqe::internal::NetworkQuality network_quality_1( 183 net::nqe::internal::NetworkQuality network_quality_1(
197 base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(2), 300); 184 base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(2), 300);
198 estimator.NotifyObserversOfRTTOrThroughputEstimatesComputed( 185 estimator()->NotifyObserversOfRTTOrThroughputEstimatesComputed(
199 network_quality_1); 186 network_quality_1);
200 187
201 EXPECT_TRUE(embedded_test_server()->Start()); 188 EXPECT_TRUE(embedded_test_server()->Start());
202 EXPECT_TRUE( 189 EXPECT_TRUE(
203 NavigateToURL(shell(), embedded_test_server()->GetURL("/net_info.html"))); 190 NavigateToURL(shell(), embedded_test_server()->GetURL("/net_info.html")));
204 191
205 FetchHistogramsFromChildProcesses(); 192 FetchHistogramsFromChildProcesses();
206 193
207 int samples = 194 int samples =
208 GetTotalSampleCount(&histogram_tester, "NQE.RenderThreadNotified"); 195 GetTotalSampleCount(&histogram_tester, "NQE.RenderThreadNotified");
209 EXPECT_LT(0, samples); 196 EXPECT_LT(0, samples);
210 197
211 // Change effective connection type so that the renderer process is notified. 198 // Change effective connection type so that the renderer process is notified.
212 // Changing the effective connection type from 2G to 3G is guaranteed to 199 // Changing the effective connection type from 2G to 3G is guaranteed to
213 // generate the notification to the renderers, irrespective of the current 200 // generate the notification to the renderers, irrespective of the current
214 // effective connection type. 201 // effective connection type.
215 estimator.NotifyObserversOfEffectiveConnectionType( 202 estimator()->NotifyObserversOfEffectiveConnectionType(
216 net::EFFECTIVE_CONNECTION_TYPE_2G); 203 net::EFFECTIVE_CONNECTION_TYPE_2G);
217 base::RunLoop().RunUntilIdle(); 204 base::RunLoop().RunUntilIdle();
218 EXPECT_EQ("2g", RunScriptExtractString("getEffectiveType()")); 205 EXPECT_EQ("2g", RunScriptExtractString("getEffectiveType()"));
219 estimator.NotifyObserversOfEffectiveConnectionType( 206 estimator()->NotifyObserversOfEffectiveConnectionType(
220 net::EFFECTIVE_CONNECTION_TYPE_3G); 207 net::EFFECTIVE_CONNECTION_TYPE_3G);
221 base::RunLoop().RunUntilIdle(); 208 base::RunLoop().RunUntilIdle();
222 EXPECT_EQ("3g", RunScriptExtractString("getEffectiveType()")); 209 EXPECT_EQ("3g", RunScriptExtractString("getEffectiveType()"));
223 FetchHistogramsFromChildProcesses(); 210 FetchHistogramsFromChildProcesses();
224 base::RunLoop().RunUntilIdle(); 211 base::RunLoop().RunUntilIdle();
225 EXPECT_GT(GetTotalSampleCount(&histogram_tester, "NQE.RenderThreadNotified"), 212 EXPECT_GT(GetTotalSampleCount(&histogram_tester, "NQE.RenderThreadNotified"),
226 samples); 213 samples);
227 } 214 }
228 215
229 // Make sure the changes in the network quality are notified to the render 216 // Make sure the changes in the network quality are notified to the render
230 // thread, and the changed network quality is accessible via Javascript API. 217 // thread, and the changed network quality is accessible via Javascript API.
231 IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, NetworkQualityChangeNotified) { 218 IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, NetworkQualityChangeNotified) {
232 base::HistogramTester histogram_tester; 219 base::HistogramTester histogram_tester;
233 net::TestNetworkQualityEstimator estimator( 220 estimator()->SetSuppressNotificationsForTesting(true);
234 nullptr, std::map<std::string, std::string>(), false, false, true, true,
235 base::MakeUnique<net::BoundTestNetLog>());
236 NetworkQualityObserverImpl impl(&estimator);
237 221
238 net::nqe::internal::NetworkQuality network_quality_1( 222 net::nqe::internal::NetworkQuality network_quality_1(
239 base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(2), 300); 223 base::TimeDelta::FromSeconds(1), base::TimeDelta::FromSeconds(2), 300);
240 estimator.NotifyObserversOfRTTOrThroughputEstimatesComputed( 224 estimator()->NotifyObserversOfRTTOrThroughputEstimatesComputed(
241 network_quality_1); 225 network_quality_1);
242 226
243 EXPECT_TRUE(embedded_test_server()->Start()); 227 EXPECT_TRUE(embedded_test_server()->Start());
244 EXPECT_TRUE( 228 EXPECT_TRUE(
245 NavigateToURL(shell(), embedded_test_server()->GetURL("/net_info.html"))); 229 NavigateToURL(shell(), embedded_test_server()->GetURL("/net_info.html")));
246 230
247 FetchHistogramsFromChildProcesses(); 231 FetchHistogramsFromChildProcesses();
248 EXPECT_FALSE( 232 EXPECT_FALSE(
249 histogram_tester.GetAllSamples("NQE.RenderThreadNotified").empty()); 233 histogram_tester.GetAllSamples("NQE.RenderThreadNotified").empty());
250 234
251 EXPECT_EQ(network_quality_1.transport_rtt().InMilliseconds(), 235 EXPECT_EQ(network_quality_1.transport_rtt().InMilliseconds(),
252 RunScriptExtractDouble("getRtt()")); 236 RunScriptExtractDouble("getRtt()"));
253 EXPECT_EQ( 237 EXPECT_EQ(
254 static_cast<double>(network_quality_1.downstream_throughput_kbps()) / 238 static_cast<double>(network_quality_1.downstream_throughput_kbps()) /
255 1000, 239 1000,
256 RunScriptExtractDouble("getDownlink()")); 240 RunScriptExtractDouble("getDownlink()"));
257 241
258 // Verify that the network quality change is accessible via Javascript API. 242 // Verify that the network quality change is accessible via Javascript API.
259 net::nqe::internal::NetworkQuality network_quality_2( 243 net::nqe::internal::NetworkQuality network_quality_2(
260 base::TimeDelta::FromSeconds(10), base::TimeDelta::FromSeconds(20), 3000); 244 base::TimeDelta::FromSeconds(10), base::TimeDelta::FromSeconds(20), 3000);
261 estimator.NotifyObserversOfRTTOrThroughputEstimatesComputed( 245 estimator()->NotifyObserversOfRTTOrThroughputEstimatesComputed(
262 network_quality_2); 246 network_quality_2);
263 base::RunLoop().RunUntilIdle(); 247 base::RunLoop().RunUntilIdle();
264 EXPECT_EQ(network_quality_2.transport_rtt().InMilliseconds(), 248 EXPECT_EQ(network_quality_2.transport_rtt().InMilliseconds(),
265 RunScriptExtractDouble("getRtt()")); 249 RunScriptExtractDouble("getRtt()"));
266 EXPECT_EQ( 250 EXPECT_EQ(
267 static_cast<double>(network_quality_2.downstream_throughput_kbps()) / 251 static_cast<double>(network_quality_2.downstream_throughput_kbps()) /
268 1000, 252 1000,
269 RunScriptExtractDouble("getDownlink()")); 253 RunScriptExtractDouble("getDownlink()"));
270 } 254 }
271 255
272 // Make sure the changes in the network quality are rounded to the nearest 256 // Make sure the changes in the network quality are rounded to the nearest
273 // 25 milliseconds or 25 kbps. 257 // 25 milliseconds or 25 kbps.
274 IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, NetworkQualityChangeRounded) { 258 IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, NetworkQualityChangeRounded) {
275 base::HistogramTester histogram_tester; 259 base::HistogramTester histogram_tester;
276 net::TestNetworkQualityEstimator estimator( 260 estimator()->SetSuppressNotificationsForTesting(true);
277 std::unique_ptr<net::ExternalEstimateProvider>(),
278 std::map<std::string, std::string>(), false, false, true, true,
279 base::MakeUnique<net::BoundTestNetLog>());
280 NetworkQualityObserverImpl impl(&estimator);
281 261
282 // Verify that the network quality is rounded properly. 262 // Verify that the network quality is rounded properly.
283 net::nqe::internal::NetworkQuality network_quality_1( 263 net::nqe::internal::NetworkQuality network_quality_1(
284 base::TimeDelta::FromMilliseconds(123), 264 base::TimeDelta::FromMilliseconds(123),
285 base::TimeDelta::FromMilliseconds(212), 303); 265 base::TimeDelta::FromMilliseconds(212), 303);
286 estimator.NotifyObserversOfRTTOrThroughputEstimatesComputed( 266 estimator()->NotifyObserversOfRTTOrThroughputEstimatesComputed(
287 network_quality_1); 267 network_quality_1);
288 268
289 EXPECT_TRUE(embedded_test_server()->Start()); 269 EXPECT_TRUE(embedded_test_server()->Start());
290 EXPECT_TRUE( 270 EXPECT_TRUE(
291 NavigateToURL(shell(), embedded_test_server()->GetURL("/net_info.html"))); 271 NavigateToURL(shell(), embedded_test_server()->GetURL("/net_info.html")));
292 EXPECT_EQ(200, RunScriptExtractDouble("getRtt()")); 272 EXPECT_EQ(200, RunScriptExtractDouble("getRtt()"));
293 EXPECT_EQ(0.300, RunScriptExtractDouble("getDownlink()")); 273 EXPECT_EQ(0.300, RunScriptExtractDouble("getDownlink()"));
294 274
295 net::nqe::internal::NetworkQuality network_quality_2( 275 net::nqe::internal::NetworkQuality network_quality_2(
296 base::TimeDelta::FromMilliseconds(123), 276 base::TimeDelta::FromMilliseconds(123),
297 base::TimeDelta::FromMilliseconds(1217), 1317); 277 base::TimeDelta::FromMilliseconds(1217), 1317);
298 estimator.NotifyObserversOfRTTOrThroughputEstimatesComputed( 278 estimator()->NotifyObserversOfRTTOrThroughputEstimatesComputed(
299 network_quality_2); 279 network_quality_2);
300 base::RunLoop().RunUntilIdle(); 280 base::RunLoop().RunUntilIdle();
301 EXPECT_EQ(1225, RunScriptExtractDouble("getRtt()")); 281 EXPECT_EQ(1225, RunScriptExtractDouble("getRtt()"));
302 EXPECT_EQ(1.325, RunScriptExtractDouble("getDownlink()")); 282 EXPECT_EQ(1.325, RunScriptExtractDouble("getDownlink()"));
303 283
304 net::nqe::internal::NetworkQuality network_quality_3( 284 net::nqe::internal::NetworkQuality network_quality_3(
305 base::TimeDelta::FromMilliseconds(12), 285 base::TimeDelta::FromMilliseconds(12),
306 base::TimeDelta::FromMilliseconds(12), 12); 286 base::TimeDelta::FromMilliseconds(12), 12);
307 estimator.NotifyObserversOfRTTOrThroughputEstimatesComputed( 287 estimator()->NotifyObserversOfRTTOrThroughputEstimatesComputed(
308 network_quality_3); 288 network_quality_3);
309 base::RunLoop().RunUntilIdle(); 289 base::RunLoop().RunUntilIdle();
310 EXPECT_EQ(0, RunScriptExtractDouble("getRtt()")); 290 EXPECT_EQ(0, RunScriptExtractDouble("getRtt()"));
311 EXPECT_EQ(0, RunScriptExtractDouble("getDownlink()")); 291 EXPECT_EQ(0, RunScriptExtractDouble("getDownlink()"));
312 } 292 }
313 293
314 // Make sure the minor changes (<10%) in the network quality are not notified. 294 // Make sure the minor changes (<10%) in the network quality are not notified.
315 IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, NetworkQualityChangeNotNotified) { 295 IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, NetworkQualityChangeNotNotified) {
316 base::HistogramTester histogram_tester; 296 base::HistogramTester histogram_tester;
317 net::TestNetworkQualityEstimator estimator( 297 estimator()->SetSuppressNotificationsForTesting(true);
318 nullptr, std::map<std::string, std::string>(), false, false, true, true,
319 base::MakeUnique<net::BoundTestNetLog>());
320 NetworkQualityObserverImpl impl(&estimator);
321 298
322 // Verify that the network quality is rounded properly. 299 // Verify that the network quality is rounded properly.
323 net::nqe::internal::NetworkQuality network_quality_1( 300 net::nqe::internal::NetworkQuality network_quality_1(
324 base::TimeDelta::FromMilliseconds(1123), 301 base::TimeDelta::FromMilliseconds(1123),
325 base::TimeDelta::FromMilliseconds(1212), 1303); 302 base::TimeDelta::FromMilliseconds(1212), 1303);
326 estimator.NotifyObserversOfRTTOrThroughputEstimatesComputed( 303 estimator()->NotifyObserversOfRTTOrThroughputEstimatesComputed(
327 network_quality_1); 304 network_quality_1);
328 305
329 EXPECT_TRUE(embedded_test_server()->Start()); 306 EXPECT_TRUE(embedded_test_server()->Start());
330 EXPECT_TRUE( 307 EXPECT_TRUE(
331 NavigateToURL(shell(), embedded_test_server()->GetURL("/net_info.html"))); 308 NavigateToURL(shell(), embedded_test_server()->GetURL("/net_info.html")));
332 EXPECT_EQ(1200, RunScriptExtractDouble("getRtt()")); 309 EXPECT_EQ(1200, RunScriptExtractDouble("getRtt()"));
333 EXPECT_EQ(1.300, RunScriptExtractDouble("getDownlink()")); 310 EXPECT_EQ(1.300, RunScriptExtractDouble("getDownlink()"));
334 311
335 // All the 3 metrics change by less than 10%. So, the observers are not 312 // All the 3 metrics change by less than 10%. So, the observers are not
336 // notified. 313 // notified.
337 net::nqe::internal::NetworkQuality network_quality_2( 314 net::nqe::internal::NetworkQuality network_quality_2(
338 base::TimeDelta::FromMilliseconds(1223), 315 base::TimeDelta::FromMilliseconds(1223),
339 base::TimeDelta::FromMilliseconds(1312), 1403); 316 base::TimeDelta::FromMilliseconds(1312), 1403);
340 estimator.NotifyObserversOfRTTOrThroughputEstimatesComputed( 317 estimator()->NotifyObserversOfRTTOrThroughputEstimatesComputed(
341 network_quality_2); 318 network_quality_2);
342 base::RunLoop().RunUntilIdle(); 319 base::RunLoop().RunUntilIdle();
343 EXPECT_EQ(1200, RunScriptExtractDouble("getRtt()")); 320 EXPECT_EQ(1200, RunScriptExtractDouble("getRtt()"));
344 EXPECT_EQ(1.300, RunScriptExtractDouble("getDownlink()")); 321 EXPECT_EQ(1.300, RunScriptExtractDouble("getDownlink()"));
345 322
346 // Transport RTT has changed by more than 10% from the last notified value of 323 // Transport RTT has changed by more than 10% from the last notified value of
347 // |network_quality_1|. The observers should be notified. 324 // |network_quality_1|. The observers should be notified.
348 net::nqe::internal::NetworkQuality network_quality_3( 325 net::nqe::internal::NetworkQuality network_quality_3(
349 base::TimeDelta::FromMilliseconds(1223), 326 base::TimeDelta::FromMilliseconds(1223),
350 base::TimeDelta::FromMilliseconds(2312), 1403); 327 base::TimeDelta::FromMilliseconds(2312), 1403);
351 estimator.NotifyObserversOfRTTOrThroughputEstimatesComputed( 328 estimator()->NotifyObserversOfRTTOrThroughputEstimatesComputed(
352 network_quality_3); 329 network_quality_3);
353 base::RunLoop().RunUntilIdle(); 330 base::RunLoop().RunUntilIdle();
354 EXPECT_EQ(2300, RunScriptExtractDouble("getRtt()")); 331 EXPECT_EQ(2300, RunScriptExtractDouble("getRtt()"));
355 EXPECT_EQ(1.400, RunScriptExtractDouble("getDownlink()")); 332 EXPECT_EQ(1.400, RunScriptExtractDouble("getDownlink()"));
356 } 333 }
357 334
358 } // namespace content 335 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698