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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 1164713004: Store network quality samples so we can compute percentiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added RingBuffer class Created 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #endif 10 #endif
(...skipping 4086 matching lines...) Expand 10 before | Expand all | Expand 10 after
4097 scoped_ptr<URLRequest> r( 4097 scoped_ptr<URLRequest> r(
4098 context.CreateRequest(test_server_.GetURL(url), DEFAULT_PRIORITY, &d)); 4098 context.CreateRequest(test_server_.GetURL(url), DEFAULT_PRIORITY, &d));
4099 int sleep_duration_milliseconds = 1; 4099 int sleep_duration_milliseconds = 1;
4100 base::PlatformThread::Sleep( 4100 base::PlatformThread::Sleep(
4101 base::TimeDelta::FromMilliseconds(sleep_duration_milliseconds)); 4101 base::TimeDelta::FromMilliseconds(sleep_duration_milliseconds));
4102 r->Start(); 4102 r->Start();
4103 4103
4104 base::RunLoop().Run(); 4104 base::RunLoop().Run();
4105 4105
4106 NetworkQuality network_quality = 4106 NetworkQuality network_quality =
4107 context.network_quality_estimator()->GetEstimate(); 4107 context.network_quality_estimator()->GetPeakEstimate();
4108 EXPECT_GE(network_quality.fastest_rtt, 4108 EXPECT_GE(network_quality.rtt,
4109 base::TimeDelta::FromMilliseconds(sleep_duration_milliseconds)); 4109 base::TimeDelta::FromMilliseconds(sleep_duration_milliseconds));
4110 EXPECT_GT(network_quality.fastest_rtt_confidence, 0); 4110 EXPECT_GT(network_quality.rtt_confidence, 0);
4111 EXPECT_GT(network_quality.peak_throughput_kbps, uint64_t(0)); 4111 EXPECT_GT(network_quality.throughput_kbps, uint64_t(0));
4112 EXPECT_GT(network_quality.peak_throughput_kbps_confidence, 0); 4112 EXPECT_GT(network_quality.throughput_kbps_confidence, 0);
4113 4113
4114 // Verify that histograms are not populated. They should populate only when 4114 // Verify that histograms are not populated. They should populate only when
4115 // there is a change in ConnectionType. 4115 // there is a change in ConnectionType.
4116 base::HistogramTester histogram_tester; 4116 base::HistogramTester histogram_tester;
4117 histogram_tester.ExpectTotalCount("NQE.PeakKbps.Unknown", 0); 4117 histogram_tester.ExpectTotalCount("NQE.PeakKbps.Unknown", 0);
4118 histogram_tester.ExpectTotalCount("NQE.FastestRTT.Unknown", 0); 4118 histogram_tester.ExpectTotalCount("NQE.FastestRTT.Unknown", 0);
4119 4119
4120 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChangeForTests( 4120 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChangeForTests(
4121 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI); 4121 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI);
4122 base::MessageLoop::current()->RunUntilIdle(); 4122 base::MessageLoop::current()->RunUntilIdle();
(...skipping 5122 matching lines...) Expand 10 before | Expand all | Expand 10 after
9245 GURL("http://test_intercept/foo"), DEFAULT_PRIORITY, &d)); 9245 GURL("http://test_intercept/foo"), DEFAULT_PRIORITY, &d));
9246 9246
9247 EXPECT_FALSE(req->response_info().network_accessed); 9247 EXPECT_FALSE(req->response_info().network_accessed);
9248 9248
9249 req->Start(); 9249 req->Start();
9250 base::RunLoop().Run(); 9250 base::RunLoop().Run();
9251 EXPECT_TRUE(req->response_info().network_accessed); 9251 EXPECT_TRUE(req->response_info().network_accessed);
9252 } 9252 }
9253 9253
9254 } // namespace net 9254 } // namespace net
OLDNEW
« net/base/network_quality_estimator.cc ('K') | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698