Skip to content

[idlharness.js] Add inheritor as dep for includes - #12165

Merged
foolip merged 6 commits into
web-platform-tests:masterfrom
lukebjerring:idlharness-mixins
Jul 25, 2018
Merged

foolip merged 6 commits into
web-platform-tests:masterfrom
lukebjerring:idlharness-mixins

Conversation

@lukebjerring

Copy link
Copy Markdown
Contributor

This addresses an issue where, when testing a partial interface, we are not including the parents that implement said interface as dependencies.

Specific example:
In pointerevents, we have partial interface GlobalEventHandlers
Window includes GlobalEventHandlers, but we do not include Window as an untested dep, so none of the members added in the partial are tested.

To fix this, we treat both sides of A includes B as being deps.
I tested this in combination with #11922 locally, and the result was 129 tests (nearly double status quo).

@wpt-pr-bot
wpt-pr-bot requested review from gsnedders and jgraham July 24, 2018 16:12
@lukebjerring lukebjerring changed the title Add inheritor as dep for includes [idlharness.js] Add inheritor as dep for includes Jul 24, 2018
@lukebjerring
lukebjerring requested a review from foolip July 24, 2018 16:12
@lukebjerring lukebjerring mentioned this pull request Jul 24, 2018
1 of 5 tasks
@lukebjerring

Copy link
Copy Markdown
Contributor Author

@lukebjerring

Copy link
Copy Markdown
Contributor Author

There were several 'regressions' caused by this change; all of them are useful (they highlight incorrect test setup). I've patched in a fix for the fixable ones (correct imports).
https://test-results.appspot.com/data/layout_results/linux_chromium_rel_ng/148022/site_per_process_webkit_layout_tests%20%28with%20patch%29/layout-test-results/results.html

@klausw

klausw commented Jul 24, 2018

Copy link
Copy Markdown
Contributor

webxr/ LGTM, though I admittedly don't fully understand how this works. If there are fixes needed for other tests, I think this would need more guidance how to go about fixing them.

@birtles birtles left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me for the css-transitions / css-animations part with the one change to the transition event name made.

Comment thread css/css-transitions/idlharness.html Outdated
['cssom', 'html', 'dom'],
idl_array => {
idl_array.add_objects({
TransitionEvent: ['new TransitionEvent("transition")'],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to use an actual event name here instead of transition, e.g. transitionend (the most widely supported transition event)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like "x" or "type" is also good in that it's clearer that the string doesn't matter. (I've seen some case where multiple instances that differ only by the event type have been tested, which won't do any good.)

@wpt-pr-bot
wpt-pr-bot requested a review from tabatkins July 25, 2018 02:11

@foolip foolip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with thoughts and pushed two tweak commits

Comment thread fetch/api/idl.any.js
Request: ["new Request('about:blank')"],
Response: ["new Response()"],
});
if (self.GLOBAL.isWindow()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would { WindowOrWorkerGlobalScope: ['self'] } work, or isn't idlharness.js clever enough to connect the dots between that and what needs to be tested?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases, because it's only testing a partial, that works fine. However, it's not how you're supposed to structure the tests:

The interface has to be the primary interface of all the objects provided. For example, don’t pass {Node: ["document"]}, but rather {Document: ["document"]}. Assuming the Document interface was declared to inherit from Node, this will automatically test that document implements the Node interface too.

https://web-platform-tests.org/writing-tests/idlharness.html#add_objectsdict

@foolip foolip Jul 25, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, does that mean that the GlobalEventHandlers bit in

GlobalEventHandlers: ['self'],
is wrong? That's what I was thinking about when suggesting { WindowOrWorkerGlobalScope: ['self'] }.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's wrong, but it was written prior to this fix, so was a reasonable way of forcing coverage of GlobalEventHandlers at the time. Like I said; if it's only testing a partial, it doesn't fail anything, but if there's any methods that it's testing on the concrete class (e.g. toJSON) it's a problem.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the details of how this is implemented, but it looks like with the changes in this PR, if I just delete GlobalEventHandlers: ['self'] from selection/idlharness.window.js, two legitimately failing tests disappear, even though Window: ['window'] is still there. I'll leave it to you to file a bug or add a TODO if there is still a problem here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah; I see your confusion, but essentially you're seeing 2 duplicated failing tests, which are already covered by window (a.k.a. self)

Fail | Window interface: window must inherit property "onselectstart" with the proper type
Fail | Window interface: window must inherit property "onselectionchange" with the proper type

Adding self causes the same 2 tests to be executed on the self object, which is in fact the same as if we added self to the array of Window objects, i.e.

Fail | Window interface: self must inherit property "onselectionchange" with the proper type

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I even searched for and found those tests, but thought that probably they're incorrectly resting that the Window interface object has these attributes. The lower-case "window" means it ain't so. Cool, I'll send a PR to remove that line then.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you already removed it, thanks!

['webxr'],
['html', 'dom'],
idl_array => {
idl_array.add_untested_idls("dictionary WebGLContextAttributes {};");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread resources/idlharness.js Outdated
name && skipped.has(name)
? skipped.get(name).push(parsed)
: skipped.set(name, [parsed]);
(name.includes('Global') || name.includes('Window')) && console.log("Skipped", parsed);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you drop the console.log? It would cause changes to lots of -expected.txt files in Chromium.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep - Left in by mistake (this PR was kinda hard to get right ;) )

Comment thread resources/idlharness.js
const follow_up = new Set();
for (const dep_type of ["inheritance", "implements", "includes"]) {
if (parsed[dep_type]) {
const inheriting = parsed[dep_type];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit hard to tell in the GitHub UI, but for other reviewers, here are the interesting changes. (git diff -w tells me so)

@wpt-pr-bot
wpt-pr-bot requested a review from toji July 25, 2018 08:28
@foolip

foolip commented Jul 25, 2018

Copy link
Copy Markdown
Member

Travis failure is because of #12174

@foolip
foolip merged commit 2fe1bdb into web-platform-tests:master Jul 25, 2018
@lukebjerring
lukebjerring deleted the idlharness-mixins branch August 2, 2018 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants