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

Unified Diff: third_party/WebKit/LayoutTests/usb/usb.html

Issue 2789723003: Migrate WebUSB LayoutTests into external/wpt (Closed)
Patch Set: Add README.md and more comments explaining the polyfill Created 3 years, 6 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/usb.html
diff --git a/third_party/WebKit/LayoutTests/usb/usb.html b/third_party/WebKit/LayoutTests/usb/usb.html
deleted file mode 100644
index 16c659cf2688af7834e0447ef0189488824edac6..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/usb/usb.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/fake-devices.js"></script>
-<script src="resources/usb-helpers.js"></script>
-<script src="resources/webusb-test.js"></script>
-<script>
-'use strict';
-
-usb_test(() => {
- return getFakeDevice().then(({ device }) => {
- return navigator.usb.getDevices().then(devices => {
- assert_equals(devices.length, 1);
- assert_equals(device, devices[0]);
- assertDeviceInfoEquals(devices[0], fakeDeviceInit);
- });
- });
-}, 'getDevices returns devices that are connected');
-
-usb_test(() => {
- return getFakeDevice().then(() => {
- return navigator.usb.getDevices().then(devicesFirstTime => {
- assert_equals(devicesFirstTime.length, 1);
- return navigator.usb.getDevices().then(devicesSecondTime => {
- assert_array_equals(devicesSecondTime, devicesFirstTime);
- });
- });
- });
-}, 'getDevices returns the same objects for each USB device');
-
-usb_test(() => {
- return navigator.usb.requestDevice({ filters: [] })
- .then(device => {
- assert_unreachable('requestDevice should reject without a user gesture');
- })
- .catch(error => {
- assert_equals(error.code, DOMException.SECURITY_ERR);
- });
-}, 'requestDevice rejects when called without a user gesture');
-
-usb_test(() => {
- return callWithKeyDown(() => navigator.usb.requestDevice({ filters: [] })
- .then(device => {
- assert_unreachable('requestDevice should reject when no device selected');
- })
- .catch(error => {
- assert_equals(error.code, DOMException.NOT_FOUND_ERR);
- })
- );
-}, 'requestDevice rejects when no device is chosen');
-
-usb_test(() => {
- return getFakeDevice().then(({ device, fakeDevice }) => {
- navigator.usb.test.chosenDevice = fakeDevice;
- return callWithKeyDown(() => {
- return navigator.usb.requestDevice({ filters: [] }).then(chosenDevice => {
- assert_equals(chosenDevice, device);
- });
- });
- });
-}, 'requestDevice returns the device chosen by the user');
-
-usb_test(() => {
- return getFakeDevice().then(({ device, fakeDevice }) => {
- navigator.usb.test.chosenDevice = fakeDevice;
- return callWithKeyDown(() => {
- return navigator.usb.requestDevice({ filters: [] }).then(chosenDevice => {
- assert_equals(chosenDevice, device);
- return navigator.usb.getDevices().then(devices => {
- assert_equals(devices.length, 1);
- assert_equals(devices[0], chosenDevice);
- });
- });
- });
- });
-}, 'getDevices returns the same object as requestDevice');
-
-usb_test(() => {
- const expectedFilters = [
- { vendorId: 1234, classCode: 0xFF, serialNumber: "123ABC" },
- { vendorId: 5678, productId: 0xF00F }
- ];
-
- return callWithKeyDown(() => navigator.usb.requestDevice({ filters: expectedFilters })
- .then(device => {
- assert_unreachable('requestDevice should reject because no device selected');
- })
- .catch(error => {
- assert_equals(error.code, DOMException.NOT_FOUND_ERR);
- let actualFilters = navigator.usb.test.lastFilters;
- assert_equals(actualFilters.length, expectedFilters.length);
- for (var i = 0; i < actualFilters.length; ++i)
- assert_object_equals(actualFilters[i], expectedFilters[i]);
- })
- );
-}, 'filters are sent correctly');
-
-usb_test(() => {
- return getFakeDevice().then(({ device }) => {
- assertDeviceInfoEquals(device, fakeDeviceInit);
- return device.open().then(() => device.close());
- });
-}, 'onconnect event is trigged by adding a device');
-
-usb_test(usb => {
- return getFakeDevice().then(({ device, fakeDevice }) => {
- return waitForDisconnect(fakeDevice).then(removedDevice => {
- assertDeviceInfoEquals(removedDevice, fakeDeviceInit);
- assert_equals(removedDevice, device);
- return removedDevice.open().then(() => {
- assert_unreachable('should not be able to open a disconnected device');
- }, error => {
- assert_equals(error.code, DOMException.NOT_FOUND_ERR);
- });
- });
- });
-}, 'ondisconnect event is triggered by removing a device');
-</script>
« no previous file with comments | « third_party/WebKit/LayoutTests/usb/test-polyfil.html ('k') | third_party/WebKit/LayoutTests/usb/usb-connection-event.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698