Bug 1477360 [wpt PR 12104] - Simplify the image-capture IDL test, a=testonly

Automatic update from web-platform-testsSimplify the image-capture IDL test (#12104)

--

wpt-commits: 9ce296bbd84a2b11c4d98b2bcbedc4dd4fbbc5bb
wpt-pr: 12104
This commit is contained in:
Luke Bjerring 2018-07-25 17:56:37 +00:00 committed by James Graham
parent 0085bfc6fb
commit c4bbb0da4f
3 changed files with 31 additions and 53 deletions

View File

@ -353923,9 +353923,9 @@
{}
]
],
"mediacapture-image/idlharness.html": [
"mediacapture-image/idlharness.window.js": [
[
"/mediacapture-image/idlharness.html",
"/mediacapture-image/idlharness.window.html",
{}
]
],
@ -593998,8 +593998,8 @@
"0e0b75556b814c4d95b6bbefa19597d7f618467d",
"support"
],
"mediacapture-image/idlharness.html": [
"ad2c957734eb67577ef3e50f95984eeb999f4743",
"mediacapture-image/idlharness.window.js": [
"2a422e686bd462ea9cf1d8718becac291e3da2e9",
"testharness"
],
"mediacapture-record/BlobEvent-constructor.html": [

View File

@ -1,49 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Image Capture IDL test</title>
<link rel="help" href="https://w3c.github.io/mediacapture-image">
<link rel="idl" href="https://w3c.github.io/mediacapture-image/#idl-index">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
</head>
<body>
<canvas id='canvas' width=10 height=10/>
<script>
'use strict';
promise_test(async () => {
const srcs = ['image-capture', 'mediacapture-streams', 'html', 'dom'];
const [idl, main, html, dom] = await Promise.all(
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
let capture;
try {
var canvas = document.getElementById('canvas');
var context = canvas.getContext("2d");
context.fillStyle = "red";
context.fillRect(0, 0, 10, 10);
var track = canvas.captureStream().getVideoTracks()[0];
capture = new ImageCapture(track);
} catch (e) {
// Will be surfaced in idlharness.js's test_object below.
}
var idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(main);
idl_array.add_dependency_idls(html);
idl_array.add_dependency_idls(dom);
idl_array.add_objects({
ImageCapture : [capture]
});
idl_array.test();
}, 'Test mediacapture-image IDL interfaces');
</script>
<div id="log"></div>
</body>
</html>

View File

@ -0,0 +1,27 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// https://w3c.github.io/mediacapture-image/
'use strict';
idl_test(
['image-capture'],
['mediacapture-streams', 'html', 'dom'],
async idl_array => {
idl_array.add_objects({
ImageCapture : ['capture'],
PhotoCapabilities: ['capabilities'],
});
const canvas = document.createElement('canvas');
document.body.appendChild(canvas);
const context = canvas.getContext("2d");
context.fillStyle = "red";
context.fillRect(0, 0, 10, 10);
const track = canvas.captureStream().getVideoTracks()[0];
self.capture = new ImageCapture(track);
self.capabilities = await capture.getPhotoCapabilities();
},
'Test mediacapture-image IDL interfaces'
);