Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: net/proxy/test_mojo_proxy_resolver_factory.h

Issue 2888043008: Revert of Allow use of Mojo/V8 ProxyResolvers with URLRequestContextBuilder. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/proxy/proxy_service_mojo_unittest.cc ('k') | net/proxy/test_mojo_proxy_resolver_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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.
4
5 #ifndef NET_PROXY_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
6 #define NET_PROXY_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "base/memory/singleton.h"
13 #include "net/proxy/mojo_proxy_resolver_factory.h"
14
15 namespace net {
16
17 // MojoProxyResolverFactory that runs PAC scripts in-process, for tests.
18 class TestMojoProxyResolverFactory : public MojoProxyResolverFactory {
19 public:
20 static TestMojoProxyResolverFactory* GetInstance();
21
22 // Returns true if CreateResolver was called.
23 bool resolver_created() { return resolver_created_; }
24
25 // Sets the value returned by resolver_created. Since this is a singleton,
26 // Serves to avoid with test fixture reuse.
27 void set_resolver_created(bool resolver_created) {
28 resolver_created_ = resolver_created;
29 }
30
31 // Overridden from MojoProxyResolverFactory:
32 std::unique_ptr<base::ScopedClosureRunner> CreateResolver(
33 const std::string& pac_script,
34 mojo::InterfaceRequest<interfaces::ProxyResolver> req,
35 interfaces::ProxyResolverFactoryRequestClientPtr client) override;
36
37 private:
38 TestMojoProxyResolverFactory();
39 ~TestMojoProxyResolverFactory() override;
40
41 friend struct base::DefaultSingletonTraits<TestMojoProxyResolverFactory>;
42
43 interfaces::ProxyResolverFactoryPtr factory_;
44
45 bool resolver_created_ = false;
46
47 DISALLOW_COPY_AND_ASSIGN(TestMojoProxyResolverFactory);
48 };
49
50 } // namespace net
51
52 #endif // NET_PROXY_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
OLDNEW
« no previous file with comments | « net/proxy/proxy_service_mojo_unittest.cc ('k') | net/proxy/test_mojo_proxy_resolver_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698