OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/base/net_log.h" | 10 #include "net/base/net_log.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const Rules::Rule& rule = rules_->GetRuleByUrl(url); | 100 const Rules::Rule& rule = rules_->GetRuleByUrl(url); |
101 int rv = rule.fetch_error; | 101 int rv = rule.fetch_error; |
102 EXPECT_NE(ERR_UNEXPECTED, rv); | 102 EXPECT_NE(ERR_UNEXPECTED, rv); |
103 if (rv == OK) | 103 if (rv == OK) |
104 *text = rule.text(); | 104 *text = rule.text(); |
105 return rv; | 105 return rv; |
106 } | 106 } |
107 | 107 |
108 virtual void Cancel() {} | 108 virtual void Cancel() {} |
109 | 109 |
| 110 virtual URLRequestContext* GetRequestContext() { return NULL; } |
| 111 |
110 private: | 112 private: |
111 const Rules* rules_; | 113 const Rules* rules_; |
112 }; | 114 }; |
113 | 115 |
114 class RuleBasedProxyResolver : public ProxyResolver { | 116 class RuleBasedProxyResolver : public ProxyResolver { |
115 public: | 117 public: |
116 RuleBasedProxyResolver(const Rules* rules, bool expects_pac_bytes) | 118 RuleBasedProxyResolver(const Rules* rules, bool expects_pac_bytes) |
117 : ProxyResolver(expects_pac_bytes), rules_(rules) {} | 119 : ProxyResolver(expects_pac_bytes), rules_(rules) {} |
118 | 120 |
119 // ProxyResolver implementation: | 121 // ProxyResolver implementation: |
120 virtual int GetProxyForURL(const GURL& /*url*/, | 122 virtual int GetProxyForURL(const GURL& /*url*/, |
121 ProxyInfo* /*results*/, | 123 ProxyInfo* /*results*/, |
122 CompletionCallback* /*callback*/, | 124 CompletionCallback* /*callback*/, |
123 RequestHandle* /*request_handle*/, | 125 RequestHandle* /*request_handle*/, |
124 const BoundNetLog& /*net_log*/) { | 126 const BoundNetLog& /*net_log*/) { |
125 NOTREACHED(); | 127 NOTREACHED(); |
126 return ERR_UNEXPECTED; | 128 return ERR_UNEXPECTED; |
127 } | 129 } |
128 | 130 |
129 virtual void CancelRequest(RequestHandle request_handle) { | 131 virtual void CancelRequest(RequestHandle request_handle) { |
130 NOTREACHED(); | 132 NOTREACHED(); |
131 } | 133 } |
132 | 134 |
| 135 virtual void CancelSetPacScript() { |
| 136 NOTREACHED(); |
| 137 } |
| 138 |
133 virtual int SetPacScript( | 139 virtual int SetPacScript( |
134 const scoped_refptr<ProxyResolverScriptData>& script_data, | 140 const scoped_refptr<ProxyResolverScriptData>& script_data, |
135 CompletionCallback* callback) { | 141 CompletionCallback* callback) { |
136 | 142 |
137 const GURL url = | 143 const GURL url = |
138 script_data->type() == ProxyResolverScriptData::TYPE_SCRIPT_URL ? | 144 script_data->type() == ProxyResolverScriptData::TYPE_SCRIPT_URL ? |
139 script_data->url() : GURL(); | 145 script_data->url() : GURL(); |
140 | 146 |
141 const Rules::Rule& rule = expects_pac_bytes() ? | 147 const Rules::Rule& rule = expects_pac_bytes() ? |
142 rules_->GetRuleByText(script_data->utf16()) : | 148 rules_->GetRuleByText(script_data->utf16()) : |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 EXPECT_TRUE(LogContainsBeginEvent( | 502 EXPECT_TRUE(LogContainsBeginEvent( |
497 entries, 1, NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT)); | 503 entries, 1, NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT)); |
498 EXPECT_TRUE(LogContainsEndEvent( | 504 EXPECT_TRUE(LogContainsEndEvent( |
499 entries, 2, NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT)); | 505 entries, 2, NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT)); |
500 EXPECT_TRUE(LogContainsEndEvent( | 506 EXPECT_TRUE(LogContainsEndEvent( |
501 entries, 3, NetLog::TYPE_INIT_PROXY_RESOLVER)); | 507 entries, 3, NetLog::TYPE_INIT_PROXY_RESOLVER)); |
502 } | 508 } |
503 | 509 |
504 } // namespace | 510 } // namespace |
505 } // namespace net | 511 } // namespace net |
OLD | NEW |