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 000000000000..7f1833508ab3 Binary files /dev/null and b/dom/media/autoplay/test/browser/audio.ogg differ 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 @@ + + +
+