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

Unified Diff: extensions/test/data/api_test/usb/transfer_failure/test.js

Issue 1618393004: Update device/usb and its Mojo interface for variable size ISO packets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Document use of ErrorWithArguments. Created 4 years, 11 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 | « extensions/test/data/api_test/usb/transfer_event/test.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/test/data/api_test/usb/transfer_failure/test.js
diff --git a/extensions/test/data/api_test/usb/transfer_failure/test.js b/extensions/test/data/api_test/usb/transfer_failure/test.js
index 09c53759a2f17df83dd58d888e676791ebf2903c..9348c184d48c9549a56625f67557f80c819c54db 100644
--- a/extensions/test/data/api_test/usb/transfer_failure/test.js
+++ b/extensions/test/data/api_test/usb/transfer_failure/test.js
@@ -25,10 +25,42 @@ function createErrorTest(resultCode, errorMessage) {
};
}
+function createIsochronousErrorTest(resultCode, errorMessage) {
+ return function() {
+ usb.findDevices({vendorId: 0, productId: 0}, function(devices) {
+ var device = devices[0];
+ var transfer = {
+ 'transferInfo': {
+ 'direction': "in",
+ 'endpoint': 2,
+ 'length': 160
+ },
+ 'packets': 10,
+ 'packetLength': 16
+ };
+ usb.isochronousTransfer(device, transfer, function (result) {
+ if (errorMessage) {
+ chrome.test.assertLastError(errorMessage);
+ // Device responds with only 8-byte packets and the second half fail.
+ chrome.test.assertTrue(result.data.byteLength == 40);
+ } else {
+ chrome.test.assertNoLastError();
+ // Device responds with a full set of 10 8-byte packets.
+ chrome.test.assertTrue(result.data.byteLength == 80);
+ }
+ chrome.test.assertTrue(resultCode == result.resultCode);
+ chrome.test.succeed();
+ });
+ });
+ };
+}
+
var tests = [
createErrorTest(0, undefined),
createErrorTest(1, "Transfer failed."),
createErrorTest(2, "Transfer timed out."),
+ createIsochronousErrorTest(0, undefined),
+ createIsochronousErrorTest(1, "Transfer failed."),
];
chrome.test.runTests(tests);
« no previous file with comments | « extensions/test/data/api_test/usb/transfer_event/test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698