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

Unified Diff: chrome/browser/extensions/api/usb/usb_api.cc

Issue 258783002: Extracted UsbService as interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed chromeos issue. Created 6 years, 8 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 | « chrome/browser/extensions/api/usb/usb_api.h ('k') | chrome/browser/extensions/api/usb/usb_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/usb/usb_api.cc
diff --git a/chrome/browser/extensions/api/usb/usb_api.cc b/chrome/browser/extensions/api/usb/usb_api.cc
index 2df4c20555bde3d8dd5d3c762be9828d97b06c70..94c0f8c2f07798196211d16378e3ae7f86539242 100644
--- a/chrome/browser/extensions/api/usb/usb_api.cc
+++ b/chrome/browser/extensions/api/usb/usb_api.cc
@@ -112,8 +112,6 @@ const size_t kMaxTransferLength = 100 * 1024 * 1024;
const int kMaxPackets = 4 * 1024 * 1024;
const int kMaxPacketLength = 64 * 1024;
-UsbDevice* g_device_for_test = NULL;
-
bool ConvertDirectionToApi(const UsbEndpointDirection& input,
Direction* output) {
switch (input) {
@@ -419,9 +417,6 @@ bool UsbAsyncApiFunction::Respond() {
scoped_refptr<UsbDevice>
UsbAsyncApiFunction::GetDeviceOrOrCompleteWithError(
const Device& input_device) {
- if (g_device_for_test)
- return g_device_for_test;
-
const uint16_t vendor_id = input_device.vendor_id;
const uint16_t product_id = input_device.product_id;
UsbDevicePermission::CheckParam param(
@@ -545,17 +540,6 @@ bool UsbFindDevicesFunction::Prepare() {
void UsbFindDevicesFunction::AsyncWorkStart() {
scoped_ptr<base::ListValue> result(new base::ListValue());
- if (g_device_for_test) {
- UsbDeviceResource* const resource = new UsbDeviceResource(
- extension_->id(),
- g_device_for_test->Open());
-
- result->Append(PopulateConnectionHandle(manager_->Add(resource), 0, 0));
- SetResult(result.release());
- AsyncWorkCompleted();
- return;
- }
-
const uint16_t vendor_id = parameters_->options.vendor_id;
const uint16_t product_id = parameters_->options.product_id;
int interface_id = parameters_->options.interface_id.get() ?
@@ -626,10 +610,6 @@ UsbGetDevicesFunction::UsbGetDevicesFunction() {
UsbGetDevicesFunction::~UsbGetDevicesFunction() {
}
-void UsbGetDevicesFunction::SetDeviceForTest(UsbDevice* device) {
- g_device_for_test = device;
-}
-
bool UsbGetDevicesFunction::Prepare() {
parameters_ = GetDevices::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters_.get());
@@ -639,13 +619,6 @@ bool UsbGetDevicesFunction::Prepare() {
void UsbGetDevicesFunction::AsyncWorkStart() {
scoped_ptr<base::ListValue> result(new base::ListValue());
- if (g_device_for_test) {
- result->Append(PopulateDevice(g_device_for_test));
- SetResult(result.release());
- AsyncWorkCompleted();
- return;
- }
-
const uint16_t vendor_id = parameters_->options.vendor_id;
const uint16_t product_id = parameters_->options.product_id;
UsbDevicePermission::CheckParam param(
« no previous file with comments | « chrome/browser/extensions/api/usb/usb_api.h ('k') | chrome/browser/extensions/api/usb/usb_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698