blob: 301f6366c92ce6dd99aee220221b0e88498317b2 (
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
51
52
53
|
// Copyright 2017 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 SERVICES_NETWORK_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
#define SERVICES_NETWORK_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
#include <memory>
#include <string>
#include "base/macros.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/proxy_resolver/proxy_resolver_factory_impl.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
namespace network {
// MojoProxyResolverFactory that runs PAC scripts in-process, for tests.
class TestMojoProxyResolverFactory
: public proxy_resolver::mojom::ProxyResolverFactory {
public:
TestMojoProxyResolverFactory();
~TestMojoProxyResolverFactory() override;
// Returns true if CreateResolver was called.
bool resolver_created() const { return resolver_created_; }
mojo::PendingRemote<proxy_resolver::mojom::ProxyResolverFactory>
CreateFactoryRemote();
// Overridden from interfaces::ProxyResolverFactory:
void CreateResolver(
const std::string& pac_script,
mojo::PendingReceiver<proxy_resolver::mojom::ProxyResolver> receiver,
mojo::PendingRemote<
proxy_resolver::mojom::ProxyResolverFactoryRequestClient> client)
override;
private:
mojo::Remote<proxy_resolver::mojom::ProxyResolverFactory> factory_;
proxy_resolver::ProxyResolverFactoryImpl proxy_resolver_factory_impl_;
mojo::Receiver<ProxyResolverFactory> receiver_{this};
bool resolver_created_ = false;
DISALLOW_COPY_AND_ASSIGN(TestMojoProxyResolverFactory);
};
} // namespace network
#endif // SERVICES_NETWORK_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
|