OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/run_loop.h" |
12 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" | 13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" |
13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_service_client.h" | 14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_service_client.h" |
14 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_test_utils.h" | 15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_test_utils.h" |
15 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" | 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" |
16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_inte
rceptor.h" | 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_inte
rceptor.h" |
17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_muta
ble_config_values.h" | 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_muta
ble_config_values.h" |
18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" | 19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_netw
ork_delegate.h" |
19 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
20 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 21 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
21 #include "components/data_reduction_proxy/core/browser/data_store.h" | 22 #include "components/data_reduction_proxy/core/browser/data_store.h" |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 520 |
520 void DataReductionProxyTestContext::SetDataReductionProxyEnabled(bool enabled) { | 521 void DataReductionProxyTestContext::SetDataReductionProxyEnabled(bool enabled) { |
521 simple_pref_service_->SetBoolean(kDataReductionProxyEnabled, enabled); | 522 simple_pref_service_->SetBoolean(kDataReductionProxyEnabled, enabled); |
522 } | 523 } |
523 | 524 |
524 bool DataReductionProxyTestContext::IsDataReductionProxyEnabled() const { | 525 bool DataReductionProxyTestContext::IsDataReductionProxyEnabled() const { |
525 return simple_pref_service_->GetBoolean(kDataReductionProxyEnabled); | 526 return simple_pref_service_->GetBoolean(kDataReductionProxyEnabled); |
526 } | 527 } |
527 | 528 |
528 void DataReductionProxyTestContext::RunUntilIdle() { | 529 void DataReductionProxyTestContext::RunUntilIdle() { |
529 base::MessageLoop::current()->RunUntilIdle(); | 530 base::RunLoop().RunUntilIdle(); |
530 } | 531 } |
531 | 532 |
532 void DataReductionProxyTestContext::InitSettings() { | 533 void DataReductionProxyTestContext::InitSettings() { |
533 DCHECK(test_context_flags_ & | 534 DCHECK(test_context_flags_ & |
534 DataReductionProxyTestContext::SKIP_SETTINGS_INITIALIZATION); | 535 DataReductionProxyTestContext::SKIP_SETTINGS_INITIALIZATION); |
535 InitSettingsWithoutCheck(); | 536 InitSettingsWithoutCheck(); |
536 } | 537 } |
537 | 538 |
538 void DataReductionProxyTestContext::DestroySettings() { | 539 void DataReductionProxyTestContext::DestroySettings() { |
539 // Force destruction of |DBDataOwner|, which lives on DB task runner and is | 540 // Force destruction of |DBDataOwner|, which lives on DB task runner and is |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 configurator()->GetProxyConfig().proxy_rules().Apply(kHttpUrl, &proxy_info); | 699 configurator()->GetProxyConfig().proxy_rules().Apply(kHttpUrl, &proxy_info); |
699 | 700 |
700 std::vector<net::ProxyServer> proxies_without_direct; | 701 std::vector<net::ProxyServer> proxies_without_direct; |
701 for (const net::ProxyServer& proxy : proxy_info.proxy_list().GetAll()) | 702 for (const net::ProxyServer& proxy : proxy_info.proxy_list().GetAll()) |
702 if (proxy.is_valid() && !proxy.is_direct()) | 703 if (proxy.is_valid() && !proxy.is_direct()) |
703 proxies_without_direct.push_back(proxy); | 704 proxies_without_direct.push_back(proxy); |
704 return proxies_without_direct; | 705 return proxies_without_direct; |
705 } | 706 } |
706 | 707 |
707 } // namespace data_reduction_proxy | 708 } // namespace data_reduction_proxy |
OLD | NEW |