OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" | 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
11 #include "base/prefs/testing_pref_service.h" | 11 #include "base/prefs/testing_pref_service.h" |
| 12 #include "base/test/test_simple_task_runner.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 class DataReductionProxyConfigTest : public testing::Test { | 18 class DataReductionProxyConfigTest : public testing::Test { |
18 public: | 19 public: |
19 virtual void SetUp() { | 20 virtual void SetUp() { |
20 PrefRegistrySimple* registry = pref_service_.registry(); | 21 PrefRegistrySimple* registry = pref_service_.registry(); |
21 registry->RegisterDictionaryPref(prefs::kProxy); | 22 registry->RegisterDictionaryPref(prefs::kProxy); |
22 config_.reset(new DataReductionProxyChromeConfigurator(&pref_service_)); | 23 config_.reset(new DataReductionProxyChromeConfigurator( |
| 24 &pref_service_, |
| 25 new base::TestSimpleTaskRunner())); |
23 } | 26 } |
24 | 27 |
25 void CheckProxyConfig( | 28 void CheckProxyConfig( |
26 const std::string& expected_mode, | 29 const std::string& expected_mode, |
27 const std::string& expected_server, | 30 const std::string& expected_server, |
28 const std::string& expected_bypass_list) { | 31 const std::string& expected_bypass_list) { |
29 | 32 |
30 const base::DictionaryValue* dict = | 33 const base::DictionaryValue* dict = |
31 pref_service_.GetDictionary(prefs::kProxy); | 34 pref_service_.GetDictionary(prefs::kProxy); |
32 std::string mode; | 35 std::string mode; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 }; | 148 }; |
146 | 149 |
147 ASSERT_EQ(config_->bypass_rules_.size(), 6u); | 150 ASSERT_EQ(config_->bypass_rules_.size(), 6u); |
148 int i = 0; | 151 int i = 0; |
149 for (std::vector<std::string>::iterator it = config_->bypass_rules_.begin(); | 152 for (std::vector<std::string>::iterator it = config_->bypass_rules_.begin(); |
150 it != config_->bypass_rules_.end(); ++it) { | 153 it != config_->bypass_rules_.end(); ++it) { |
151 EXPECT_EQ(expected[i++], *it); | 154 EXPECT_EQ(expected[i++], *it); |
152 } | 155 } |
153 } | 156 } |
154 | 157 |
OLD | NEW |