From cc6523154158282d2341ae5d102ac169bc2feb5e Mon Sep 17 00:00:00 2001 From: Florin Strugariu Date: Thu, 5 Dec 2019 14:06:38 +0000 Subject: [PATCH] Bug 1593674 - remove marionette VideoStream YouTube test as it's duplicated in raptor r=tarek,marionette-reviewers,whimboo Differential Revision: https://phabricator.services.mozilla.com/D52820 --HG-- extra : moz-landing-system : lando --- .eslintignore | 2 - dom/media/moz.build | 4 - dom/media/test/marionette/manifest.ini | 4 - dom/media/test/marionette/test_youtube.py | 22 - .../marionette/yttest/BZP1rYjoBgI.manifest | 10 - dom/media/test/marionette/yttest/__init__.py | 1 - .../test/marionette/yttest/debug_info.js | 20 - dom/media/test/marionette/yttest/download.py | 17 - .../test/marionette/yttest/duration_test.js | 23 - dom/media/test/marionette/yttest/force_hd.js | 91 --- dom/media/test/marionette/yttest/playback.py | 663 ------------------ dom/media/test/marionette/yttest/record.py | 34 - dom/media/test/marionette/yttest/support.py | 108 --- .../marionette/yttest/uR0N3DrybGQ.manifest | 10 - .../test/marionette/yttest/until_end_test.js | 20 - .../yttest/video_playback_quality.js | 2 - dom/media/test/marionette/yttest/ytpage.py | 118 ---- .../mozbuild/mozbuild/action/test_archive.py | 1 - python/mozbuild/mozbuild/frontend/context.py | 4 - taskcluster/ci/test/marionette.yml | 10 - taskcluster/ci/test/test-platforms.yml | 6 - taskcluster/ci/test/test-sets.yml | 3 - .../marionette_harness/tests/stream-tests.ini | 2 - 23 files changed, 1175 deletions(-) delete mode 100644 dom/media/test/marionette/manifest.ini delete mode 100644 dom/media/test/marionette/test_youtube.py delete mode 100644 dom/media/test/marionette/yttest/BZP1rYjoBgI.manifest delete mode 100644 dom/media/test/marionette/yttest/__init__.py delete mode 100644 dom/media/test/marionette/yttest/debug_info.js delete mode 100644 dom/media/test/marionette/yttest/download.py delete mode 100644 dom/media/test/marionette/yttest/duration_test.js delete mode 100644 dom/media/test/marionette/yttest/force_hd.js delete mode 100644 dom/media/test/marionette/yttest/playback.py delete mode 100644 dom/media/test/marionette/yttest/record.py delete mode 100644 dom/media/test/marionette/yttest/support.py delete mode 100644 dom/media/test/marionette/yttest/uR0N3DrybGQ.manifest delete mode 100644 dom/media/test/marionette/yttest/until_end_test.js delete mode 100644 dom/media/test/marionette/yttest/video_playback_quality.js delete mode 100644 dom/media/test/marionette/yttest/ytpage.py delete mode 100644 testing/marionette/harness/marionette_harness/tests/stream-tests.ini diff --git a/.eslintignore b/.eslintignore index 7df403a5557b..5cdda9ad9dee 100644 --- a/.eslintignore +++ b/.eslintignore @@ -149,8 +149,6 @@ dom/encoding/test/file_utf16_be_bom.js dom/encoding/test/file_utf16_le_bom.js # Not parsable -dom/media/test/marionette/yttest/duration_test.js -dom/media/test/marionette/yttest/until_end_test.js dom/tests/mochitest/general/test_focusrings.xul dom/html/test/test_bug677658.html diff --git a/dom/media/moz.build b/dom/media/moz.build index 972a961a81e8..1184bbf11312 100644 --- a/dom/media/moz.build +++ b/dom/media/moz.build @@ -380,7 +380,3 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc'): ] FINAL_LIBRARY = 'xul' - -MARIONETTE_DOM_MEDIA_MANIFESTS += [ - 'test/marionette/manifest.ini' -] diff --git a/dom/media/test/marionette/manifest.ini b/dom/media/test/marionette/manifest.ini deleted file mode 100644 index 687a7f50da34..000000000000 --- a/dom/media/test/marionette/manifest.ini +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -run-if = buildapp == 'browser' - -[test_youtube.py] diff --git a/dom/media/test/marionette/test_youtube.py b/dom/media/test/marionette/test_youtube.py deleted file mode 100644 index 89b87d1adb58..000000000000 --- a/dom/media/test/marionette/test_youtube.py +++ /dev/null @@ -1,22 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this file, -# You can obtain one at http://mozilla.org/MPL/2.0/. -import sys -import os - -sys.path.append(os.path.dirname(__file__)) -from yttest.support import VideoStreamTestCase - - -class YoutubeTest(VideoStreamTestCase): - - # bug 1513511 - def test_stream_4K(self): - with self.youtube_video("uR0N3DrybGQ", duration=15) as page: - res = page.run_test() - self.assertVideoQuality(res) - - def test_stream_480p(self): - with self.youtube_video("BZP1rYjoBgI", duration=15) as page: - res = page.run_test() - self.assertVideoQuality(res) diff --git a/dom/media/test/marionette/yttest/BZP1rYjoBgI.manifest b/dom/media/test/marionette/yttest/BZP1rYjoBgI.manifest deleted file mode 100644 index 30ab8e83a3f8..000000000000 --- a/dom/media/test/marionette/yttest/BZP1rYjoBgI.manifest +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "size": 20396656, - "visibility": "public", - "digest": "ccdecb515cadd243608898f38d74c23162fccb9246fee3084834c23d3a57710ed24c7c5dcc9b8bc6f5c3acb5fc0f3be144de08aa14d93e7dbbd372ec6166c138", - "algorithm": "sha512", - "filename": "BZP1rYjoBgI.tar.gz", - "unpack": true - } -] diff --git a/dom/media/test/marionette/yttest/__init__.py b/dom/media/test/marionette/yttest/__init__.py deleted file mode 100644 index 792d6005489e..000000000000 --- a/dom/media/test/marionette/yttest/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# diff --git a/dom/media/test/marionette/yttest/debug_info.js b/dom/media/test/marionette/yttest/debug_info.js deleted file mode 100644 index a7d3fe3d0a4b..000000000000 --- a/dom/media/test/marionette/yttest/debug_info.js +++ /dev/null @@ -1,20 +0,0 @@ -/* global video, result, resolve */ - -video.mozRequestDebugInfo().then(debugInfo => { - // The parsing won't be necessary once we have bug 1542674 - try { - debugInfo = debugInfo.replace(/\t/g, "").split(/\n/g); - var JSONDebugInfo = "{"; - for (let g = 0; g < debugInfo.length - 1; g++) { - var pair = debugInfo[g].split(": "); - JSONDebugInfo += '"' + pair[0] + '":"' + pair[1] + '",'; - } - JSONDebugInfo = JSONDebugInfo.slice(0, JSONDebugInfo.length - 1); - JSONDebugInfo += "}"; - result.mozRequestDebugInfo = JSON.parse(JSONDebugInfo); - } catch (err) { - console.log(`Error '${err.toString()} in JSON.parse(${debugInfo})`); - result.mozRequestDebugInfo = debugInfo; - } - resolve(result); -}); diff --git a/dom/media/test/marionette/yttest/download.py b/dom/media/test/marionette/yttest/download.py deleted file mode 100644 index 69b9edaab608..000000000000 --- a/dom/media/test/marionette/yttest/download.py +++ /dev/null @@ -1,17 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this file, -# You can obtain one at http://mozilla.org/MPL/2.0/. -import sys -from pytube import YouTube - - -def download_streams(video_id, output_path="data"): - yt = YouTube("https://youtube.com/watch?v=%s" % video_id) - for stream in yt.streams.all(): - fn = "%s-%s-%s.%s" % (video_id, stream.itag, stream.type, stream.subtype) - stream.download(output_path="data", filename=fn) - print("%s downloaded" % fn) - - -if __name__ == "__main__": - download_streams(sys.argv[-1]) diff --git a/dom/media/test/marionette/yttest/duration_test.js b/dom/media/test/marionette/yttest/duration_test.js deleted file mode 100644 index 3ebeb1055ed1..000000000000 --- a/dom/media/test/marionette/yttest/duration_test.js +++ /dev/null @@ -1,23 +0,0 @@ -%(force_hd)s - -const resolve = arguments[arguments.length - 1]; - -// this script is injected by marionette to collect metrics -var video = document.getElementsByTagName("video")[0]; -if (!video) { - return "Can't find the video tag"; -} - -video.addEventListener("timeupdate", () => { - if (video.currentTime >= %(duration)s) { - %(video_playback_quality)s - %(debug_info)s - // Pausing after we get the debug info so - // we can also look at in/out data in buffers - video.pause(); - } - } -); - -video.play(); - diff --git a/dom/media/test/marionette/yttest/force_hd.js b/dom/media/test/marionette/yttest/force_hd.js deleted file mode 100644 index 03c9c1efdd8a..000000000000 --- a/dom/media/test/marionette/yttest/force_hd.js +++ /dev/null @@ -1,91 +0,0 @@ -// This parts forces the highest definition -// https://addons.mozilla.org/en-US/firefox/addon/youtube-auto-hd-lq/ -// licence: MPL 2.0 -var config = { - HD: true, - LQ: false, - ID: "auto-hd-lq-for-ytb", - type(t) { - config.HD = t === "hd"; - config.LQ = t === "lq"; - }, - quality() { - if (config.HD || config.LQ) { - var youtubePlayerListener = function(LQ, HD) { - return function(e) { - if (e === 1) { - var player = document.getElementById("movie_player"); - if (player) { - var levels = player.getAvailableQualityLevels(); - if (levels.length) { - var q = - // eslint-disable-next-line no-nested-ternary - HD && levels[0] - ? levels[0] - : LQ && levels[levels.length - 2] - ? levels[levels.length - 2] - : null; - if (q) { - player.setPlaybackQuality(q); - player.setPlaybackQualityRange(q, q); - } - } - } - } - }; - }; - /* */ - var inject = function() { - var action = function() { - var player = document.getElementById("movie_player"); - if (player && player.addEventListener && player.getPlayerState) { - player.addEventListener("onStateChange", "youtubePlayerListener"); - } else { - window.setTimeout(action, 1000); - } - }; - /* */ - action(); - }; - var script = document.getElementById(config.ID); - if (!script) { - script = document.createElement("script"); - script.setAttribute("type", "text/javascript"); - script.setAttribute("id", config.ID); - document.documentElement.appendChild(script); - } - /* */ - script.textContent = - "var youtubePlayerListener = (" + - youtubePlayerListener + - ")(" + - config.LQ + - "," + - config.HD + - ");(" + - inject + - ")();"; - } - }, -}; - -if (/^https?:\/\/www\.youtube.com\/watch\?/.test(document.location.href)) { - config.quality(); -} -var content = document.getElementById("content"); -if (content) { - var observer = new window.MutationObserver(function(e) { - e.forEach(function(m) { - if (m.addedNodes !== null) { - for (var i = 0; i < m.addedNodes.length; i++) { - if (m.addedNodes[i].id === "movie_player") { - config.quality(); - return; - } - } - } - }); - }); - /* */ - observer.observe(content, { childList: true, subtree: true }); -} diff --git a/dom/media/test/marionette/yttest/playback.py b/dom/media/test/marionette/yttest/playback.py deleted file mode 100644 index 67c74d1ad519..000000000000 --- a/dom/media/test/marionette/yttest/playback.py +++ /dev/null @@ -1,663 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this file, -# You can obtain one at http://mozilla.org/MPL/2.0/. -""" -MITM Script used to play back media files when a YT video is played. - -This is a self-contained script that should not import anything else -except modules from the standard library and mitmproxy modules. -""" -import os -import sys -import datetime -import time - -try: - from urllib import unquote -except ImportError: - from urllib.parse import unquote - - -itags = { - "5": { - "Extension": "flv", - "Resolution": "240p", - "VideoEncoding": "Sorenson H.283", - "AudioEncoding": "mp3", - "Itag": 5, - "AudioBitrate": 64, - }, - "6": { - "Extension": "flv", - "Resolution": "270p", - "VideoEncoding": "Sorenson H.263", - "AudioEncoding": "mp3", - "Itag": 6, - "AudioBitrate": 64, - }, - "13": { - "Extension": "3gp", - "Resolution": "", - "VideoEncoding": "MPEG-4 Visual", - "AudioEncoding": "aac", - "Itag": 13, - "AudioBitrate": 0, - }, - "17": { - "Extension": "3gp", - "Resolution": "144p", - "VideoEncoding": "MPEG-4 Visual", - "AudioEncoding": "aac", - "Itag": 17, - "AudioBitrate": 24, - }, - "18": { - "Extension": "mp4", - "Resolution": "360p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 18, - "AudioBitrate": 96, - }, - "22": { - "Extension": "mp4", - "Resolution": "720p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 22, - "AudioBitrate": 192, - }, - "34": { - "Extension": "flv", - "Resolution": "480p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 34, - "AudioBitrate": 128, - }, - "35": { - "Extension": "flv", - "Resolution": "360p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 35, - "AudioBitrate": 128, - }, - "36": { - "Extension": "3gp", - "Resolution": "240p", - "VideoEncoding": "MPEG-4 Visual", - "AudioEncoding": "aac", - "Itag": 36, - "AudioBitrate": 36, - }, - "37": { - "Extension": "mp4", - "Resolution": "1080p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 37, - "AudioBitrate": 192, - }, - "38": { - "Extension": "mp4", - "Resolution": "3072p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 38, - "AudioBitrate": 192, - }, - "43": { - "Extension": "webm", - "Resolution": "360p", - "VideoEncoding": "VP8", - "AudioEncoding": "vorbis", - "Itag": 43, - "AudioBitrate": 128, - }, - "44": { - "Extension": "webm", - "Resolution": "480p", - "VideoEncoding": "VP8", - "AudioEncoding": "vorbis", - "Itag": 44, - "AudioBitrate": 128, - }, - "45": { - "Extension": "webm", - "Resolution": "720p", - "VideoEncoding": "VP8", - "AudioEncoding": "vorbis", - "Itag": 45, - "AudioBitrate": 192, - }, - "46": { - "Extension": "webm", - "Resolution": "1080p", - "VideoEncoding": "VP8", - "AudioEncoding": "vorbis", - "Itag": 46, - "AudioBitrate": 192, - }, - "82": { - "Extension": "mp4", - "Resolution": "360p", - "VideoEncoding": "H.264", - "Itag": 82, - "AudioBitrate": 96, - }, - "83": { - "Extension": "mp4", - "Resolution": "240p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 83, - "AudioBitrate": 96, - }, - "84": { - "Extension": "mp4", - "Resolution": "720p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 84, - "AudioBitrate": 192, - }, - "85": { - "Extension": "mp4", - "Resolution": "1080p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 85, - "AudioBitrate": 192, - }, - "100": { - "Extension": "webm", - "Resolution": "360p", - "VideoEncoding": "VP8", - "AudioEncoding": "vorbis", - "Itag": 100, - "AudioBitrate": 128, - }, - "101": { - "Extension": "webm", - "Resolution": "360p", - "VideoEncoding": "VP8", - "AudioEncoding": "vorbis", - "Itag": 101, - "AudioBitrate": 192, - }, - "102": { - "Extension": "webm", - "Resolution": "720p", - "VideoEncoding": "VP8", - "AudioEncoding": "vorbis", - "Itag": 102, - "AudioBitrate": 192, - }, - "133": { - "Extension": "mp4", - "Resolution": "240p", - "VideoEncoding": "H.264", - "AudioEncoding": "", - "Itag": 133, - "AudioBitrate": 0, - }, - "134": { - "Extension": "mp4", - "Resolution": "360p", - "VideoEncoding": "H.264", - "AudioEncoding": "", - "Itag": 134, - "AudioBitrate": 0, - }, - "135": { - "Extension": "mp4", - "Resolution": "480p", - "VideoEncoding": "H.264", - "AudioEncoding": "", - "Itag": 135, - "AudioBitrate": 0, - }, - "136": { - "Extension": "mp4", - "Resolution": "720p", - "VideoEncoding": "H.264", - "AudioEncoding": "", - "Itag": 136, - "AudioBitrate": 0, - }, - "137": { - "Extension": "mp4", - "Resolution": "1080p", - "VideoEncoding": "H.264", - "AudioEncoding": "", - "Itag": 137, - "AudioBitrate": 0, - }, - "138": { - "Extension": "mp4", - "Resolution": "2160p", - "VideoEncoding": "H.264", - "AudioEncoding": "", - "Itag": 138, - "AudioBitrate": 0, - }, - "160": { - "Extension": "mp4", - "Resolution": "144p", - "VideoEncoding": "H.264", - "AudioEncoding": "", - "Itag": 160, - "AudioBitrate": 0, - }, - "242": { - "Extension": "webm", - "Resolution": "240p", - "VideoEncoding": "VP9", - "AudioEncoding": "", - "Itag": 242, - "AudioBitrate": 0, - }, - "243": { - "Extension": "webm", - "Resolution": "360p", - "VideoEncoding": "VP9", - "AudioEncoding": "", - "Itag": 243, - "AudioBitrate": 0, - }, - "244": { - "Extension": "webm", - "Resolution": "480p", - "VideoEncoding": "VP9", - "AudioEncoding": "", - "Itag": 244, - "AudioBitrate": 0, - }, - "247": { - "Extension": "webm", - "Resolution": "720p", - "VideoEncoding": "VP9", - "AudioEncoding": "", - "Itag": 247, - "AudioBitrate": 0, - }, - "248": { - "Extension": "webm", - "Resolution": "1080p", - "VideoEncoding": "VP9", - "AudioEncoding": "", - "Itag": 248, - "AudioBitrate": 9, - }, - "264": { - "Extension": "mp4", - "Resolution": "1440p", - "VideoEncoding": "H.264", - "AudioEncoding": "", - "Itag": 264, - "AudioBitrate": 0, - }, - "266": { - "Extension": "mp4", - "Resolution": "2160p", - "VideoEncoding": "H.264", - "AudioEncoding": "", - "Itag": 266, - "AudioBitrate": 0, - }, - "271": { - "Extension": "webm", - "Resolution": "1440p", - "VideoEncoding": "VP9", - "AudioEncoding": "", - "Itag": 271, - "AudioBitrate": 0, - }, - "272": { - "Extension": "webm", - "Resolution": "2160p", - "VideoEncoding": "VP9", - "AudioEncoding": "", - "Itag": 272, - "AudioBitrate": 0, - }, - "278": { - "Extension": "webm", - "Resolution": "144p", - "VideoEncoding": "VP9", - "AudioEncoding": "", - "Itag": 278, - "AudioBitrate": 0, - }, - "298": { - "Extension": "mp4", - "Resolution": "720p", - "VideoEncoding": "H.264", - "AudioEncoding": "", - "Itag": 298, - "AudioBitrate": 0, - }, - "299": { - "Extension": "mp4", - "Resolution": "1080p", - "VideoEncoding": "H.264", - "AudioEncoding": "", - "Itag": 299, - "AudioBitrate": 0, - }, - "302": { - "Extension": "webm", - "Resolution": "720p", - "VideoEncoding": "VP9", - "AudioEncoding": "", - "Itag": 302, - "AudioBitrate": 0, - }, - "303": { - "Extension": "webm", - "Resolution": "1080p", - "VideoEncoding": "VP9", - "AudioEncoding": "", - "Itag": 303, - "AudioBitrate": 0, - }, - "139": { - "Extension": "mp4", - "Resolution": "", - "VideoEncoding": "", - "AudioEncoding": "aac", - "Itag": 139, - "AudioBitrate": 48, - }, - "140": { - "Extension": "mp4", - "Resolution": "", - "VideoEncoding": "", - "AudioEncoding": "aac", - "Itag": 140, - "AudioBitrate": 128, - }, - "141": { - "Extension": "mp4", - "Resolution": "", - "VideoEncoding": "", - "AudioEncoding": "aac", - "Itag": 141, - "AudioBitrate": 256, - }, - "171": { - "Extension": "webm", - "Resolution": "", - "VideoEncoding": "", - "AudioEncoding": "vorbis", - "Itag": 171, - "AudioBitrate": 128, - }, - "172": { - "Extension": "webm", - "Resolution": "", - "VideoEncoding": "", - "AudioEncoding": "vorbis", - "Itag": 172, - "AudioBitrate": 192, - }, - "249": { - "Extension": "webm", - "Resolution": "", - "VideoEncoding": "", - "AudioEncoding": "opus", - "Itag": 249, - "AudioBitrate": 50, - }, - "250": { - "Extension": "webm", - "Resolution": "", - "VideoEncoding": "", - "AudioEncoding": "opus", - "Itag": 250, - "AudioBitrate": 70, - }, - "251": { - "Extension": "webm", - "Resolution": "", - "VideoEncoding": "", - "AudioEncoding": "opus", - "Itag": 251, - "AudioBitrate": 160, - }, - "92": { - "Extension": "ts", - "Resolution": "240p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 92, - "AudioBitrate": 48, - }, - "93": { - "Extension": "ts", - "Resolution": "480p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 93, - "AudioBitrate": 128, - }, - "94": { - "Extension": "ts", - "Resolution": "720p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 94, - "AudioBitrate": 128, - }, - "95": { - "Extension": "ts", - "Resolution": "1080p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 95, - "AudioBitrate": 256, - }, - "96": { - "Extension": "ts", - "Resolution": "720p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 96, - "AudioBitrate": 256, - }, - "120": { - "Extension": "flv", - "Resolution": "720p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 120, - "AudioBitrate": 128, - }, - "127": { - "Extension": "ts", - "Resolution": "", - "VideoEncoding": "", - "AudioEncoding": "aac", - "Itag": 127, - "AudioBitrate": 96, - }, - "128": { - "Extension": "ts", - "Resolution": "", - "VideoEncoding": "", - "AudioEncoding": "aac", - "Itag": 128, - "AudioBitrate": 96, - }, - "132": { - "Extension": "ts", - "Resolution": "240p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 132, - "AudioBitrate": 48, - }, - "151": { - "Extension": "ts", - "Resolution": "720p", - "VideoEncoding": "H.264", - "AudioEncoding": "aac", - "Itag": 151, - "AudioBitrate": 24, - }, -} - - -def repr_itag(itag): - itag_info = [" %s: %s" % (k, v) for k, v in get_itag_info(itag).items()] - return "\n".join(itag_info) - - -def get_itag_info(itag): - if itag not in itags: - # unknown itag... - # XXX this could be an issue - return {"Itag": itag, "Error": "Unknown"} - return itags[itag] - - -def log(msg): - print(msg) - - -_HERE = os.path.dirname(__file__) -if "MOZPROXY_DIR" in os.environ: - _DEFAULT_DATA_DIR = os.environ["MOZPROXY_DIR"] -else: - _DEFAULT_DATA_DIR = os.path.join(_HERE, "..", "data") - -_HEADERS = { - b"Last-Modified": b"Mon, 10 Dec 2018 19:39:24 GMT", - b"Content-Type": b"video/webm", - b"Date": b"Wed, 02 Jan 2019 15:14:06 GMT", - b"Expires": b"Wed, 02 Jan 2019 15:14:06 GMT", - b"Cache-Control": b"private, max-age=21292", - b"Accept-Ranges": b"bytes", - b"Content-Length": b"173448", - b"Connection": b"keep-alive", - b"Alt-Svc": b'quic=":443"; ma=2592000; v="44,43,39,35"', - b"Access-Control-Allow-Origin": b"https://www.youtube.com", - b"Access-Control-Allow-Credentials": b"true", - b"Timing-Allow-Origin": b"https://www.youtube.com", - b"Access-Control-Expose-Headers": ( - b"Client-Protocol, Content-Length, " - b"Content-Type, X-Bandwidth-Est, " - b"X-Bandwidth-Est2, X-Bandwidth-Est3, " - b"X-Bandwidth-App-Limited, " - b"X-Bandwidth-Est-App-Limited, " - b"X-Bandwidth-Est-Comp, X-Bandwidth-Avg, " - b"X-Head-Time-Millis, X-Head-Time-Sec, " - b"X-Head-Seqnum, X-Response-Itag, " - b"X-Restrict-Formats-Hint, " - b"X-Sequence-Num, X-Segment-Lmt, " - b"X-Walltime-Ms" - ), - b"X-Restrict-Formats-Hint": b"None", - b"X-Content-Type-Options": b"nosniff", - b"Server": b"gvs 1.0", -} - - -def get_cached_data(request, datadir=_DEFAULT_DATA_DIR): - query_args = dict(request.query) - mime = query_args["mime"] - file_id = query_args["id"] - file_range = query_args["range"] - itag = query_args["itag"] - log("Request File %s - %s" % (file_id, mime)) - log("Requested range %s" % file_range) - log("Requested quality\n%s" % repr_itag(itag)) - frange = file_range.split("-") - range_start, range_end = int(frange[0]), int(frange[1]) - video_id = sys.argv[-1].split(".")[0] - fn = "%s-%s-%s.%s" % (video_id, itag, mime.replace("/", ""), mime.split("/")[-1]) - fn = os.path.join(datadir, fn) - if not os.path.exists(fn): - raise Exception("no file at %s" % fn) - with open(fn, "rb") as f: - data = f.read() - data = data[range_start : range_end + 1] # noqa: E203 - headers = dict(_HEADERS) - headers[b"Content-Type"] = bytes(mime, "utf8") - headers[b"Content-Length"] = bytes(str(len(data)), "utf8") - return headers.items(), data - - -def OK(flow, code=204): - """ Sending back a dummy response. - - 204 is the default in most cases on YT requests. - """ - from mitmproxy import http - - flow.error = None - flow.response = http.HTTPResponse(b"HTTP/1.1", code, b"OK", {}, b"") - - -def request(flow): - # in some cases, the YT client sends requests with a methode of the form: - # VAR=XX%3GET /xxx - # this will clean it up: - method = flow.request.method - method = unquote(method).split("=") - flow.request.method = method[-1] - - # All requests made for stats purposes can be discarded and - # a 204 sent back to the client. - if flow.request.url.startswith("https://www.youtube.com/ptracking"): - OK(flow) - return - if flow.request.url.startswith("https://www.youtube.com/api/stats/playback"): - OK(flow) - return - if flow.request.url.startswith("https://www.youtube.com/api/stats/watchtime"): - OK(flow) - return - # disable a few trackers, sniffers, etc - if "push.services.mozilla.com" in flow.request.url: - OK(flow, code=200) - return - if "tracking-protection.cdn.mozilla.net" in flow.request.url: - OK(flow, code=200) - return - if "gen_204" in flow.request.url: - OK(flow) - return - - # we don't want to post back any data, discarding. - if flow.request.method == "POST": - OK(flow) - return - if "googlevideo.com/videoplayback" in flow.request.url: - from mitmproxy import http - - query_args = dict(flow.request.query) - file_id = query_args["id"] - file_range = query_args["range"] - try: - headers, data = get_cached_data(flow.request) - except Exception: - OK(flow, code=404) - return - headers = list(headers) - flow.error = None - flow.response = http.HTTPResponse(b"HTTP/1.1", 200, b"OK", headers, data) - now = datetime.datetime.now() - then = now - datetime.timedelta(hours=1) - flow.response.timestamp_start = time.mktime(then.timetuple()) - flow.response.refresh() - log("SENT FILE %s IN CACHE - range %s" % (file_id, file_range)) - - -def error(flow): - print("\n\n\n\nERROR %s\n\n\n\n" % flow.error.msg) - - -def tcp_error(flow): - print("\n\n\n\nTCP ERROR %s\n\n\n\n" % flow.error.msg) diff --git a/dom/media/test/marionette/yttest/record.py b/dom/media/test/marionette/yttest/record.py deleted file mode 100644 index b0bde6f01efa..000000000000 --- a/dom/media/test/marionette/yttest/record.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -MITM Script used to collect media files when a YT video is played. - -This is a self-contained script that should not import anything else -except modules from the standard library and mitmproxy modules. -""" -import os - - -_HERE = os.path.dirname(__file__) -if "MOZPROXY_DIR" in os.environ: - _DEFAULT_DATA_DIR = os.environ["MOZPROXY_DIR"] -else: - _DEFAULT_DATA_DIR = os.path.join(_HERE, "..", "data") - - -def response(flow): - print(flow.request.url) - if "googlevideo.com/videoplayback" in flow.request.url: - itag = flow.request.query["itag"] - mime = flow.request.query["mime"].replace("/", "-") - query_args = dict(flow.request.query) - file_id = query_args["id"] - file_range = query_args["range"] - print("Writing %s:%s" % (file_id, file_range)) - # changing the host so the MITM recording file - # does not rely on a specific YT server - flow.request.host = "googlevideo.com" - if len(flow.response.content) == 0: - return - path = "%s-%s-%s.%s" % (file_id, itag, file_range, mime) - path = os.path.join(_DEFAULT_DATA_DIR, path) - with open(path, "wb") as f: - f.write(flow.response.content) diff --git a/dom/media/test/marionette/yttest/support.py b/dom/media/test/marionette/yttest/support.py deleted file mode 100644 index 3c116b09e1a9..000000000000 --- a/dom/media/test/marionette/yttest/support.py +++ /dev/null @@ -1,108 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this file, -# You can obtain one at http://mozilla.org/MPL/2.0/. -import sys -import os -from contextlib import contextmanager - -from mozproxy import get_playback -import mozinfo -import mozlog -from marionette_harness.marionette_test import MarionetteTestCase -from yttest.ytpage import using_page - - -mozlog.commandline.setup_logging("mozproxy", {}, {"tbpl": sys.stdout}) -here = os.path.dirname(__file__) -playback_script = os.path.join(here, "playback.py") - - -class VideoStreamTestCase(MarionetteTestCase): - def setUp(self): - MarionetteTestCase.setUp(self) - if "MOZ_UPLOAD_DIR" not in os.environ: - os.environ["OBJ_PATH"] = "/tmp/" - self.marionette.set_pref("media.autoplay.default", 1) - self.marionette.set_pref("privacy.trackingprotection.enabled", False) - - @contextmanager - def using_proxy(self, video_id): - config = {} - config["binary"] = self.marionette.bin - config["app"] = "firefox" - config["platform"] = mozinfo.os - config["processor"] = mozinfo.processor - config["run_local"] = "MOZ_UPLOAD_DIR" not in os.environ - - if "MOZ_UPLOAD_DIR" not in os.environ: - config["obj_path"] = os.environ["OBJ_PATH"] - playback_dir = os.path.join(config["obj_path"], "testing", "mozproxy") - else: - root_dir = os.path.dirname(os.path.dirname(os.environ["MOZ_UPLOAD_DIR"])) - playback_dir = os.path.join(root_dir, "testing", "mozproxy") - - config["host"] = "localhost" - config["playback_tool"] = "mitmproxy" - config["playback_artifacts"] = os.path.join(here, "%s.manifest" % video_id) - - # XXX once Bug 1540622 lands, we can use the version here - # config["playback_version"] = "4.0.4" - # and have playback_binary_manifest default to - # mitmproxy-rel-bin-{playback_version}-{platform}.manifest - # so we don't have to ask amozproxy tool user to provide this: - config[ - "playback_binary_manifest" - ] = "mitmproxy-rel-bin-4.0.4-{platform}.manifest" - - playback_file = os.path.join(playback_dir, "%s.playback" % video_id) - - config["playback_tool_args"] = [ - "--ssl-insecure", - "--server-replay-nopop", - "--set", - "upstream_cert=false", - "-S", - playback_file, - "-s", - playback_script, - video_id, - ] - - proxy = get_playback(config) - if proxy is None: - raise Exception("Could not start Proxy") - proxy.start() - try: - yield proxy - finally: - proxy.stop() - - @contextmanager - def youtube_video(self, video_id, **options): - proxy = options.get("proxy", True) - if proxy: - with self.using_proxy(video_id) as proxy: - options["upload_dir"] = proxy.upload_dir - with using_page(video_id, self.marionette, **options) as page: - yield page - else: - with using_page(video_id, self.marionette, **options) as page: - yield page - - def assertVideoQuality(self, res): - self.assertTrue(res is not None, "We did not get back the results") - debug_info = res["mozRequestDebugInfo"] - - # looking at mNumSamplesOutputTotal vs mNumSamplesSkippedTotal - reader_info = debug_info['decoder']['reader'] - self.assertLess(reader_info["videoNumSamplesSkippedTotal"], - reader_info["videoNumSamplesOutputTotal"] * 0.04) - - # extracting in/out from the debugInfo - video_state = reader_info["videoState"] - video_in = video_state["numSamplesInput"] - video_out = video_state["numSamplesOutput"] - # what's the ratio ? we want 99%+ - if video_out != video_in: - in_out_ratio = float(video_out) / float(video_in) * 100 - self.assertGreater(in_out_ratio, 99.0) diff --git a/dom/media/test/marionette/yttest/uR0N3DrybGQ.manifest b/dom/media/test/marionette/yttest/uR0N3DrybGQ.manifest deleted file mode 100644 index a9bba27cd4f9..000000000000 --- a/dom/media/test/marionette/yttest/uR0N3DrybGQ.manifest +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "size": 629013569, - "visibility": "public", - "digest": "213afa0e40411c26c86092a0803099a8c596b27cf789ed658ba0cf50dd8b404926dd784cd0236922aca22d3763edff666dd247c14bfe38359fb9d767f1869048", - "algorithm": "sha512", - "filename": "uR0N3DrybGQ.tar.gz", - "unpack": true - } -] diff --git a/dom/media/test/marionette/yttest/until_end_test.js b/dom/media/test/marionette/yttest/until_end_test.js deleted file mode 100644 index 70227a25d5f2..000000000000 --- a/dom/media/test/marionette/yttest/until_end_test.js +++ /dev/null @@ -1,20 +0,0 @@ -%(force_hd)s - -const resolve = arguments[arguments.length - 1]; - -// this script is injected by marionette to collect metrics -var video = document.getElementsByTagName("video")[0]; -if (!video) { - return "Can't find the video tag"; -} - -video.addEventListener("ended", () => { - %(video_playback_quality)s - %(debug_info)s - // Pausing after we get the debug info so - // we can also look at in/out data in buffers - video.pause(); - }, {once: true} -); - -video.play(); diff --git a/dom/media/test/marionette/yttest/video_playback_quality.js b/dom/media/test/marionette/yttest/video_playback_quality.js deleted file mode 100644 index baa6376595d8..000000000000 --- a/dom/media/test/marionette/yttest/video_playback_quality.js +++ /dev/null @@ -1,2 +0,0 @@ -/* global video */ -var result = { getVideoPlaybackQuality: video.getVideoPlaybackQuality() }; diff --git a/dom/media/test/marionette/yttest/ytpage.py b/dom/media/test/marionette/yttest/ytpage.py deleted file mode 100644 index a793adaa893d..000000000000 --- a/dom/media/test/marionette/yttest/ytpage.py +++ /dev/null @@ -1,118 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this file, -# You can obtain one at http://mozilla.org/MPL/2.0/. -""" -Drives the browser during the playback test. -""" -import contextlib -import os -import time -import json - -from marionette_driver.by import By - - -here = os.path.dirname(__file__) -js = os.path.join(here, "until_end_test.js") -with open(js) as f: - UNTIL_END_TEST = f.read() - -js = os.path.join(here, "duration_test.js") -with open(js) as f: - DURATION_TEST = f.read() - -JS_MACROS = {"video_playback_quality": "", "debug_info": "", "force_hd": ""} -for script in JS_MACROS: - js = os.path.join(here, "%s.js" % script) - with open(js) as f: - JS_MACROS[script] = f.read() - -SPLIT_FIELD = ( - "Audio State", - "Audio Track Buffer Details", - "AudioSink", - "MDSM", - "Video State", - "Video Track Buffer Details", - "Dumping Audio Track", - "Dumping Video Track", - "MediaDecoder", - "VideoSink", - "Dropped Frames" -) - - -class YoutubePage: - def __init__(self, video_id, marionette, **options): - self.video_id = video_id - self.marionette = marionette - self.url = "https://www.youtube.com/watch?v=%s" % self.video_id - self.started = False - self.capabilities = { - # We're not using upstream cert sniffing, let's make sure - # the browser accepts mitmproxy ones for all requests - # even if they are incorrect. - "acceptInsecureCerts": True - } - self.options = options - if options.get("proxy", True): - self.capabilities["proxy"] = { - "proxyType": "manual", - "httpProxy": "localhost:8080", - "sslProxy": "localhost:8080", - "noProxy": ["localhost"], - } - - def start_video(self): - self.marionette.start_session(self.capabilities) - self.marionette.timeout.script = 600 - self.marionette.navigate(self.url) - self.started = True - - def run_test(self): - self.start_video() - # If we don't pause here for just a bit the media events - # are not intercepted. - time.sleep(5) - body = self.marionette.find_element(By.TAG_NAME, "html") - body.click() - options = dict(JS_MACROS) - options.update(self.options) - if "duration" in options: - script = DURATION_TEST % options - else: - script = UNTIL_END_TEST % options - res = self.execute_async_script(script) - if res is None: - return res - self._dump_res(res) - return res - - def execute_async_script(self, script, context=None): - if context is None: - context = self.marionette.CONTEXT_CONTENT - with self.marionette.using_context(context): - return self.marionette.execute_async_script(script, sandbox="system") - - def _dump_res(self, res): - raw = json.dumps(res, indent=2, sort_keys=True) - print(raw) - if "upload_dir" in self.options: - fn = "%s-videoPlaybackQuality.json" % self.video_id - fn = os.path.join(self.options["upload_dir"], fn) - # dumping on disk - with open(fn, "w") as f: - f.write(raw) - - def close(self): - if self.started: - self.marionette.delete_session() - - -@contextlib.contextmanager -def using_page(video_id, marionette, **options): - page = YoutubePage(video_id, marionette, **options) - try: - yield page - finally: - page.close() diff --git a/python/mozbuild/mozbuild/action/test_archive.py b/python/mozbuild/mozbuild/action/test_archive.py index 53ee95d42dbb..4d7ceabe51e2 100644 --- a/python/mozbuild/mozbuild/action/test_archive.py +++ b/python/mozbuild/mozbuild/action/test_archive.py @@ -140,7 +140,6 @@ ARCHIVE_FILES = { 'source': buildconfig.topsrcdir, 'base': '', 'manifests': [ - 'dom/media/test/marionette/manifest.ini', 'testing/marionette/harness/marionette_harness/tests/unit-tests.ini', 'gfx/tests/marionette/manifest.ini' ], diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index 7d8053d29ca2..bff02038a865 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -2052,10 +2052,6 @@ VARIABLES = { """List of manifest files defining mochitest chrome tests. """), - 'MARIONETTE_DOM_MEDIA_MANIFESTS': (ManifestparserManifestList, list, - """List of manifest files defining marionette-media tests. - """), - 'MOCHITEST_MANIFESTS': (ManifestparserManifestList, list, """List of manifest files defining mochitest tests. """), diff --git a/taskcluster/ci/test/marionette.yml b/taskcluster/ci/test/marionette.yml index 66969d72456a..c632e4cf8cd5 100644 --- a/taskcluster/ci/test/marionette.yml +++ b/taskcluster/ci/test/marionette.yml @@ -55,13 +55,3 @@ marionette-gpu: by-test-platform: windows10-64.*: virtual-with-gpu default: virtual - -marionette-media: - description: "Marionette DOM media test run" - treeherder-symbol: MnM - max-run-time: 5400 - instance-size: default - tier: 2 - mozharness: - extra-options: - - --test-manifest=stream-tests.ini diff --git a/taskcluster/ci/test/test-platforms.yml b/taskcluster/ci/test/test-platforms.yml index 50c5499a99db..eeb22a9dc6f3 100644 --- a/taskcluster/ci/test/test-platforms.yml +++ b/taskcluster/ci/test/test-platforms.yml @@ -29,7 +29,6 @@ linux64/debug: test-sets: - common-tests - web-platform-tests - - marionette-media-tests linux64/opt: build-platform: linux64/opt @@ -45,7 +44,6 @@ linux64/opt: - raptor-firefox - browsertime - raptor-fetch-firefox - - marionette-media-tests linux64-shippable/opt: build-platform: linux64-shippable/opt @@ -196,7 +194,6 @@ windows10-64/debug: - marionette-gpu-tests - windows-tests - web-platform-tests - - marionette-media-tests windows10-64/opt: build-platform: win64/opt @@ -209,7 +206,6 @@ windows10-64/opt: - web-platform-tests - raptor-firefox - browsertime - - marionette-media-tests windows10-aarch64/opt: build-platform: win64-aarch64-shippable/opt @@ -321,7 +317,6 @@ macosx1014-64-shippable/opt: - browsertime - raptor-firefox-power - raptor-profiling - - marionette-media-tests - web-platform-tests-wdspec-headless - talos-profiling @@ -329,7 +324,6 @@ macosx1014-64/debug: build-platform: macosx64/debug test-sets: - macosx1014-64-tests - - marionette-media-tests macosx1014-64-devedition/opt: build-platform: macosx64-devedition-nightly/opt diff --git a/taskcluster/ci/test/test-sets.yml b/taskcluster/ci/test/test-sets.yml index 7fef3cb93a08..b86b6f9761aa 100644 --- a/taskcluster/ci/test/test-sets.yml +++ b/taskcluster/ci/test/test-sets.yml @@ -464,9 +464,6 @@ windows-talos: marionette-gpu-tests: - marionette-gpu -marionette-media-tests: - - marionette-media - macosx1014-64-tests: - cppunit - crashtest diff --git a/testing/marionette/harness/marionette_harness/tests/stream-tests.ini b/testing/marionette/harness/marionette_harness/tests/stream-tests.ini deleted file mode 100644 index 1e099c9fd9c4..000000000000 --- a/testing/marionette/harness/marionette_harness/tests/stream-tests.ini +++ /dev/null @@ -1,2 +0,0 @@ -# stream tests -[include:../../../../../dom/media/test/marionette/manifest.ini]