OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "device/test/usb_test_gadget.h" | 5 #include "device/test/usb_test_gadget.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 public: | 135 public: |
136 URLRequestContextGetter( | 136 URLRequestContextGetter( |
137 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner) | 137 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner) |
138 : network_task_runner_(network_task_runner) {} | 138 : network_task_runner_(network_task_runner) {} |
139 | 139 |
140 private: | 140 private: |
141 ~URLRequestContextGetter() override {} | 141 ~URLRequestContextGetter() override {} |
142 | 142 |
143 // net::URLRequestContextGetter implementation | 143 // net::URLRequestContextGetter implementation |
144 net::URLRequestContext* GetURLRequestContext() override { | 144 net::URLRequestContext* GetURLRequestContext() override { |
145 context_builder_.set_proxy_service(net::ProxyService::CreateDirect()); | 145 if (!context_) { |
146 return context_builder_.Build(); | 146 net::URLRequestContextBuilder context_builder; |
mmenke
2015/08/20 15:51:07
Erm...Wow.
| |
147 context_builder.set_proxy_service( | |
148 make_scoped_ptr(net::ProxyService::CreateDirect())); | |
149 context_ = context_builder.Build().Pass(); | |
150 } | |
151 return context_.get(); | |
147 } | 152 } |
148 | 153 |
149 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 154 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
150 const override { | 155 const override { |
151 return network_task_runner_; | 156 return network_task_runner_; |
152 } | 157 } |
153 | 158 |
154 net::URLRequestContextBuilder context_builder_; | 159 scoped_ptr<net::URLRequestContext> context_; |
155 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 160 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
156 }; | 161 }; |
157 | 162 |
158 class URLFetcherDelegate : public net::URLFetcherDelegate { | 163 class URLFetcherDelegate : public net::URLFetcherDelegate { |
159 public: | 164 public: |
160 URLFetcherDelegate() {} | 165 URLFetcherDelegate() {} |
161 ~URLFetcherDelegate() override {} | 166 ~URLFetcherDelegate() override {} |
162 | 167 |
163 void WaitForCompletion() { run_loop_.Run(); } | 168 void WaitForCompletion() { run_loop_.Run(); } |
164 | 169 |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 return false; | 607 return false; |
603 } | 608 } |
604 | 609 |
605 DeviceAddListener add_listener(usb_service_, device_address_, -1); | 610 DeviceAddListener add_listener(usb_service_, device_address_, -1); |
606 device_ = add_listener.WaitForAdd(); | 611 device_ = add_listener.WaitForAdd(); |
607 DCHECK(device_.get()); | 612 DCHECK(device_.get()); |
608 return true; | 613 return true; |
609 } | 614 } |
610 | 615 |
611 } // namespace device | 616 } // namespace device |
OLD | NEW |