From 0c0c2f3994e0afcd68371928ae45d8a3d08be416 Mon Sep 17 00:00:00 2001 From: alwu Date: Thu, 5 Nov 2020 06:15:07 +0000 Subject: [PATCH] Bug 1674845 - part4 : add 'browser' subfolder for autoplay browser tests. r=bryce subsuite media for browser tests. Differential Revision: https://phabricator.services.mozilla.com/D95881 --- dom/media/autoplay/moz.build | 2 + dom/media/autoplay/test/browser/audio.ogg | Bin 0 -> 14290 bytes dom/media/autoplay/test/browser/browser.ini | 22 ++++ .../test}/browser/browser_autoplay_policy.js | 3 +- .../browser_autoplay_policy_play_twice.js | 3 +- ...wser_autoplay_policy_request_permission.js | 14 ++- .../browser_autoplay_policy_touchScroll.js | 3 +- .../browser_autoplay_policy_user_gestures.js | 3 +- ...owser_autoplay_policy_webRTC_permission.js | 3 +- .../browser_autoplay_policy_web_audio.js | 3 +- ...wser_autoplay_policy_web_audio_with_gum.js | 0 .../browser/browser_autoplay_videoDocument.js | 3 +- .../autoplay/test/browser/file_empty.html | 8 ++ .../browser/file_mediaplayback_frame.html | 0 .../test/browser/file_nonAutoplayAudio.html | 7 ++ .../autoplay/test/browser/file_video.html | 9 ++ dom/media/autoplay/test/browser/head.js | 105 ++++++++++++++++++ toolkit/content/tests/browser/browser.ini | 36 +----- toolkit/content/tests/browser/head.js | 81 -------------- 19 files changed, 169 insertions(+), 136 deletions(-) create mode 100644 dom/media/autoplay/test/browser/audio.ogg create mode 100644 dom/media/autoplay/test/browser/browser.ini rename {toolkit/content/tests => dom/media/autoplay/test}/browser/browser_autoplay_policy.js (96%) rename {toolkit/content/tests => dom/media/autoplay/test}/browser/browser_autoplay_policy_play_twice.js (93%) rename {toolkit/content/tests => dom/media/autoplay/test}/browser/browser_autoplay_policy_request_permission.js (95%) rename {toolkit/content/tests => dom/media/autoplay/test}/browser/browser_autoplay_policy_touchScroll.js (96%) rename {toolkit/content/tests => dom/media/autoplay/test}/browser/browser_autoplay_policy_user_gestures.js (98%) rename {toolkit/content/tests => dom/media/autoplay/test}/browser/browser_autoplay_policy_webRTC_permission.js (94%) rename {toolkit/content/tests => dom/media/autoplay/test}/browser/browser_autoplay_policy_web_audio.js (98%) rename {toolkit/content/tests => dom/media/autoplay/test}/browser/browser_autoplay_policy_web_audio_with_gum.js (100%) rename {toolkit/content/tests => dom/media/autoplay/test}/browser/browser_autoplay_videoDocument.js (96%) create mode 100644 dom/media/autoplay/test/browser/file_empty.html rename {toolkit/content/tests => dom/media/autoplay/test}/browser/file_mediaplayback_frame.html (100%) create mode 100644 dom/media/autoplay/test/browser/file_nonAutoplayAudio.html create mode 100644 dom/media/autoplay/test/browser/file_video.html create mode 100644 dom/media/autoplay/test/browser/head.js diff --git a/dom/media/autoplay/moz.build b/dom/media/autoplay/moz.build index 1324cb2acef8..338f0798f8f2 100644 --- a/dom/media/autoplay/moz.build +++ b/dom/media/autoplay/moz.build @@ -25,6 +25,8 @@ XPIDL_SOURCES += [ MOCHITEST_MANIFESTS += ["test/mochitest/mochitest.ini"] +BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] + include("/ipc/chromium/chromium-config.mozbuild") FINAL_LIBRARY = "xul" diff --git a/dom/media/autoplay/test/browser/audio.ogg b/dom/media/autoplay/test/browser/audio.ogg new file mode 100644 index 0000000000000000000000000000000000000000..7f1833508ab3fd9e6d4f0241f37cc2ee5a1679e5 GIT binary patch literal 14290 zcmeIZX9ls7xZDgh8-?5P<}gFjRtCMTQUpN+2N#gFprdgEE9zv^WAv7z9Eh z31TZllq3X52nwjJAag(oBr=q$JVgzHwy4<3qrC_Fyzl*g_R?32CE9@ai< zt-YpwayT(D99ReZCq2Ao6}VP>w(0f; z@3b~j3#`3+xHMlR>59wnh`$Z9vR9~K*QJ#k%|0GW?ZG zo_R3+zD|7Bl3eu*I=R=JTJn`WND$(Ft0$Y z4GaK)xx@BsLtlC^%E;+?y*WA0$X936Ie*ivMI7024|IV&;JycdpEIn6L3Z!Yfa?PQd|2rL z04?y~@&7SWv;n|i4*+Oa9oYZ^)CK&s0CN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YR{CF_>t`;N944WY4dMJ1v(?sD;}GA ztcY!QZlkN=;%Hi95!rhXWFZ1UF$Vz0!m6IQ=)K*hd-J;Gej|Y`P=?om>gqcD#;_|l zEcA2cT+;a2*OW`$Y5)rW|81mZD1LsyjN7*m**5G(GxOtcADu@(w5oU zLpzBj^<58zxF^e!mkzb}EW4eoWzzOgwmk%GxY^1Ipgr7veM%O1^X(DUHOXf^0E?y~ zG;O@(f#t{UF{@Q&yOYPiAuAPr&moDkb;&KWfwMnKFI>;D&&xMkV^ literal 0 HcmV?d00001 diff --git a/dom/media/autoplay/test/browser/browser.ini b/dom/media/autoplay/test/browser/browser.ini new file mode 100644 index 000000000000..dfff4b4099b6 --- /dev/null +++ b/dom/media/autoplay/test/browser/browser.ini @@ -0,0 +1,22 @@ +[DEFAULT] +skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 +tags = autoplay +support-files = + ../../../test/gizmo.mp4 + audio.ogg + file_empty.html + file_mediaplayback_frame.html + file_nonAutoplayAudio.html + file_video.html + head.js + +[browser_autoplay_policy.js] +[browser_autoplay_policy_play_twice.js] +[browser_autoplay_policy_user_gestures.js] +[browser_autoplay_policy_request_permission.js] +[browser_autoplay_policy_touchScroll.js] +[browser_autoplay_policy_web_audio.js] +[browser_autoplay_policy_web_audio_with_gum.js] +[browser_autoplay_policy_webRTC_permission.js] +skip-if = true # Bug 1518429 +[browser_autoplay_videoDocument.js] diff --git a/toolkit/content/tests/browser/browser_autoplay_policy.js b/dom/media/autoplay/test/browser/browser_autoplay_policy.js similarity index 96% rename from toolkit/content/tests/browser/browser_autoplay_policy.js rename to dom/media/autoplay/test/browser/browser_autoplay_policy.js index 2d6542bd2125..79b19eedc1e7 100644 --- a/toolkit/content/tests/browser/browser_autoplay_policy.js +++ b/dom/media/autoplay/test/browser/browser_autoplay_policy.js @@ -3,8 +3,7 @@ * under different situations. * Spec discussion : https://github.com/WICG/autoplay/issues/1 */ -const PAGE = - "https://example.com/browser/toolkit/content/tests/browser/file_empty.html"; +const PAGE = GetTestWebBasedURL("file_empty.html"); function setupTestPreferences(isAllowedAutoplay, isAllowedMuted) { let autoplayDefault = SpecialPowers.Ci.nsIAutoplay.ALLOWED; diff --git a/toolkit/content/tests/browser/browser_autoplay_policy_play_twice.js b/dom/media/autoplay/test/browser/browser_autoplay_policy_play_twice.js similarity index 93% rename from toolkit/content/tests/browser/browser_autoplay_policy_play_twice.js rename to dom/media/autoplay/test/browser/browser_autoplay_policy_play_twice.js index 92e66954040c..c87bbdf0f988 100644 --- a/toolkit/content/tests/browser/browser_autoplay_policy_play_twice.js +++ b/dom/media/autoplay/test/browser/browser_autoplay_policy_play_twice.js @@ -1,5 +1,4 @@ -const VIDEO_PAGE = - "https://example.com/browser/toolkit/content/tests/browser/file_video.html"; +const VIDEO_PAGE = GetTestWebBasedURL("file_video.html"); function setup_test_preference(enableUserGesture) { let state = enableUserGesture ? "enable" : "disable"; diff --git a/toolkit/content/tests/browser/browser_autoplay_policy_request_permission.js b/dom/media/autoplay/test/browser/browser_autoplay_policy_request_permission.js similarity index 95% rename from toolkit/content/tests/browser/browser_autoplay_policy_request_permission.js rename to dom/media/autoplay/test/browser/browser_autoplay_policy_request_permission.js index 11453318f39a..f22fb8d1e892 100644 --- a/toolkit/content/tests/browser/browser_autoplay_policy_request_permission.js +++ b/dom/media/autoplay/test/browser/browser_autoplay_policy_request_permission.js @@ -8,12 +8,14 @@ const { PermissionTestUtils } = ChromeUtils.import( "resource://testing-common/PermissionTestUtils.jsm" ); -const VIDEO_PAGE_URI = - "https://example.com/browser/toolkit/content/tests/browser/file_empty.html"; -const SAME_ORIGIN_FRAME_URI = - "https://example.com/browser/toolkit/content/tests/browser/file_mediaplayback_frame.html"; -const DIFFERENT_ORIGIN_FRAME_URI = - "https://example.org/browser/toolkit/content/tests/browser/file_mediaplayback_frame.html"; +const VIDEO_PAGE_URI = GetTestWebBasedURL("file_empty.html"); +const SAME_ORIGIN_FRAME_URI = GetTestWebBasedURL( + "file_mediaplayback_frame.html" +); +const DIFFERENT_ORIGIN_FRAME_URI = GetTestWebBasedURL( + "file_mediaplayback_frame.html", + { crossOrigin: true } +); const gPermissionName = "autoplay-media"; diff --git a/toolkit/content/tests/browser/browser_autoplay_policy_touchScroll.js b/dom/media/autoplay/test/browser/browser_autoplay_policy_touchScroll.js similarity index 96% rename from toolkit/content/tests/browser/browser_autoplay_policy_touchScroll.js rename to dom/media/autoplay/test/browser/browser_autoplay_policy_touchScroll.js index ef9f32bb15f1..fa28bf2943fa 100644 --- a/toolkit/content/tests/browser/browser_autoplay_policy_touchScroll.js +++ b/dom/media/autoplay/test/browser/browser_autoplay_policy_touchScroll.js @@ -5,8 +5,7 @@ /* eslint-disable mozilla/no-arbitrary-setTimeout */ "use strict"; -const PAGE = - "https://example.com/browser/toolkit/content/tests/browser/file_nonAutoplayAudio.html"; +const PAGE = GetTestWebBasedURL("file_nonAutoplayAudio.html"); function checkMediaPlayingState(isPlaying) { let audio = content.document.getElementById("testAudio"); diff --git a/toolkit/content/tests/browser/browser_autoplay_policy_user_gestures.js b/dom/media/autoplay/test/browser/browser_autoplay_policy_user_gestures.js similarity index 98% rename from toolkit/content/tests/browser/browser_autoplay_policy_user_gestures.js rename to dom/media/autoplay/test/browser/browser_autoplay_policy_user_gestures.js index 0b2a70a20feb..bbae6ff034d6 100644 --- a/toolkit/content/tests/browser/browser_autoplay_policy_user_gestures.js +++ b/dom/media/autoplay/test/browser/browser_autoplay_policy_user_gestures.js @@ -1,7 +1,6 @@ /* eslint-disable mozilla/no-arbitrary-setTimeout */ -const VIDEO_PAGE = - "https://example.com/browser/toolkit/content/tests/browser/file_video.html"; +const VIDEO_PAGE = GetTestWebBasedURL("file_video.html"); const UserGestures = { MOUSE_CLICK: "mouse-click", diff --git a/toolkit/content/tests/browser/browser_autoplay_policy_webRTC_permission.js b/dom/media/autoplay/test/browser/browser_autoplay_policy_webRTC_permission.js similarity index 94% rename from toolkit/content/tests/browser/browser_autoplay_policy_webRTC_permission.js rename to dom/media/autoplay/test/browser/browser_autoplay_policy_webRTC_permission.js index f590c5dd3926..9a407db05743 100644 --- a/toolkit/content/tests/browser/browser_autoplay_policy_webRTC_permission.js +++ b/dom/media/autoplay/test/browser/browser_autoplay_policy_webRTC_permission.js @@ -8,8 +8,7 @@ const { PermissionTestUtils } = ChromeUtils.import( "resource://testing-common/PermissionTestUtils.jsm" ); -const VIDEO_PAGE = - "https://example.com/browser/toolkit/content/tests/browser/file_empty.html"; +const VIDEO_PAGE = GetTestWebBasedURL("file_empty.html"); add_task(() => { return SpecialPowers.pushPrefEnv({ diff --git a/toolkit/content/tests/browser/browser_autoplay_policy_web_audio.js b/dom/media/autoplay/test/browser/browser_autoplay_policy_web_audio.js similarity index 98% rename from toolkit/content/tests/browser/browser_autoplay_policy_web_audio.js rename to dom/media/autoplay/test/browser/browser_autoplay_policy_web_audio.js index 9a72665413b3..5eac1398882e 100644 --- a/toolkit/content/tests/browser/browser_autoplay_policy_web_audio.js +++ b/dom/media/autoplay/test/browser/browser_autoplay_policy_web_audio.js @@ -12,8 +12,7 @@ const { PermissionTestUtils } = ChromeUtils.import( "resource://testing-common/PermissionTestUtils.jsm" ); -const PAGE = - "https://example.com/browser/toolkit/content/tests/browser/file_empty.html"; +const PAGE = GetTestWebBasedURL("file_empty.html"); function setup_test_preference() { return SpecialPowers.pushPrefEnv({ diff --git a/toolkit/content/tests/browser/browser_autoplay_policy_web_audio_with_gum.js b/dom/media/autoplay/test/browser/browser_autoplay_policy_web_audio_with_gum.js similarity index 100% rename from toolkit/content/tests/browser/browser_autoplay_policy_web_audio_with_gum.js rename to dom/media/autoplay/test/browser/browser_autoplay_policy_web_audio_with_gum.js diff --git a/toolkit/content/tests/browser/browser_autoplay_videoDocument.js b/dom/media/autoplay/test/browser/browser_autoplay_videoDocument.js similarity index 96% rename from toolkit/content/tests/browser/browser_autoplay_videoDocument.js rename to dom/media/autoplay/test/browser/browser_autoplay_videoDocument.js index 12cf35e9f919..77ce4ddbc11e 100644 --- a/toolkit/content/tests/browser/browser_autoplay_videoDocument.js +++ b/dom/media/autoplay/test/browser/browser_autoplay_videoDocument.js @@ -1,7 +1,6 @@ "use strict"; -const PAGE = - "https://example.com/browser/toolkit/content/tests/browser/audio.ogg"; +const PAGE = GetTestWebBasedURL("audio.ogg"); function setup_test_preference() { return SpecialPowers.pushPrefEnv({ diff --git a/dom/media/autoplay/test/browser/file_empty.html b/dom/media/autoplay/test/browser/file_empty.html new file mode 100644 index 000000000000..d2b0361f091f --- /dev/null +++ b/dom/media/autoplay/test/browser/file_empty.html @@ -0,0 +1,8 @@ + + + + Page left intentionally blank... + + + + diff --git a/toolkit/content/tests/browser/file_mediaplayback_frame.html b/dom/media/autoplay/test/browser/file_mediaplayback_frame.html similarity index 100% rename from toolkit/content/tests/browser/file_mediaplayback_frame.html rename to dom/media/autoplay/test/browser/file_mediaplayback_frame.html diff --git a/dom/media/autoplay/test/browser/file_nonAutoplayAudio.html b/dom/media/autoplay/test/browser/file_nonAutoplayAudio.html new file mode 100644 index 000000000000..4d2641021a13 --- /dev/null +++ b/dom/media/autoplay/test/browser/file_nonAutoplayAudio.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dom/media/autoplay/test/browser/file_video.html b/dom/media/autoplay/test/browser/file_video.html new file mode 100644 index 000000000000..3c70268fbb75 --- /dev/null +++ b/dom/media/autoplay/test/browser/file_video.html @@ -0,0 +1,9 @@ + + + +video + + + + + diff --git a/dom/media/autoplay/test/browser/head.js b/dom/media/autoplay/test/browser/head.js new file mode 100644 index 000000000000..648b6df59df4 --- /dev/null +++ b/dom/media/autoplay/test/browser/head.js @@ -0,0 +1,105 @@ +/** + * Return a web-based URL for a given file based on the testing directory. + * @param {String} fileName + * file that caller wants its web-based url + * @param {Boolean} crossOrigin [optional] + * if set, then return a url with different origin. The default value is + * false. + */ +function GetTestWebBasedURL(fileName, { crossOrigin = false } = {}) { + const origin = crossOrigin ? "http://example.org" : "http://example.com"; + return ( + getRootDirectory(gTestPath).replace("chrome://mochitests/content", origin) + + fileName + ); +} + +/** + * Runs a content script that creates an autoplay video. + * @param {browserElement} browser + * the browser to run the script in + * @param {object} args + * test case definition, required members + * { + * mode: String, "autoplay attribute" or "call play". + * } + */ +function loadAutoplayVideo(browser, args) { + return SpecialPowers.spawn(browser, [args], async args => { + info("- create a new autoplay video -"); + let video = content.document.createElement("video"); + video.id = "v1"; + video.didPlayPromise = new Promise((resolve, reject) => { + video.addEventListener( + "playing", + e => { + video.didPlay = true; + resolve(); + }, + { once: true } + ); + video.addEventListener( + "blocked", + e => { + video.didPlay = false; + resolve(); + }, + { once: true } + ); + }); + if (args.mode == "autoplay attribute") { + info("autoplay attribute set to true"); + video.autoplay = true; + } else if (args.mode == "call play") { + info("will call play() when reached loadedmetadata"); + video.addEventListener( + "loadedmetadata", + e => { + video.play().then( + () => { + info("video play() resolved"); + }, + () => { + info("video play() rejected"); + } + ); + }, + { once: true } + ); + } else { + ok(false, "Invalid 'mode' arg"); + } + video.src = "gizmo.mp4"; + content.document.body.appendChild(video); + }); +} + +/** + * Runs a content script that checks whether the video created by + * loadAutoplayVideo() started playing. + * @param {browserElement} browser + * the browser to run the script in + * @param {object} args + * test case definition, required members + * { + * name: String, description of test. + * mode: String, "autoplay attribute" or "call play". + * shouldPlay: boolean, whether video should play. + * } + */ +function checkVideoDidPlay(browser, args) { + return SpecialPowers.spawn(browser, [args], async args => { + let video = content.document.getElementById("v1"); + await video.didPlayPromise; + is( + video.didPlay, + args.shouldPlay, + args.name + + " should " + + (!args.shouldPlay ? "not " : "") + + "be able to autoplay" + ); + video.src = ""; + content.document.body.remove(video); + }); +} diff --git a/toolkit/content/tests/browser/browser.ini b/toolkit/content/tests/browser/browser.ini index 9ebb1710f7a5..b4acf715b5e3 100644 --- a/toolkit/content/tests/browser/browser.ini +++ b/toolkit/content/tests/browser/browser.ini @@ -8,12 +8,12 @@ support-files = empty.png file_almostSilentAudioTrack.html file_contentTitle.html + file_empty.html file_findinframe.html file_mediaPlayback.html file_mediaPlayback2.html file_mediaPlaybackFrame.html file_mediaPlaybackFrame2.html - file_mediaplayback_frame.html file_multipleAudio.html file_multiplePlayingAudio.html file_nonAutoplayAudio.html @@ -27,40 +27,6 @@ support-files = image_page.html silentAudioTrack.webm -[browser_autoplay_policy.js] -support-files = - file_empty.html -skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 -[browser_autoplay_policy_play_twice.js] -support-files = - gizmo.mp4 - file_video.html -skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 -[browser_autoplay_policy_request_permission.js] -support-files = - file_empty.html - gizmo.mp4 -skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 -[browser_autoplay_policy_user_gestures.js] -support-files = - gizmo.mp4 - file_video.html -skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 -[browser_autoplay_policy_touchScroll.js] -skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 -[browser_autoplay_policy_web_audio.js] -support-files = - file_empty.html -skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 -[browser_autoplay_policy_web_audio_with_gum.js] -skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 -[browser_autoplay_policy_webRTC_permission.js] -skip-if = true # Bug 1518429 -support-files = - file_empty.html - gizmo.mp4 -[browser_autoplay_videoDocument.js] -skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573 [browser_autoscroll_disabled.js] skip-if = true # Bug 1312652 [browser_delay_autoplay_media.js] diff --git a/toolkit/content/tests/browser/head.js b/toolkit/content/tests/browser/head.js index ba70484c1d4c..fb404f483246 100644 --- a/toolkit/content/tests/browser/head.js +++ b/toolkit/content/tests/browser/head.js @@ -279,87 +279,6 @@ function once(target, name) { return p; } -// Runs a content script that creates an autoplay video. -// browser: the browser to run the script in. -// args: test case definition, required members { -// mode: String, "autoplay attribute" or "call play". -// } -function loadAutoplayVideo(browser, args) { - return SpecialPowers.spawn(browser, [args], async args => { - info("- create a new autoplay video -"); - let video = content.document.createElement("video"); - video.id = "v1"; - video.didPlayPromise = new Promise((resolve, reject) => { - video.addEventListener( - "playing", - e => { - video.didPlay = true; - resolve(); - }, - { once: true } - ); - video.addEventListener( - "blocked", - e => { - video.didPlay = false; - resolve(); - }, - { once: true } - ); - }); - if (args.mode == "autoplay attribute") { - info("autoplay attribute set to true"); - video.autoplay = true; - } else if (args.mode == "call play") { - info("will call play() when reached loadedmetadata"); - video.addEventListener( - "loadedmetadata", - e => { - video.play().then( - () => { - info("video play() resolved"); - }, - () => { - info("video play() rejected"); - } - ); - }, - { once: true } - ); - } else { - ok(false, "Invalid 'mode' arg"); - } - video.src = "gizmo.mp4"; - content.document.body.appendChild(video); - }); -} - -// Runs a content script that checks whether the video created by -// loadAutoplayVideo() started playing. -// Parameters: -// browser: the browser to run the script in. -// args: test case definition, required members { -// name: String, description of test. -// mode: String, "autoplay attribute" or "call play". -// shouldPlay: boolean, whether video should play. -// } -function checkVideoDidPlay(browser, args) { - return SpecialPowers.spawn(browser, [args], async args => { - let video = content.document.getElementById("v1"); - await video.didPlayPromise; - is( - video.didPlay, - args.shouldPlay, - args.name + - " should " + - (!args.shouldPlay ? "not " : "") + - "be able to autoplay" - ); - video.src = ""; - content.document.body.remove(video); - }); -} - /** * check if current wakelock is equal to expected state, if not, then wait until * the wakelock changes its state to expected state.