OLD | NEW |
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 4085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4096 scoped_ptr<URLRequest> r( | 4096 scoped_ptr<URLRequest> r( |
4097 context.CreateRequest(test_server_.GetURL(url), DEFAULT_PRIORITY, &d)); | 4097 context.CreateRequest(test_server_.GetURL(url), DEFAULT_PRIORITY, &d)); |
4098 int sleep_duration_milliseconds = 1; | 4098 int sleep_duration_milliseconds = 1; |
4099 base::PlatformThread::Sleep( | 4099 base::PlatformThread::Sleep( |
4100 base::TimeDelta::FromMilliseconds(sleep_duration_milliseconds)); | 4100 base::TimeDelta::FromMilliseconds(sleep_duration_milliseconds)); |
4101 r->Start(); | 4101 r->Start(); |
4102 | 4102 |
4103 base::RunLoop().Run(); | 4103 base::RunLoop().Run(); |
4104 | 4104 |
4105 NetworkQuality network_quality = | 4105 NetworkQuality network_quality = |
4106 context.network_quality_estimator()->GetEstimate(); | 4106 context.network_quality_estimator()->GetPeakEstimate(); |
4107 EXPECT_GE(network_quality.fastest_rtt, | 4107 EXPECT_GE(network_quality.rtt(), |
4108 base::TimeDelta::FromMilliseconds(sleep_duration_milliseconds)); | 4108 base::TimeDelta::FromMilliseconds(sleep_duration_milliseconds)); |
4109 EXPECT_GT(network_quality.fastest_rtt_confidence, 0); | 4109 EXPECT_GT(network_quality.downstream_throughput_kbps(), 0); |
4110 EXPECT_GT(network_quality.peak_throughput_kbps, uint64_t(0)); | |
4111 EXPECT_GT(network_quality.peak_throughput_kbps_confidence, 0); | |
4112 | 4110 |
4113 // Verify that histograms are not populated. They should populate only when | 4111 // Verify that histograms are not populated. They should populate only when |
4114 // there is a change in ConnectionType. | 4112 // there is a change in ConnectionType. |
4115 base::HistogramTester histogram_tester; | 4113 base::HistogramTester histogram_tester; |
4116 histogram_tester.ExpectTotalCount("NQE.PeakKbps.Unknown", 0); | 4114 histogram_tester.ExpectTotalCount("NQE.PeakKbps.Unknown", 0); |
4117 histogram_tester.ExpectTotalCount("NQE.FastestRTT.Unknown", 0); | 4115 histogram_tester.ExpectTotalCount("NQE.FastestRTT.Unknown", 0); |
4118 | 4116 |
4119 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChangeForTests( | 4117 NetworkChangeNotifier::NotifyObserversOfConnectionTypeChangeForTests( |
4120 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI); | 4118 NetworkChangeNotifier::ConnectionType::CONNECTION_WIFI); |
4121 base::MessageLoop::current()->RunUntilIdle(); | 4119 base::MessageLoop::current()->RunUntilIdle(); |
(...skipping 5058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9180 GURL("http://test_intercept/foo"), DEFAULT_PRIORITY, &d)); | 9178 GURL("http://test_intercept/foo"), DEFAULT_PRIORITY, &d)); |
9181 | 9179 |
9182 EXPECT_FALSE(req->response_info().network_accessed); | 9180 EXPECT_FALSE(req->response_info().network_accessed); |
9183 | 9181 |
9184 req->Start(); | 9182 req->Start(); |
9185 base::RunLoop().Run(); | 9183 base::RunLoop().Run(); |
9186 EXPECT_TRUE(req->response_info().network_accessed); | 9184 EXPECT_TRUE(req->response_info().network_accessed); |
9187 } | 9185 } |
9188 | 9186 |
9189 } // namespace net | 9187 } // namespace net |
OLD | NEW |