Skip to content

Commit

Permalink
Check inherited interfaces exist (web-platform-tests#10285)
Browse files Browse the repository at this point in the history
Also fix affected tests.
  • Loading branch information
lukebjerring authored and foolip committed Apr 5, 2018
1 parent 841f3f5 commit 4d1c192
Show file tree
Hide file tree
Showing 33 changed files with 255 additions and 106 deletions.
2 changes: 1 addition & 1 deletion accelerometer/idlharness.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
const idl_array = new IdlArray();
idl_array.add_untested_idls(dom);
idl_array.add_untested_idls('interface EventHandler {};');
idl_array.add_idls(generic_sensor, { only: ['Sensor'] });
idl_array.add_idls(generic_sensor, { only: ['Sensor', 'SensorOptions'] });
idl_array.add_idls(accelerometer);
idl_array.add_objects({
Accelerometer: ['new Accelerometer();'],
Expand Down
22 changes: 12 additions & 10 deletions background-fetch/interfaces.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ <h1>idlharness test</h1>
<script>
'use strict';

promise_test(function() {
return fetch('/interfaces/background-fetch.idl')
.then(response => response.text())
.then(idls => {
var idlArray = new IdlArray();
idlArray.add_untested_idls('interface ServiceWorkerRegistration {};');
idlArray.add_untested_idls('[Exposed=ServiceWorker] interface ServiceWorkerGlobalScope {};');
idlArray.add_idls(idls);
idlArray.test();
});
promise_test(async function () {
const idls = await fetch('/interfaces/background-fetch.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());

var idlArray = new IdlArray();
idlArray.add_untested_idls('interface ServiceWorkerRegistration {};');
idlArray.add_untested_idls('[Exposed=ServiceWorker] interface ServiceWorkerGlobalScope {};');
idlArray.add_untested_idls('interface ExtendableEvent{};');
idlArray.add_untested_idls('dictionary ExtendableEventInit{};');
idlArray.add_untested_idls(dom, { only: ['EventTarget'] });
idlArray.add_idls(idls);
idlArray.test();
}, 'Exposed interfaces in a Document.');
</script>
22 changes: 12 additions & 10 deletions background-fetch/interfaces.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
importScripts('/resources/testharness.js');
importScripts('/resources/WebIDLParser.js', '/resources/idlharness.js');

promise_test(function() {
return fetch('/interfaces/background-fetch.idl')
.then(response => response.text())
.then(idls => {
var idlArray = new IdlArray();
idlArray.add_untested_idls('interface ServiceWorkerRegistration {};');
idlArray.add_untested_idls('[Exposed=ServiceWorker] interface ServiceWorkerGlobalScope {};');
idlArray.add_idls(idls);
idlArray.test();
});
promise_test(async function() {
const idls = await fetch('/interfaces/background-fetch.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());

var idlArray = new IdlArray();
idlArray.add_untested_idls('interface ServiceWorkerRegistration {};');
idlArray.add_untested_idls('[Exposed=ServiceWorker] interface ServiceWorkerGlobalScope {};');
idlArray.add_untested_idls('interface ExtendableEvent{};');
idlArray.add_untested_idls('dictionary ExtendableEventInit{};');
idlArray.add_untested_idls(dom, { only: ['EventTarget'] });
idlArray.add_idls(idls);
idlArray.test();
}, 'Exposed interfaces in a Service Worker.');

done();
16 changes: 10 additions & 6 deletions clipboard-apis/async-interfaces.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<script>
'use strict';

function doTest(idls) {
function doTest(idl, dom) {
var idl_array = new IdlArray();
idl_array.add_untested_idls('interface Navigator {};');
idl_array.add_untested_idls('interface EventTarget {};');
for (let idl of idls) {
idl_array.add_idls(idl);
}
idl_array.add_untested_idls('dictionary PermissionDescriptor {};');
idl_array.add_untested_idls(dom, { only: ['Event', 'EventInit'] });
idl_array.add_idls(idl);
idl_array.add_objects({
Navigator: ['navigator'],
Clipboard: ['navigator.clipboard'],
Expand All @@ -29,7 +29,11 @@
}

promise_test(() => {
return Promise.all(["/interfaces/clipboard-apis.idl"].map(fetchText))
.then(doTest);
return Promise.all(
[
"/interfaces/clipboard-apis.idl",
"/interfaces/dom.idl",
].map(fetchText))
.then(([idl, dom]) => doTest(idl, dom));
}, "Test driver");
</script>
10 changes: 6 additions & 4 deletions content-security-policy/securitypolicyviolation/idl.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
long lineNumber;
long columnNumber;
};

interface Event {
};
</script>
<script type="text/plain" id="tested">
[Constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict)]
Expand All @@ -42,11 +39,16 @@
};
</script>
<script>
promise_test(async function() {
let dom = await fetch('/interfaces/dom.idl').then(r => r.text());

var idl_array = new IdlArray();
idl_array.add_untested_idls(document.querySelector('#untested').textContent);
idl_array.add_untested_idls(dom, { only: ['Event', 'EventInit'] });
idl_array.add_idls(document.querySelector('#tested').textContent);
idl_array.add_objects({
SecurityPolicyViolationEvent: ['new SecurityPolicyViolationEvent({})']
SecurityPolicyViolationEvent: ['new SecurityPolicyViolationEvent({})']
});
idl_array.test();
})
</script>
29 changes: 23 additions & 6 deletions cookie-store/idlharness.tentative.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,38 @@
'use strict';

promise_test(async t => {
const urls = ['/interfaces/html.idl', '/interfaces/cookie-store.idl'];
const [html, cookie_store] = await Promise.all(
urls.map(url => fetch(url).then(response => response.text())));
const urls = [
'/interfaces/uievents.idl',
'/interfaces/dom.idl',
'/interfaces/html.idl',
'/interfaces/cookie-store.idl'
];
const [uievents, dom, html, cookie_store] = await Promise.all(
urls.map(url => fetch(url).then(r => r.text())));

const idl_array = new IdlArray();

// Dependencies of HTML
idl_array.add_untested_idls(dom, { only: [
'Event',
'EventInit',
'EventTarget',
'HTMLCollection',
'NodeList',
] });
idl_array.add_untested_idls('interface Document {};');
idl_array.add_untested_idls('interface Element {};');
idl_array.add_untested_idls('interface LinkStyle {};');
idl_array.add_untested_idls('interface SVGElement {};');
idl_array.add_untested_idls(html);
idl_array.add_untested_idls(uievents, { only: [
'UIEvent',
'UIEventInit',
'MouseEvent',
'MouseEventInit',
'EventModifierInit',
] });

idl_array.add_untested_idls('interface Event {};');
idl_array.add_untested_idls('dictionary EventInit {};');
idl_array.add_untested_idls('interface EventTarget {};');
idl_array.add_untested_idls(
`[Global=ServiceWorker, Exposed=ServiceWorker]
interface ServiceWorkerGlobalScope {};`);
Expand Down
4 changes: 3 additions & 1 deletion css/cssom-view/interfaces.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ <h1>CSSOM View IDL tests</h1>
<script>
"use strict";

function doTest([html, dom, cssom, geometry, cssom_view]) {
function doTest([html, dom, uievents, cssom, geometry, cssom_view]) {

var idlArray = new IdlArray();
var svg = "interface SVGElement : Element {};";
idlArray.add_untested_idls(html + dom + svg + cssom + geometry);
idlArray.add_untested_idls(uievents, { only: ['UIEvent', 'UIEventInit', 'MouseEvent', 'MouseEventInit', 'EventModifierInit'] });
idlArray.add_idls(cssom_view);

idlArray.add_objects({
Expand Down Expand Up @@ -57,6 +58,7 @@ <h1>CSSOM View IDL tests</h1>
// Have to wait for onload
return Promise.all([fetchData("/interfaces/html.idl"),
fetchData("/interfaces/dom.idl"),
fetchData("/interfaces/uievents.idl"),
fetchData("/interfaces/cssom.idl"),
fetchData("/interfaces/geometry.idl"),
fetchData("/interfaces/cssom-view.idl"),
Expand Down
4 changes: 3 additions & 1 deletion css/cssom/interfaces.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ <h1>CSSOM IDL tests</h1>
"use strict";
var style_element, svg_element, xmlss_pi;

function doTest([html, dom, cssom]) {
function doTest([html, dom, uievents, cssom]) {
style_element = document.getElementById('styleElement');
svg_element = document.getElementById('svgElement');
xmlss_pi = document.getElementById('xmlssPiIframe').contentDocument.firstChild;

var idlArray = new IdlArray();
var svg = "interface SVGElement : Element {};";
idlArray.add_untested_idls(html + dom + svg);
idlArray.add_untested_idls(uievents, { only: ['UIEvent', 'UIEventInit', 'MouseEvent', 'MouseEventInit', 'EventModifierInit']});
idlArray.add_idls(cssom);

idlArray.add_objects({
Expand Down Expand Up @@ -81,6 +82,7 @@ <h1>CSSOM IDL tests</h1>
// Have to wait for onload
return Promise.all([fetchData("/interfaces/html.idl"),
fetchData("/interfaces/dom.idl"),
fetchData("/interfaces/uievents.idl"),
fetchData("/interfaces/cssom.idl"),
waitForLoad()])
.then(doTest);
Expand Down
1 change: 1 addition & 0 deletions encrypted-media/idlharness.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ <h1 class="instructions">Description</h1>
idl_array.add_untested_idls("interface Navigator {};");
idl_array.add_untested_idls("interface HTMLMediaElement {};");
idl_array.add_untested_idls("interface Event {};");
idl_array.add_untested_idls("dictionary EventInit {};");
idl_array.add_untested_idls("interface EventTarget {};");

idl_array.add_idls(idls);
Expand Down
3 changes: 2 additions & 1 deletion gamepad/idlharness.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
promise_test(async () => {
const idl_array = new IdlArray();
const gamepad_idl = await fetch("/interfaces/gamepad.idl").then(r => r.text());
const dom = await fetch("/interfaces/dom.idl").then(r => r.text());

idl_array.add_untested_idls('interface Event {};');
idl_array.add_untested_idls(dom, {only: ['Event', 'EventInit']});
idl_array.add_untested_idls('interface Navigator {};');
idl_array.add_idls(gamepad_idl);

Expand Down
2 changes: 1 addition & 1 deletion geolocation-sensor/idlharness.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
const idl_array = new IdlArray();
idl_array.add_untested_idls('interface EventTarget {};');
idl_array.add_untested_idls('interface EventHandler {};');
idl_array.add_idls(generic_sensor, { only: ['Sensor'] });
idl_array.add_idls(generic_sensor, { only: ['Sensor', 'SensorOptions'] });
idl_array.add_idls(geolocation_sensor);
idl_array.add_objects({
GeolocationSensor: ['new GeolocationSensor'],
Expand Down
2 changes: 1 addition & 1 deletion gyroscope/idlharness.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
const idl_array = new IdlArray();
idl_array.add_untested_idls(dom);
idl_array.add_untested_idls('interface EventHandler {};');
idl_array.add_idls(generic_sensor, { only: ['Sensor'] });
idl_array.add_idls(generic_sensor, { only: ['Sensor', 'SensorOptions'] });
idl_array.add_idls(gyroscope);
idl_array.add_objects({
Gyroscope: ['new Gyroscope();']
Expand Down
6 changes: 4 additions & 2 deletions hr-time/idlharness.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ <h1>High Resolution Time IDL tests</h1>
<script>
'use strict';

function doTest([html, hr_time]) {
function doTest([dom, html, hr_time]) {
var idl_array = new IdlArray();
idl_array.add_untested_idls(dom, { only: ['EventTarget'] });
idl_array.add_untested_idls(html, { only: ['WindowOrWorkerGlobalScope'] });
idl_array.add_idls(hr_time);
idl_array.add_objects({
Expand All @@ -32,7 +33,8 @@ <h1>High Resolution Time IDL tests</h1>
}

promise_test(() => {
return Promise.all(['/interfaces/html.idl',
return Promise.all(['/interfaces/dom.idl',
'/interfaces/html.idl',
'/interfaces/hr-time.idl'].map(fetchText))
.then(doTest);
}, 'Test driver');
Expand Down
2 changes: 1 addition & 1 deletion magnetometer/idlharness.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
const idl_array = new IdlArray();
idl_array.add_untested_idls(dom);
idl_array.add_untested_idls('interface EventHandler {};');
idl_array.add_idls(generic_sensor, { only: ['Sensor'] });
idl_array.add_idls(generic_sensor, { only: ['Sensor', 'SensorOptions'] });
idl_array.add_idls(magnetometer);
idl_array.add_objects({
Magnetometer: ['new Magnetometer();'],
Expand Down
29 changes: 17 additions & 12 deletions mediacapture-record/idlharness.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,24 @@

</pre>
<script>
var canvas = document.getElementById('canvas');
var context = canvas.getContext("2d");
context.fillStyle = "red";
context.fillRect(0, 0, 10, 10);
var stream = canvas.captureStream();
promise_test(async function() {
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());

var idl_array = new IdlArray();
idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
idl_array.add_idls(document.getElementById("idl").textContent);
idl_array.add_objects({
MediaRecorder: [new MediaRecorder(stream)],
});
idl_array.test();
var canvas = document.getElementById('canvas');
var context = canvas.getContext("2d");
context.fillStyle = "red";
context.fillRect(0, 0, 10, 10);
var stream = canvas.captureStream();

var idl_array = new IdlArray();
idl_array.add_untested_idls(dom, { only: ['EventInit'] });
idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
idl_array.add_idls(document.getElementById("idl").textContent);
idl_array.add_objects({
MediaRecorder: [new MediaRecorder(stream)],
});
idl_array.test();
}, 'mediacapture-record interfaces');
</script>
<div id="log"></div>
</body>
Expand Down
13 changes: 8 additions & 5 deletions mediacapture-streams/MediaDevices-IDL-all.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ <h1 class="instructions">Description</h1>
<script>
'use strict';

function doIdlTest(idlText) {
function doIdlTest([dom, idlText]) {
var idl_array = new IdlArray();

// dummies
idl_array.add_untested_idls(dom, { only: ['Event', 'EventInit']});
idl_array.add_untested_idls("interface Navigator {};");
idl_array.add_untested_idls("interface EventTarget {};");
idl_array.add_untested_idls("interface EventHandler {};");
Expand All @@ -35,10 +36,12 @@ <h1 class="instructions">Description</h1>
}

promise_test(() => {
return fetch('/interfaces/mediacapture-main.idl')
.then(response => response.text())
.then(doIdlTest);

return Promise.all(
[
'/interfaces/dom.idl',
'/interfaces/mediacapture-main.idl',
].map(url => fetch(url).then(r => r.text())))
.then(doIdlTest);
}, 'Test driver')
</script>
</body>
Expand Down
11 changes: 7 additions & 4 deletions mediacapture-streams/MediaDevices-IDL-enumerateDevices.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ <h1 class="instructions">Description</h1>
<script>
"use strict";

function doIdlTest(idlText) {
function doIdlTest([dom, idlText]) {
const MDI_idl = new IdlArray();

MDI_idl.add_untested_idls("interface Event {};");
MDI_idl.add_untested_idls(dom, { only: ['Event', 'EventInit'] });
MDI_idl.add_untested_idls("interface EventTarget {};");
MDI_idl.add_untested_idls("interface Navigator {};");
MDI_idl.add_idls(idlText);
Expand Down Expand Up @@ -59,8 +59,11 @@ <h1 class="instructions">Description</h1>
}

promise_test(() => {
return fetch('/interfaces/mediacapture-main.idl')
.then(response => response.text())
return Promise.all(
[
'/interfaces/dom.idl',
'/interfaces/mediacapture-main.idl',
].map(url => fetch(url).then(r => r.text())))
.then(doIdlTest);

}, "Test MediaDevices.enumerateDevices call and result. Types only.");
Expand Down
1 change: 1 addition & 0 deletions navigation-timing/nav2_idlharness.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
[MeasureAs=PerformanceResourceTimingSizes] readonly attribute unsigned long long encodedBodySize;
[MeasureAs=PerformanceResourceTimingSizes] readonly attribute unsigned long long decodedBodySize;
};
interface PerformanceEntry {};
</pre>

<pre id='idl'>
Expand Down
2 changes: 1 addition & 1 deletion orientation-sensor/idlharness.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
const idl_array = new IdlArray();
idl_array.add_untested_idls(dom);
idl_array.add_untested_idls('interface EventHandler {};');
idl_array.add_idls(generic_sensor, { only: ['Sensor'] });
idl_array.add_idls(generic_sensor, { only: ['Sensor', 'SensorOptions'] });
idl_array.add_idls(orientation_sensor);
idl_array.add_objects({
AbsoluteOrientationSensor: ['new AbsoluteOrientationSensor();'],
Expand Down
Loading

0 comments on commit 4d1c192

Please sign in to comment.