Closed Bug 1421518 Opened 7 years ago Closed 7 years ago

Add an automation test for new autoplay policy

Categories

(Core :: Audio/Video: Playback, enhancement, P3)

Other Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: alwu, Assigned: alwu)

References

Details

Attachments

(1 file)

Will add a chrome-browser test to ensure the play() can start or fail on different user-gestures scenario.
Comment on attachment 8932724 [details]
Bug 1421518 - add user-gestures test for the autoplay policy.

https://reviewboard.mozilla.org/r/203774/#review210432

::: toolkit/content/tests/browser/browser_autoplay_policy_user_gestures.js:59
(Diff revision 2)
> +  info("- can't autoplay without user activation -");
> +  await canplayPromise;
> +  ok(video.paused, "video can't start without user input.");
> +
> +  info("- call play() without user activation -");
> +  await video.play().catch(function() {

You don't need 'await' if you want to call .then() or .catch() on a promise.

::: toolkit/content/tests/browser/browser_autoplay_policy_user_gestures.js:84
(Diff revision 2)
> +  info("- can't autoplay without user activation -");
> +  await canplayPromise;
> +  ok(video.paused, "video can't start without user input.");
> +
> +  info("- call play() without user activation -");
> +  await video.play().catch(function() {

This test is already done in test_play_without_user_gesture(). You don't need to duplicate the test here.
Attachment #8932724 - Flags: review?(jwwang) → review+
Comment on attachment 8932724 [details]
Bug 1421518 - add user-gestures test for the autoplay policy.

https://reviewboard.mozilla.org/r/203774/#review210450

::: toolkit/content/tests/browser/browser_autoplay_policy_user_gestures.js:59
(Diff revision 2)
> +  info("- can't autoplay without user activation -");
> +  await canplayPromise;
> +  ok(video.paused, "video can't start without user input.");
> +
> +  info("- call play() without user activation -");
> +  await video.play().catch(function() {

That awit is used to keep the code running in correct sequence. If you remove it, the catch might be executed after removeTab().
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/213ae1ab70d4
add user-gestures test for the autoplay policy. r=jwwang
https://hg.mozilla.org/mozilla-central/rev/213ae1ab70d4
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Blocks: 1424113
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: