PageRenderTime 33ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/third_party/blink/web_tests/external/wpt/mediacapture-record/idlharness.window.js

https://github.com/chromium/chromium
JavaScript | 40 lines | 31 code | 5 blank | 4 comment | 0 complexity | 5b381af74177d9e50ae9bbbb370b94a8 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, Apache-2.0, BSD-3-Clause
  1. // META: script=/resources/WebIDLParser.js
  2. // META: script=/resources/idlharness.js
  3. 'use strict';
  4. // https://w3c.github.io/mediacapture-record/
  5. idl_test(
  6. ['mediastream-recording'],
  7. ['mediacapture-streams', 'FileAPI', 'html', 'dom', 'webidl'],
  8. idl_array => {
  9. // Ignored errors will be surfaced in idlharness.js's test_object below.
  10. let recorder, blob, error;
  11. try {
  12. const canvas = document.createElement('canvas');
  13. document.body.appendChild(canvas);
  14. const context = canvas.getContext("2d");
  15. context.fillStyle = "red";
  16. context.fillRect(0, 0, 10, 10);
  17. const stream = canvas.captureStream();
  18. recorder = new MediaRecorder(stream);
  19. } catch(e) {}
  20. idl_array.add_objects({ MediaRecorder: [recorder] });
  21. try {
  22. blob = new BlobEvent("type", {
  23. data: new Blob(),
  24. timecode: performance.now(),
  25. });
  26. } catch(e) {}
  27. idl_array.add_objects({ BlobEvent: [blob] });
  28. try {
  29. error = new MediaRecorderErrorEvent("type", {
  30. error: new DOMException,
  31. });
  32. } catch(e) {}
  33. idl_array.add_objects({ MediaRecorderErrorEvent: [error] });
  34. }
  35. );