| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "net/nqe/network_quality_estimator_test_util.h" | 5 #include "net/nqe/network_quality_estimator_test_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 net_log_->GetEntries(&entries); | 205 net_log_->GetEntries(&entries); |
| 206 | 206 |
| 207 int count = 0; | 207 int count = 0; |
| 208 for (const auto& entry : entries) { | 208 for (const auto& entry : entries) { |
| 209 if (entry.type == type) | 209 if (entry.type == type) |
| 210 ++count; | 210 ++count; |
| 211 } | 211 } |
| 212 return count; | 212 return count; |
| 213 } | 213 } |
| 214 | 214 |
| 215 std::string TestNetworkQualityEstimator::GetNetLogLastStringValue( |
| 216 NetLogEventType type, |
| 217 const std::string& key) const { |
| 218 std::string return_value; |
| 219 TestNetLogEntry::List entries; |
| 220 net_log_->GetEntries(&entries); |
| 221 |
| 222 for (int i = entries.size() - 1; i >= 0; --i) { |
| 223 if (entries[i].type == type && |
| 224 entries[i].GetStringValue(key, &return_value)) { |
| 225 return return_value; |
| 226 } |
| 227 } |
| 228 return return_value; |
| 229 } |
| 230 |
| 231 int TestNetworkQualityEstimator::GetNetLogLastIntegerValue( |
| 232 NetLogEventType type, |
| 233 const std::string& key) const { |
| 234 int return_value = 0; |
| 235 TestNetLogEntry::List entries; |
| 236 net_log_->GetEntries(&entries); |
| 237 |
| 238 for (int i = entries.size() - 1; i >= 0; --i) { |
| 239 if (entries[i].type == type && |
| 240 entries[i].GetIntegerValue(key, &return_value)) { |
| 241 return return_value; |
| 242 } |
| 243 } |
| 244 return return_value; |
| 245 } |
| 246 |
| 215 nqe::internal::NetworkID TestNetworkQualityEstimator::GetCurrentNetworkID() | 247 nqe::internal::NetworkID TestNetworkQualityEstimator::GetCurrentNetworkID() |
| 216 const { | 248 const { |
| 217 return nqe::internal::NetworkID(current_network_type_, current_network_id_); | 249 return nqe::internal::NetworkID(current_network_type_, current_network_id_); |
| 218 } | 250 } |
| 219 | 251 |
| 220 TestNetworkQualityEstimator::LocalHttpTestServer::LocalHttpTestServer( | 252 TestNetworkQualityEstimator::LocalHttpTestServer::LocalHttpTestServer( |
| 221 const base::FilePath& document_root) { | 253 const base::FilePath& document_root) { |
| 222 AddDefaultHandlers(document_root); | 254 AddDefaultHandlers(document_root); |
| 223 } | 255 } |
| 224 | 256 |
| 225 } // namespace net | 257 } // namespace net |
| OLD | NEW |