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

Side by Side Diff: device/test/usb_test_gadget_impl.cc

Issue 507503002: Remove BrowserThread dependency from usb_service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Acquire the UsbService instance through a DeviceClient implementation. Created 6 years, 3 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698