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