summaryrefslogtreecommitdiff
path: root/chromium/net/base/test_proxy_delegate.h
blob: fae7feb0531e597ef20c6f3fa17f8ad7fbe711c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_BASE_TEST_PROXY_DELEGATE_H_
#define NET_BASE_TEST_PROXY_DELEGATE_H_

#include <string>

#include "net/base/proxy_delegate.h"
#include "net/base/proxy_server.h"

class GURL;

namespace net {

class ProxyInfo;

class TestProxyDelegate : public ProxyDelegate {
 public:
  TestProxyDelegate();
  ~TestProxyDelegate() override;

  void set_trusted_spdy_proxy(const ProxyServer& proxy_server) {
    trusted_spdy_proxy_ = proxy_server;
  }

  // ProxyDelegate implementation:
  void OnResolveProxy(const GURL& url,
                      const std::string& method,
                      const ProxyRetryInfoMap& proxy_retry_info,
                      ProxyInfo* result) override;
  void OnFallback(const ProxyServer& bad_proxy, int net_error) override;

  void set_alternative_proxy_server(
      const ProxyServer& alternative_proxy_server) {
    alternative_proxy_server_ = alternative_proxy_server;
  }
  const ProxyServer& alternative_proxy_server() const {
    return alternative_proxy_server_;
  }

 private:
  ProxyServer trusted_spdy_proxy_;
  ProxyServer alternative_proxy_server_;
};

}  // namespace net

#endif  // NET_BASE_TEST_PROXY_DELEGATE_H_