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

Unified Diff: third_party/WebKit/LayoutTests/usb/resources/webusb-test.js

Issue 2821723002: Move classes in the device.usb Mojo namespace to device.mojom (Closed)
Patch Set: mcasas@ nits Created 3 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
Index: third_party/WebKit/LayoutTests/usb/resources/webusb-test.js
diff --git a/third_party/WebKit/LayoutTests/usb/resources/webusb-test.js b/third_party/WebKit/LayoutTests/usb/resources/webusb-test.js
index 44d9aecec0550bade238313dd512805a4061117e..72a3313d03a47661eb427e6460092b5a52e87bba 100644
--- a/third_party/WebKit/LayoutTests/usb/resources/webusb-test.js
+++ b/third_party/WebKit/LayoutTests/usb/resources/webusb-test.js
@@ -124,21 +124,21 @@ function fakeDeviceInitToDeviceInfo(guid, init) {
};
switch (endpoint.direction) {
case "in":
- endpointInfo.direction = mojo.device.TransferDirection.INBOUND;
+ endpointInfo.direction = mojo.device.UsbTransferDirection.INBOUND;
break;
case "out":
- endpointInfo.direction = mojo.device.TransferDirection.OUTBOUND;
+ endpointInfo.direction = mojo.device.UsbTransferDirection.OUTBOUND;
break;
}
switch (endpoint.type) {
case "bulk":
- endpointInfo.type = mojo.device.EndpointType.BULK;
+ endpointInfo.type = mojo.device.UsbEndpointType.BULK;
break;
case "interrupt":
- endpointInfo.type = mojo.device.EndpointType.INTERRUPT;
+ endpointInfo.type = mojo.device.UsbEndpointType.INTERRUPT;
break;
case "isochronous":
- endpointInfo.type = mojo.device.EndpointType.ISOCHRONOUS;
+ endpointInfo.type = mojo.device.UsbEndpointType.ISOCHRONOUS;
break;
}
alternateInfo.endpoints.push(endpointInfo);
@@ -197,7 +197,7 @@ class FakeDevice {
open() {
assert_false(this.opened_);
this.opened_ = true;
- return Promise.resolve({ error: mojo.device.OpenDeviceError.OK });
+ return Promise.resolve({ error: mojo.device.UsbOpenDeviceError.OK });
}
close() {
@@ -269,7 +269,7 @@ class FakeDevice {
assert_true(this.opened_);
assert_false(this.currentConfiguration_ == null, 'device configured');
return Promise.resolve({
- status: mojo.device.TransferStatus.OK,
+ status: mojo.device.UsbTransferStatus.OK,
data: [length >> 8, length & 0xff, params.request, params.value >> 8,
params.value & 0xff, params.index >> 8, params.index & 0xff]
});
@@ -279,7 +279,7 @@ class FakeDevice {
assert_true(this.opened_);
assert_false(this.currentConfiguration_ == null, 'device configured');
return Promise.resolve({
- status: mojo.device.TransferStatus.OK,
+ status: mojo.device.UsbTransferStatus.OK,
bytesWritten: data.byteLength
});
}
@@ -292,7 +292,7 @@ class FakeDevice {
for (let i = 0; i < length; ++i)
data[i] = i & 0xff;
return Promise.resolve({
- status: mojo.device.TransferStatus.OK,
+ status: mojo.device.UsbTransferStatus.OK,
data: data
});
}
@@ -302,7 +302,7 @@ class FakeDevice {
assert_false(this.currentConfiguration_ == null, 'device configured');
// TODO(reillyg): Assert that endpoint is valid.
return Promise.resolve({
- status: mojo.device.TransferStatus.OK,
+ status: mojo.device.UsbTransferStatus.OK,
bytesWritten: data.byteLength
});
}
@@ -320,7 +320,7 @@ class FakeDevice {
packets[i] = {
length: packetLengths[i],
transferred_length: packetLengths[i],
- status: mojo.device.TransferStatus.OK
+ status: mojo.device.UsbTransferStatus.OK
};
}
return Promise.resolve({ data: data, packets: packets });
@@ -335,7 +335,7 @@ class FakeDevice {
packets[i] = {
length: packetLengths[i],
transferred_length: packetLengths[i],
- status: mojo.device.TransferStatus.OK
+ status: mojo.device.UsbTransferStatus.OK
};
}
return Promise.resolve({ packets: packets });
@@ -345,7 +345,7 @@ class FakeDevice {
class FakeDeviceManager {
constructor() {
this.bindingSet_ =
- new mojo.bindings.BindingSet(mojo.deviceManager.DeviceManager);
+ new mojo.bindings.BindingSet(mojo.deviceManager.UsbDeviceManager);
this.devices_ = new Map();
this.client_ = null;
}
@@ -399,7 +399,7 @@ class FakeDeviceManager {
let device = this.devices_.get(guid);
if (device) {
let binding = new mojo.bindings.Binding(
- mojo.device.Device, new FakeDevice(device.info), request);
+ mojo.device.UsbDevice, new FakeDevice(device.info), request);
binding.setConnectionErrorHandler(() => {
if (g_closeListener)
g_closeListener(guid);
@@ -418,7 +418,7 @@ class FakeDeviceManager {
class FakeChooserService {
constructor() {
this.bindingSet_ = new mojo.bindings.BindingSet(
- mojo.chooserService.ChooserService);
+ mojo.chooserService.UsbChooserService);
this.chosenDevice_ = null;
this.lastFilters_ = null;
}
@@ -478,12 +478,12 @@ class USBTest {
g_deviceManager = new FakeDeviceManager();
mojo.frameInterfaces.addInterfaceOverrideForTesting(
- mojo.deviceManager.DeviceManager.name,
+ mojo.deviceManager.UsbDeviceManager.name,
handle => g_deviceManager.addBinding(handle));
g_chooserService = new FakeChooserService();
mojo.frameInterfaces.addInterfaceOverrideForTesting(
- mojo.chooserService.ChooserService.name,
+ mojo.chooserService.UsbChooserService.name,
handle => g_chooserService.addBinding(handle));
addEventListener('unload', () => {
@@ -508,10 +508,10 @@ class USBTest {
'content/public/renderer/frame_interfaces'
], frameInterfaces => {
frameInterfaces.addInterfaceOverrideForTesting(
- mojo.deviceManager.DeviceManager.name,
+ mojo.deviceManager.UsbDeviceManager.name,
handle => g_deviceManager.addBinding(handle));
frameInterfaces.addInterfaceOverrideForTesting(
- mojo.chooserService.ChooserService.name,
+ mojo.chooserService.UsbChooserService.name,
handle => g_chooserService.addBinding(handle));
resolve();
});
« no previous file with comments | « third_party/WebKit/LayoutTests/usb/resources/fake-devices.js ('k') | third_party/WebKit/Source/modules/webusb/USB.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698