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 4086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |