https://github.com/web-platform-tests/wpt
Raw File
Tip revision: ee643b5070f41452bd61368a5594edf9c4b4b024 authored by Luke Bjerring on 14 March 2018, 13:45:13 UTC
Distinguish which instance toJSON is being executed against when inherited
Tip revision: ee643b5
usbOutTransferResult.https.html
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';

test(t => {
  let result = new USBOutTransferResult('ok', 42);
  assert_equals(result.status, 'ok');
  assert_equals(result.bytesWritten, 42);

  result = new USBOutTransferResult('stall');
  assert_equals(result.status, 'stall');
  assert_equals(result.bytesWritten, 0);
}, 'Can construct USBOutTransferResult');

test(t => {
  assert_throws(TypeError(), () => new USBOutTransferResult('invalid_status'));
}, 'Cannot construct USBOutTransferResult with an invalid status');

test(t => {
  assert_throws(TypeError(), () => new USBOutTransferResult());
}, 'Cannot construct USBOutTransferResult without a status');
</script>
back to top