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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/test/scoped_task_environment.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" | 13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" |
13 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_serve
r.h" | 14 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_serve
r.h" |
14 #include "net/proxy/proxy_server.h" | 15 #include "net/proxy/proxy_server.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 namespace data_reduction_proxy { | 19 namespace data_reduction_proxy { |
19 | 20 |
20 class DataReductionProxyConfiguratorTest : public testing::Test { | 21 class DataReductionProxyConfiguratorTest : public testing::Test { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 config_->GetProxyConfig().proxy_rules(); | 54 config_->GetProxyConfig().proxy_rules(); |
54 ASSERT_EQ(expected_rules_type, rules.type); | 55 ASSERT_EQ(expected_rules_type, rules.type); |
55 if (net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME == | 56 if (net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME == |
56 expected_rules_type) { | 57 expected_rules_type) { |
57 ASSERT_EQ(expected_http_proxies, rules.proxies_for_http.ToPacString()); | 58 ASSERT_EQ(expected_http_proxies, rules.proxies_for_http.ToPacString()); |
58 ASSERT_EQ(std::string(), rules.proxies_for_https.ToPacString()); | 59 ASSERT_EQ(std::string(), rules.proxies_for_https.ToPacString()); |
59 ASSERT_EQ(expected_bypass_list, rules.bypass_rules.ToString()); | 60 ASSERT_EQ(expected_bypass_list, rules.bypass_rules.ToString()); |
60 } | 61 } |
61 } | 62 } |
62 | 63 |
63 base::MessageLoop message_loop_; | 64 base::test::ScopedTaskEnvironment scoped_task_environment_; |
64 std::unique_ptr<DataReductionProxyTestContext> test_context_; | 65 std::unique_ptr<DataReductionProxyTestContext> test_context_; |
65 std::unique_ptr<DataReductionProxyConfigurator> config_; | 66 std::unique_ptr<DataReductionProxyConfigurator> config_; |
66 }; | 67 }; |
67 | 68 |
68 TEST_F(DataReductionProxyConfiguratorTest, TestUnrestricted) { | 69 TEST_F(DataReductionProxyConfiguratorTest, TestUnrestricted) { |
69 config_->Enable(false, BuildProxyList("https://www.foo.com:443", | 70 config_->Enable(false, BuildProxyList("https://www.foo.com:443", |
70 "http://www.bar.com:80")); | 71 "http://www.bar.com:80")); |
71 CheckProxyConfig(net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, | 72 CheckProxyConfig(net::ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME, |
72 "HTTPS www.foo.com:443;PROXY www.bar.com:80;DIRECT", | 73 "HTTPS www.foo.com:443;PROXY www.bar.com:80;DIRECT", |
73 std::string()); | 74 std::string()); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 "fefe:13::abc/33", | 148 "fefe:13::abc/33", |
148 }; | 149 }; |
149 | 150 |
150 ASSERT_EQ(arraysize(expected), config_->bypass_rules_.size()); | 151 ASSERT_EQ(arraysize(expected), config_->bypass_rules_.size()); |
151 int i = 0; | 152 int i = 0; |
152 for (const std::string& bypass_rule : config_->bypass_rules_) | 153 for (const std::string& bypass_rule : config_->bypass_rules_) |
153 EXPECT_EQ(expected[i++], bypass_rule); | 154 EXPECT_EQ(expected[i++], bypass_rule); |
154 } | 155 } |
155 | 156 |
156 } // namespace data_reduction_proxy | 157 } // namespace data_reduction_proxy |
OLD | NEW |