import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1 @@
[test_basic_playback.py ]

View file

@ -0,0 +1,74 @@
# 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/.
from marionette_driver import Wait
from marionette_driver.errors import TimeoutException
from marionette_harness import Marionette
from external_media_tests.utils import verbose_until
from external_media_harness.testcase import MediaTestCase
from external_media_tests.media_utils.video_puppeteer import VideoException
from external_media_tests.media_utils.youtube_puppeteer import YouTubePuppeteer
class TestBasicYouTubePlayback(MediaTestCase):
def test_mse_is_enabled_by_default(self):
with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
youtube = YouTubePuppeteer(self.marionette, self.video_urls[0],
timeout=60)
wait = Wait(youtube,
timeout=min(300, youtube.expected_duration * 1.3),
interval=1)
try:
verbose_until(wait, youtube,
YouTubePuppeteer.mse_enabled,
"Failed to find 'blob' in video src url.")
except TimeoutException as e:
raise self.failureException(e)
def test_video_playing_in_one_tab(self):
with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
for url in self.video_urls:
self.logger.info(url)
youtube = YouTubePuppeteer(self.marionette, url)
self.logger.info('Expected duration: {}'
.format(youtube.expected_duration))
final_piece = 60
try:
time_left = youtube.wait_for_almost_done(
final_piece=final_piece)
except VideoException as e:
raise self.failureException(e)
duration = abs(youtube.expected_duration) + 1
if duration > 1:
self.logger.info('Almost done: {} - {} seconds left.'
.format(url, time_left))
if time_left > final_piece:
self.marionette.log('time_left greater than '
'final_piece - {}'
.format(time_left),
level='WARNING')
self.save_screenshot()
else:
self.marionette.log('Duration close to 0 - {}'
.format(youtube),
level='WARNING')
self.save_screenshot()
try:
verbose_until(Wait(youtube,
timeout=max(100, time_left) * 1.3,
interval=1),
youtube,
YouTubePuppeteer.playback_done)
except TimeoutException as e:
raise self.failureException(e)
def test_playback_starts(self):
with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
for url in self.video_urls:
try:
YouTubePuppeteer(self.marionette, url, timeout=60)
except TimeoutException as e:
raise self.failureException(e)

View file

@ -0,0 +1,46 @@
# 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/.
from external_media_harness.testcase import MediaTestCase
from marionette_driver import Wait
from external_media_tests.utils import verbose_until
from external_media_tests.media_utils.youtube_puppeteer import YouTubePuppeteer
class TestMediaSourcePrefs(MediaTestCase):
def setUp(self):
MediaTestCase.setUp(self)
self.test_urls = self.video_urls[:2]
self.max_timeout = 60
def tearDown(self):
MediaTestCase.tearDown(self)
def test_mse_prefs(self):
""" mediasource should only be used if MSE prefs are enabled."""
self.set_mse_enabled_prefs(False)
self.check_mse_src(False, self.test_urls[0])
self.set_mse_enabled_prefs(True)
self.check_mse_src(True, self.test_urls[0])
def set_mse_enabled_prefs(self, value):
with self.marionette.using_context('chrome'):
self.marionette.set_pref('media.mediasource.enabled', value)
self.marionette.set_pref('media.mediasource.mp4.enabled', value)
self.marionette.set_pref('media.mediasource.webm.enabled', value)
def check_mse_src(self, mse_expected, url):
with self.marionette.using_context('content'):
youtube = YouTubePuppeteer(self.marionette, url)
wait = Wait(youtube,
timeout=min(self.max_timeout,
youtube.expected_duration * 1.3),
interval=1)
def cond(y):
return y.mse_enabled == mse_expected
verbose_until(wait, youtube, cond)