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

Unified Diff: net/proxy/test_mojo_proxy_resolver_factory.h

Issue 2881613002: Allow use of Mojo/V8 ProxyResolvers with URLRequestContextBuilder. (Closed)
Patch Set: Missed some ENABLE_MOJOs 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/test_mojo_proxy_resolver_factory.h
diff --git a/net/proxy/test_mojo_proxy_resolver_factory.h b/net/proxy/test_mojo_proxy_resolver_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..7be0be4394c97a84afa75fb2662a84c879eae498
--- /dev/null
+++ b/net/proxy/test_mojo_proxy_resolver_factory.h
@@ -0,0 +1,52 @@
+// 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 NET_PROXY_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
+#define NET_PROXY_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "base/memory/singleton.h"
+#include "net/proxy/mojo_proxy_resolver_factory.h"
+
+namespace net {
+
+// MojoProxyResolverFactory that runs PAC scripts in-process, for tests.
+class TestMojoProxyResolverFactory : public MojoProxyResolverFactory {
+ public:
+ static TestMojoProxyResolverFactory* GetInstance();
+
+ // Returns true if CreateResolver was called.
+ bool resolver_created() { return resolver_created_; }
+
+ // Sets the value returned by resolver_created. Since this is a singleton,
+ // Serves to avoid with test fixture reuse.
+ void set_resolver_created(bool resolver_created) {
+ resolver_created_ = resolver_created;
+ }
+
+ // Overridden from MojoProxyResolverFactory:
+ std::unique_ptr<base::ScopedClosureRunner> CreateResolver(
+ const std::string& pac_script,
+ mojo::InterfaceRequest<interfaces::ProxyResolver> req,
+ interfaces::ProxyResolverFactoryRequestClientPtr client) override;
+
+ private:
+ TestMojoProxyResolverFactory();
+ ~TestMojoProxyResolverFactory() override;
+
+ friend struct base::DefaultSingletonTraits<TestMojoProxyResolverFactory>;
+
+ interfaces::ProxyResolverFactoryPtr factory_;
+
+ bool resolver_created_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(TestMojoProxyResolverFactory);
+};
+
+} // namespace net
+
+#endif // NET_PROXY_TEST_MOJO_PROXY_RESOLVER_FACTORY_H_
« 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