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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 UsbTestGadgetImpl::UsbTestGadgetImpl() { | 149 UsbTestGadgetImpl::UsbTestGadgetImpl() { |
150 net::URLRequestContextBuilder context_builder; | 150 net::URLRequestContextBuilder context_builder; |
151 context_builder.set_proxy_service(net::ProxyService::CreateDirect()); | 151 context_builder.set_proxy_service(net::ProxyService::CreateDirect()); |
152 request_context_.reset(context_builder.Build()); | 152 request_context_.reset(context_builder.Build()); |
153 | 153 |
154 base::ProcessId process_id = base::Process::Current().pid(); | 154 base::ProcessId process_id = base::Process::Current().pid(); |
155 session_id_ = base::StringPrintf( | 155 session_id_ = base::StringPrintf( |
156 "%s:%p", base::HexEncode(&process_id, sizeof(process_id)).c_str(), this); | 156 "%s:%p", base::HexEncode(&process_id, sizeof(process_id)).c_str(), this); |
157 | 157 |
158 usb_service_ = UsbService::GetInstance(); | 158 usb_service_ = UsbService::GetInstance(NULL); |
159 } | 159 } |
160 | 160 |
161 UsbTestGadgetImpl::~UsbTestGadgetImpl() { | 161 UsbTestGadgetImpl::~UsbTestGadgetImpl() { |
162 if (!device_address_.empty()) { | 162 if (!device_address_.empty()) { |
163 Unclaim(); | 163 Unclaim(); |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 UsbDevice* UsbTestGadgetImpl::GetDevice() const { | 167 UsbDevice* UsbTestGadgetImpl::GetDevice() const { |
168 return device_.get(); | 168 return device_.get(); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 } | 526 } |
527 PlatformThread::Sleep(TimeDelta::FromMilliseconds(kRetryPeriod)); | 527 PlatformThread::Sleep(TimeDelta::FromMilliseconds(kRetryPeriod)); |
528 } | 528 } |
529 VLOG(1) << "It took " << (kDisconnectRetries - retries) | 529 VLOG(1) << "It took " << (kDisconnectRetries - retries) |
530 << " retries for the device to reconnect."; | 530 << " retries for the device to reconnect."; |
531 | 531 |
532 return true; | 532 return true; |
533 } | 533 } |
534 | 534 |
535 } // namespace device | 535 } // namespace device |
OLD | NEW |