| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_COMMON_UNITTEST_H_ | 5 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_COMMON_UNITTEST_H_ |
| 6 #define NET_PROXY_PROXY_CONFIG_SERVICE_COMMON_UNITTEST_H_ | 6 #define NET_PROXY_PROXY_CONFIG_SERVICE_COMMON_UNITTEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "net/proxy/proxy_config.h" | 9 #include "net/proxy/proxy_config.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 // Helper functions to describe the expected value of a | 12 // Helper functions to describe the expected value of a |
| 13 // ProxyConfig::ProxyRules, and to check for a match. | 13 // ProxyConfig::ProxyRules, and to check for a match. |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 // This structure contains our expectations on what values the ProxyRules | 17 // This structure contains our expectations on what values the ProxyRules |
| 18 // should have. | 18 // should have. |
| 19 struct ProxyRulesExpectation { | 19 struct ProxyRulesExpectation { |
| 20 ProxyRulesExpectation(ProxyConfig::ProxyRules::Type type, | 20 ProxyRulesExpectation(ProxyConfig::ProxyRules::Type type, |
| 21 const char* single_proxy, | 21 const char* single_proxy, |
| 22 const char* proxy_for_http, | 22 const char* proxy_for_http, |
| 23 const char* proxy_for_https, | 23 const char* proxy_for_https, |
| 24 const char* proxy_for_ftp, | 24 const char* proxy_for_ftp, |
| 25 const char* fallback_proxy, | 25 const char* fallback_proxy, |
| 26 const char* flattened_bypass_rules, | 26 const char* flattened_bypass_rules, |
| 27 bool reverse_bypass) | 27 bool reverse_bypass); |
| 28 : type(type), | |
| 29 single_proxy(single_proxy), | |
| 30 proxy_for_http(proxy_for_http), | |
| 31 proxy_for_https(proxy_for_https), | |
| 32 proxy_for_ftp(proxy_for_ftp), | |
| 33 fallback_proxy(fallback_proxy), | |
| 34 flattened_bypass_rules(flattened_bypass_rules), | |
| 35 reverse_bypass(reverse_bypass) { | |
| 36 } | |
| 37 | |
| 38 | 28 |
| 39 // Call this within an EXPECT_TRUE(), to assert that |rules| matches | 29 // Call this within an EXPECT_TRUE(), to assert that |rules| matches |
| 40 // our expected values |*this|. | 30 // our expected values |*this|. |
| 41 ::testing::AssertionResult Matches( | 31 ::testing::AssertionResult Matches( |
| 42 const ProxyConfig::ProxyRules& rules) const; | 32 const ProxyConfig::ProxyRules& rules) const; |
| 43 | 33 |
| 44 // Creates an expectation that the ProxyRules has no rules. | 34 // Creates an expectation that the ProxyRules has no rules. |
| 45 static ProxyRulesExpectation Empty(); | 35 static ProxyRulesExpectation Empty(); |
| 46 | 36 |
| 47 // Creates an expectation that the ProxyRules has nothing other than | 37 // Creates an expectation that the ProxyRules has nothing other than |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 const char* proxy_for_https; | 72 const char* proxy_for_https; |
| 83 const char* proxy_for_ftp; | 73 const char* proxy_for_ftp; |
| 84 const char* fallback_proxy; | 74 const char* fallback_proxy; |
| 85 const char* flattened_bypass_rules; | 75 const char* flattened_bypass_rules; |
| 86 bool reverse_bypass; | 76 bool reverse_bypass; |
| 87 }; | 77 }; |
| 88 | 78 |
| 89 } // namespace net | 79 } // namespace net |
| 90 | 80 |
| 91 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_COMMON_UNITTEST_H_ | 81 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_COMMON_UNITTEST_H_ |
| OLD | NEW |