Enabling tests which should be fixed by r173829.
[chromium-blink-merge.git] / net / proxy / proxy_config_service_common_unittest.h
blobdbacbab79b8c7758dfa180b260a29224369a2faa
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
3 // found in the LICENSE file.
5 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_COMMON_UNITTEST_H_
6 #define NET_PROXY_PROXY_CONFIG_SERVICE_COMMON_UNITTEST_H_
8 #include "net/proxy/proxy_config.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 // Helper functions to describe the expected value of a
12 // ProxyConfig::ProxyRules, and to check for a match.
14 namespace net {
16 // This structure contains our expectations on what values the ProxyRules
17 // should have.
18 struct ProxyRulesExpectation {
19 ProxyRulesExpectation(ProxyConfig::ProxyRules::Type type,
20 const char* single_proxy,
21 const char* proxy_for_http,
22 const char* proxy_for_https,
23 const char* proxy_for_ftp,
24 const char* fallback_proxy,
25 const char* flattened_bypass_rules,
26 bool reverse_bypass);
28 // Call this within an EXPECT_TRUE(), to assert that |rules| matches
29 // our expected values |*this|.
30 ::testing::AssertionResult Matches(
31 const ProxyConfig::ProxyRules& rules) const;
33 // Creates an expectation that the ProxyRules has no rules.
34 static ProxyRulesExpectation Empty();
36 // Creates an expectation that the ProxyRules has nothing other than
37 // the specified bypass rules.
38 static ProxyRulesExpectation EmptyWithBypass(
39 const char* flattened_bypass_rules);
41 // Creates an expectation that the ProxyRules is for a single proxy
42 // server for all schemes.
43 static ProxyRulesExpectation Single(const char* single_proxy,
44 const char* flattened_bypass_rules);
46 // Creates an expectation that the ProxyRules specifies a different
47 // proxy server for each URL scheme.
48 static ProxyRulesExpectation PerScheme(const char* proxy_http,
49 const char* proxy_https,
50 const char* proxy_ftp,
51 const char* flattened_bypass_rules);
53 // Same as above, but additionally with a SOCKS fallback.
54 static ProxyRulesExpectation PerSchemeWithSocks(
55 const char* proxy_http,
56 const char* proxy_https,
57 const char* proxy_ftp,
58 const char* fallback_proxy,
59 const char* flattened_bypass_rules);
61 // Same as PerScheme, but with the bypass rules reversed
62 static ProxyRulesExpectation PerSchemeWithBypassReversed(
63 const char* proxy_http,
64 const char* proxy_https,
65 const char* proxy_ftp,
66 const char* flattened_bypass_rules);
68 ProxyConfig::ProxyRules::Type type;
69 const char* single_proxy;
70 const char* proxy_for_http;
71 const char* proxy_for_https;
72 const char* proxy_for_ftp;
73 const char* fallback_proxy;
74 const char* flattened_bypass_rules;
75 bool reverse_bypass;
78 } // namespace net
80 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_COMMON_UNITTEST_H_