Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing tests for video.removeTextTrack #6594

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gkatsev
Copy link
Contributor

@gkatsev gkatsev commented Jul 20, 2017

These are some failing tests for video.removeTextTrack based on feedback from whatwg/html#1921.
Worked with @egreaves during textAV.tech to finally get it out the door.

As I mentioned in whatwg/html#1921, I think that just removing the in-band track from the TextTrackList rather than throwing would be a better approach as it matches more closely what happens with the track elements. It'll also be a signal to the browser that we don't care about parsing the rest of this track until the source gets reset. However, I'm not sure that's the best approach nor do I know how I would go about writing tests for or against such a track.

In addition, once this method is available, authors that create text tracks and are actively adding cues to tracks would need to do null-checking or what not for removed text track.

Ultimately, I think removeTextTrack and addTextTrack should mirror removing and adding track elements to the video element as closely as possible.

@gkatsev gkatsev changed the title Failing tests for video.removeTextTrack Add failing tests for video.removeTextTrack Jul 20, 2017
@ghost
Copy link

ghost commented Jul 20, 2017

View the complete job log.

Firefox (nightly)

Testing web-platform-tests at revision 733d055
Using browser at version BuildID 20170720100139; SourceStamp 0985725c848ec0cfc6f2f3c3a5aa3d71321e7620
Starting 10 test iterations
All results were stable

All results

1 test ran
/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLMediaElement/removeTextTrack.html
Subtest Results Messages
OK
HTMLMediaElement.removeTextTrack captions FAIL video.removeTextTrack is not a function
HTMLMediaElement.removeTextTrack subtitles FAIL assert_equals: expected 1 but got 2
HTMLMediaElement.removeTextTrack chapters FAIL assert_equals: expected 1 but got 3
HTMLMediaElement.removeTextTrack metadata FAIL assert_equals: expected 1 but got 4
HTMLMediaElement.removeTextTrack descriptions FAIL assert_equals: expected 1 but got 5
HTMLMediaElement.removeTextTrack orphaned track FAIL assert_equals: expected 0 but got 5
HTMLMediaElement.removeTextTrack also remove associated track element FAIL assert_equals: expected 1 but got 6

@ghost
Copy link

ghost commented Jul 20, 2017

View the complete job log.

Sauce (safari)

Testing web-platform-tests at revision 733d055
Using browser at version 10.0
Starting 10 test iterations
All results were stable

All results

1 test ran
/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLMediaElement/removeTextTrack.html
Subtest Results Messages
OK
HTMLMediaElement.removeTextTrack captions FAIL video.removeTextTrack is not a function. (In 'video.removeTextTrack(t)', 'video.removeTextTrack' is undefined)
HTMLMediaElement.removeTextTrack subtitles FAIL assert_equals: expected 1 but got 2
HTMLMediaElement.removeTextTrack chapters FAIL assert_equals: expected 1 but got 3
HTMLMediaElement.removeTextTrack metadata FAIL assert_equals: expected 1 but got 4
HTMLMediaElement.removeTextTrack descriptions FAIL assert_equals: expected 1 but got 5
HTMLMediaElement.removeTextTrack orphaned track FAIL assert_equals: expected 0 but got 5
HTMLMediaElement.removeTextTrack also remove associated track element FAIL assert_equals: expected 1 but got 6

@ghost
Copy link

ghost commented Jul 20, 2017

View the complete job log.

Chrome (unstable)

Testing web-platform-tests at revision 4c0bd4b
Using browser at version 61.0.3159.5 dev
Starting 10 test iterations
All results were stable

All results

1 test ran
/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLMediaElement/removeTextTrack.html
Subtest Results Messages
OK
HTMLMediaElement.removeTextTrack captions FAIL video.removeTextTrack is not a function
HTMLMediaElement.removeTextTrack subtitles FAIL assert_equals: expected 1 but got 2
HTMLMediaElement.removeTextTrack chapters FAIL assert_equals: expected 1 but got 3
HTMLMediaElement.removeTextTrack metadata FAIL assert_equals: expected 1 but got 4
HTMLMediaElement.removeTextTrack descriptions FAIL assert_equals: expected 1 but got 5
HTMLMediaElement.removeTextTrack orphaned track FAIL assert_equals: expected 0 but got 5
HTMLMediaElement.removeTextTrack also remove associated track element FAIL assert_equals: expected 1 but got 6

@ghost
Copy link

ghost commented Jul 20, 2017

View the complete job log.

Sauce (MicrosoftEdge)

Testing web-platform-tests at revision 4c0bd4b
Using browser at version 14.14393
Starting 10 test iterations
All results were stable

All results

1 test ran
/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLMediaElement/removeTextTrack.html
Subtest Results Messages
OK
HTMLMediaElement.removeTextTrack captions FAIL Object doesn't support property or method 'removeTextTrack'
HTMLMediaElement.removeTextTrack subtitles FAIL assert_equals: expected 1 but got 2
HTMLMediaElement.removeTextTrack chapters FAIL assert_equals: expected 1 but got 3
HTMLMediaElement.removeTextTrack metadata FAIL assert_equals: expected 1 but got 4
HTMLMediaElement.removeTextTrack descriptions FAIL assert_equals: expected 1 but got 5
HTMLMediaElement.removeTextTrack orphaned track FAIL assert_equals: expected 0 but got 5
HTMLMediaElement.removeTextTrack also remove associated track element FAIL assert_equals: expected 1 but got 6

@sideshowbarker
Copy link
Contributor

w3c-test:mirror

foolip added a commit to whatwg/html that referenced this pull request Aug 1, 2017
Copy link
Member

@foolip foolip left a comment

Choose a reason for hiding this comment

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

Good tests, thank you! What's missing both here and in the spec is some idea about how in-band text tracks should work. Have you tested if any browser supports in-band text tracks so that writing a test is at all possible?

assert_false(video.contains(tel));
assert_equals(video.textTracks.length, 0);

}, document.title + ' also remove associated track element');
Copy link
Member

Choose a reason for hiding this comment

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

Could you also test that the removetrack event is fired?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. We forgot about that when writing these :)

assert_equals(video.textTracks.length, 0);
assert_throws('NOT_FOUND_ERROR', function() {
video.removeTextTrack(t);
}, 'standalone');
Copy link
Member

Choose a reason for hiding this comment

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

The assertion description ('standalone') isn't needed here, crafting useful descriptions is hard so if there's just one assert_throws in a test I don't bother, one can tell from the error message what has failed anyway.

}, 'standalone');
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 0);
}, document.title + ' orphaned track');
Copy link
Member

Choose a reason for hiding this comment

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

In addition to this, can you try removing a track which isn't from a dangling track element, but attached to another media element? If the order of steps in the spec were different, that could accidentally work, which would be curious.

video.removeTextTrack(t);
assert_equals(video.textTracks, video.textTracks);
assert_equals(video.textTracks.length, 0);
}, document.title + ' captions');
Copy link
Member

Choose a reason for hiding this comment

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

I think it's probably fine to only test one of these cases, but if you do want to keep them all, you can do something like ['captions', 'subtitles', ...].forEach(function(kind) { test(...) }) to avoid repeating the body of the test so many times.

@gkatsev
Copy link
Contributor Author

gkatsev commented Aug 1, 2017

Safari does support in-band metadata tracks. I could look into writing a test for it.

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