OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "net/proxy/proxy_resolver_v8_tracing.h" | 5 #include "net/proxy/proxy_resolver_v8_tracing.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
14 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
15 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 136 |
136 scoped_ptr<ProxyResolverV8Tracing> CreateResolver( | 137 scoped_ptr<ProxyResolverV8Tracing> CreateResolver( |
137 scoped_ptr<ProxyResolverV8Tracing::Bindings> bindings, | 138 scoped_ptr<ProxyResolverV8Tracing::Bindings> bindings, |
138 const char* filename) { | 139 const char* filename) { |
139 scoped_ptr<ProxyResolverV8Tracing> resolver; | 140 scoped_ptr<ProxyResolverV8Tracing> resolver; |
140 scoped_ptr<ProxyResolverV8TracingFactory> factory( | 141 scoped_ptr<ProxyResolverV8TracingFactory> factory( |
141 ProxyResolverV8TracingFactory::Create()); | 142 ProxyResolverV8TracingFactory::Create()); |
142 TestCompletionCallback callback; | 143 TestCompletionCallback callback; |
143 scoped_ptr<ProxyResolverFactory::Request> request; | 144 scoped_ptr<ProxyResolverFactory::Request> request; |
144 factory->CreateProxyResolverV8Tracing(LoadScriptData(filename), | 145 factory->CreateProxyResolverV8Tracing(LoadScriptData(filename), |
145 bindings.Pass(), &resolver, | 146 std::move(bindings), &resolver, |
146 callback.callback(), &request); | 147 callback.callback(), &request); |
147 EXPECT_EQ(OK, callback.WaitForResult()); | 148 EXPECT_EQ(OK, callback.WaitForResult()); |
148 EXPECT_TRUE(resolver); | 149 EXPECT_TRUE(resolver); |
149 return resolver.Pass(); | 150 return resolver; |
150 } | 151 } |
151 | 152 |
152 TEST_F(ProxyResolverV8TracingTest, Simple) { | 153 TEST_F(ProxyResolverV8TracingTest, Simple) { |
153 MockCachingHostResolver host_resolver; | 154 MockCachingHostResolver host_resolver; |
154 MockBindings mock_bindings(&host_resolver); | 155 MockBindings mock_bindings(&host_resolver); |
155 | 156 |
156 scoped_ptr<ProxyResolverV8Tracing> resolver = | 157 scoped_ptr<ProxyResolverV8Tracing> resolver = |
157 CreateResolver(mock_bindings.CreateBindings(), "simple.js"); | 158 CreateResolver(mock_bindings.CreateBindings(), "simple.js"); |
158 | 159 |
159 TestCompletionCallback callback; | 160 TestCompletionCallback callback; |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 proxy_uri.substr(0, proxy_uri.find(':') + 1)); | 1015 proxy_uri.substr(0, proxy_uri.find(':') + 1)); |
1015 } else { | 1016 } else { |
1016 NOTREACHED(); | 1017 NOTREACHED(); |
1017 } | 1018 } |
1018 } | 1019 } |
1019 } | 1020 } |
1020 | 1021 |
1021 } // namespace | 1022 } // namespace |
1022 | 1023 |
1023 } // namespace net | 1024 } // namespace net |
OLD | NEW |