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

Side by Side Diff: extensions/test/data/api_test/hid/api/background.js

Issue 943783003: Pad HID output reports on Windows to the maximum output report size. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added "size" to comment. Created 5 years, 10 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
« no previous file with comments | « extensions/browser/api/hid/hid_apitest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 var kInvalidDeviceId = -1; 5 var kInvalidDeviceId = -1;
6 var kInvalidConnectionId = -1; 6 var kInvalidConnectionId = -1;
7 7
8 var kReportDescriptor = [0x06, 0x00, 0xFF, 0x08, 0xA1, 0x01, 0x15, 8 var kReportDescriptor = [0x06, 0x00, 0xFF, 0x08, 0xA1, 0x01, 0x15,
9 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95, 9 0x00, 0x26, 0xFF, 0x00, 0x75, 0x08, 0x95,
10 0x08, 0x08, 0x81, 0x02, 0x08, 0x91, 0x02, 10 0x08, 0x08, 0x81, 0x02, 0x08, 0x91, 0x02,
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 227 }
228 228
229 function testSendWithInvalidConnectionId() { 229 function testSendWithInvalidConnectionId() {
230 var buffer = new ArrayBuffer(); 230 var buffer = new ArrayBuffer();
231 chrome.hid.send(kInvalidConnectionId, 0, buffer, function () { 231 chrome.hid.send(kInvalidConnectionId, 0, buffer, function () {
232 chrome.test.assertLastError("Connection not established."); 232 chrome.test.assertLastError("Connection not established.");
233 chrome.test.succeed("Rejected invalid connection ID."); 233 chrome.test.succeed("Rejected invalid connection ID.");
234 }); 234 });
235 } 235 }
236 236
237 function testSendOversizeReport() {
238 openDeviceWithReportId(function (connection) {
239 var buffer = stringToArrayBuffer("oversize report");
240 chrome.hid.send(connection, 1, buffer, function () {
241 chrome.test.assertLastError("Transfer failed.");
242 chrome.hid.disconnect(connection);
243 chrome.test.succeed("Caught oversize report.");
244 });
245 });
246 }
247
237 function testSendWithReportId() { 248 function testSendWithReportId() {
238 openDeviceWithReportId(function (connection) { 249 openDeviceWithReportId(function (connection) {
239 var buffer = stringToArrayBuffer("This is a HID output report."); 250 var buffer = stringToArrayBuffer("o-report");
240 chrome.hid.send(connection, 1, buffer, function () { 251 chrome.hid.send(connection, 1, buffer, function () {
241 chrome.test.assertNoLastError(); 252 chrome.test.assertNoLastError();
242 chrome.hid.disconnect(connection); 253 chrome.hid.disconnect(connection);
243 chrome.test.succeed("Send successful."); 254 chrome.test.succeed("Send successful.");
244 }); 255 });
245 }); 256 });
246 } 257 }
247 258
248 function testSendWithoutReportId() { 259 function testSendWithoutReportId() {
249 openDeviceWithoutReportId(function (connection) { 260 openDeviceWithoutReportId(function (connection) {
250 var buffer = stringToArrayBuffer("This is a HID output report."); 261 var buffer = stringToArrayBuffer("o-report");
251 chrome.hid.send(connection, 0, buffer, function () { 262 chrome.hid.send(connection, 0, buffer, function () {
252 chrome.test.assertNoLastError(); 263 chrome.test.assertNoLastError();
253 chrome.hid.disconnect(connection); 264 chrome.hid.disconnect(connection);
254 chrome.test.succeed("Send successful."); 265 chrome.test.succeed("Send successful.");
255 }); 266 });
256 }); 267 });
257 } 268 }
258 269
259 function testSendWithInvalidReportId() { 270 function testSendWithInvalidReportId() {
260 openDeviceWithReportId(function (connection) { 271 openDeviceWithReportId(function (connection) {
261 var buffer = stringToArrayBuffer("This is a HID output report."); 272 var buffer = stringToArrayBuffer("o-report");
262 chrome.hid.send(connection, 0, buffer, function () { 273 chrome.hid.send(connection, 0, buffer, function () {
263 chrome.test.assertLastError("Transfer failed."); 274 chrome.test.assertLastError("Transfer failed.");
264 chrome.hid.disconnect(connection); 275 chrome.hid.disconnect(connection);
265 chrome.test.succeed("Caught invalid report ID."); 276 chrome.test.succeed("Caught invalid report ID.");
266 }); 277 });
267 }); 278 });
268 } 279 }
269 280
270 function testSendWithUnexpectedReportId() { 281 function testSendWithUnexpectedReportId() {
271 openDeviceWithoutReportId(function (connection) { 282 openDeviceWithoutReportId(function (connection) {
272 var buffer = stringToArrayBuffer("This is a HID output report."); 283 var buffer = stringToArrayBuffer("o-report");
273 chrome.hid.send(connection, 1, buffer, function () { 284 chrome.hid.send(connection, 1, buffer, function () {
274 chrome.test.assertLastError("Transfer failed."); 285 chrome.test.assertLastError("Transfer failed.");
275 chrome.hid.disconnect(connection); 286 chrome.hid.disconnect(connection);
276 chrome.test.succeed("Caught unexpected report ID."); 287 chrome.test.succeed("Caught unexpected report ID.");
277 }); 288 });
278 }); 289 });
279 } 290 }
280 291
281 function testReceiveFeatureReportWithInvalidConnectionId() { 292 function testReceiveFeatureReportWithInvalidConnectionId() {
282 chrome.hid.receiveFeatureReport(kInvalidConnectionId, 0, function (data) { 293 chrome.hid.receiveFeatureReport(kInvalidConnectionId, 0, function (data) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 testGetDevicesWithUsageFilter, 400 testGetDevicesWithUsageFilter,
390 testGetDevicesWithUnauthorizedDevice, 401 testGetDevicesWithUnauthorizedDevice,
391 testDeviceInfo, 402 testDeviceInfo,
392 testConnectWithInvalidDeviceId, 403 testConnectWithInvalidDeviceId,
393 testConnectAndDisconnect, 404 testConnectAndDisconnect,
394 testDisconnectWithInvalidConnectionId, 405 testDisconnectWithInvalidConnectionId,
395 testReceiveWithInvalidConnectionId, 406 testReceiveWithInvalidConnectionId,
396 testReceiveWithReportId, 407 testReceiveWithReportId,
397 testReceiveWithoutReportId, 408 testReceiveWithoutReportId,
398 testSendWithInvalidConnectionId, 409 testSendWithInvalidConnectionId,
410 testSendOversizeReport,
399 testSendWithReportId, 411 testSendWithReportId,
400 testSendWithoutReportId, 412 testSendWithoutReportId,
401 testSendWithInvalidReportId, 413 testSendWithInvalidReportId,
402 testSendWithUnexpectedReportId, 414 testSendWithUnexpectedReportId,
403 testReceiveFeatureReportWithInvalidConnectionId, 415 testReceiveFeatureReportWithInvalidConnectionId,
404 testReceiveFeatureReportWithReportId, 416 testReceiveFeatureReportWithReportId,
405 testReceiveFeatureReportWithoutReportId, 417 testReceiveFeatureReportWithoutReportId,
406 testReceiveFeatureReportWithInvalidReportId, 418 testReceiveFeatureReportWithInvalidReportId,
407 testReceiveFeatureReportWithUnexpectedReportId, 419 testReceiveFeatureReportWithUnexpectedReportId,
408 testSendFeatureReportWithInvalidConnectionId, 420 testSendFeatureReportWithInvalidConnectionId,
409 testSendFeatureReportWithReportId, 421 testSendFeatureReportWithReportId,
410 testSendFeatureReportWithoutReportId, 422 testSendFeatureReportWithoutReportId,
411 testSendFeatureReportWithInvalidReportId, 423 testSendFeatureReportWithInvalidReportId,
412 testSendFeatureReportWithUnexpectedReportId, 424 testSendFeatureReportWithUnexpectedReportId,
413 ]); 425 ]);
OLDNEW
« no previous file with comments | « extensions/browser/api/hid/hid_apitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698