From ebe27fa4b75404756c57273cbd5613c4996053ac Mon Sep 17 00:00:00 2001 From: Luke Bjerring Date: Tue, 13 Nov 2018 13:41:13 +0000 Subject: [PATCH] Bug 1504402 [wpt PR 13878] - Count partial mixins as tested deps, a=testonly Automatic update from web-platform-testsCount partial mixins as tested deps (#13878) -- wpt-commits: 4176e9ef5f720910505d3af6c22a0b8002a4a9a8 wpt-pr: 13878 --- .../tests/resources/idlharness.js | 22 +++++++++-- .../test_partial_interface_of.html | 37 +++++++++++++++++++ .../tests/selection/idlharness.window.js | 2 +- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/testing/web-platform/tests/resources/idlharness.js b/testing/web-platform/tests/resources/idlharness.js index 9e6ed236b0a4..926a615e59c9 100644 --- a/testing/web-platform/tests/resources/idlharness.js +++ b/testing/web-platform/tests/resources/idlharness.js @@ -298,15 +298,29 @@ IdlArray.prototype.add_dependency_idls = function(raw_idls, options) }.bind(this)); deps.forEach(function(name) { - new_options.only.push(name); + if (!new_options.only.includes(name)) { + new_options.only.push(name); + } const follow_up = new Set(); for (const dep_type of ["inheritance", "implements", "includes"]) { if (parsed[dep_type]) { const inheriting = parsed[dep_type]; const inheritor = parsed.name || parsed.target; - for (const dep of [inheriting, inheritor]) { - new_options.only.push(dep); + const deps = [inheriting]; + // For A includes B, we can ignore A, unless B (or some of its + // members) is being tested. + if (dep_type !== "includes" + || inheriting in this.members && !this.members[inheriting].untested + || this.partials.some(function(p) { + return p.name === inheriting; + })) { + deps.push(inheritor); + } + for (const dep of deps) { + if (!new_options.only.includes(dep)) { + new_options.only.push(dep); + } all_deps.add(dep); follow_up.add(dep); } @@ -320,7 +334,7 @@ IdlArray.prototype.add_dependency_idls = function(raw_idls, options) next.forEach(process); } } - }); + }.bind(this)); }.bind(this); for (let parsed of parsed_idls) { diff --git a/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_partial_interface_of.html b/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_partial_interface_of.html index ee42a37355e5..0c752bdc6cd2 100644 --- a/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_partial_interface_of.html +++ b/testing/web-platform/tests/resources/test/tests/functional/idlharness/IdlInterface/test_partial_interface_of.html @@ -63,6 +63,37 @@ namespace E {};`); idlArray.collapse_partials(); })(); + + (() => { + const idlArray = new IdlArray(); + idlArray.add_idls(` + partial interface F {}; + partial interface mixin G{}; + `); + idlArray.add_dependency_idls(` + interface F {}; + interface mixin G {}; + interface mixin H {}; + F includes H; + I includes H; + J includes G; + interface K : J {}; + interface L : F {}; + `); + test(() => { + // F is tested, so H is a dep. + assert_true('F' in idlArray.includes, 'Fs includes should be picked up'); + assert_true(idlArray.includes.F.includes('H'), 'H should be picked up'); + // H is not tested, so I is not a dep. + assert_false('I' in idlArray.includes, 'I should be ignored'); + // G is a dep, so J is a dep. + assert_true('J' in idlArray.includes, 'J should be picked up'); + // But, K isn't a dep just because of J. + assert_false('K' in idlArray.members, 'K should be ignored'); + // L inherits F, so should be picked up. + assert_false('L' in idlArray.members, 'L should be picked up'); + }, 'partial mixin dep implications'); + })();