зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1370863 - Stop using Marionette.log API in external media tests; r=automatedtester,SingingTree
This removes the dependency on the Marionette server-side logging API from the external media tests. Instead, we rely on client-side logging alternatives. MozReview-Commit-ID: 8kMhMflYh4q --HG-- extra : rebase_source : 0994bc9549309d7e603a5a9b550c31a7a3332b4a
This commit is contained in:
Родитель
8737f25318
Коммит
1ebaf83053
|
@ -52,8 +52,7 @@ class MediaTestCase(PuppeteerMixin, MarionetteTestCase):
|
|||
img_data = self.marionette.screenshot()
|
||||
with open(path, 'wb') as f:
|
||||
f.write(img_data.decode('base64'))
|
||||
self.marionette.log('Screenshot saved in {}'
|
||||
.format(os.path.abspath(path)))
|
||||
self.logger.info('Screenshot saved in {}'.format(os.path.abspath(path)))
|
||||
|
||||
def log_video_debug_lines(self, video):
|
||||
"""
|
||||
|
@ -62,7 +61,7 @@ class MediaTestCase(PuppeteerMixin, MarionetteTestCase):
|
|||
with self.marionette.using_context(Marionette.CONTEXT_CHROME):
|
||||
debug_lines = video.get_debug_lines()
|
||||
if debug_lines:
|
||||
self.marionette.log('\n'.join(debug_lines))
|
||||
self.logger.info('\n'.join(debug_lines))
|
||||
|
||||
def run_playback(self, video):
|
||||
"""
|
||||
|
|
|
@ -113,22 +113,18 @@ class VideoPuppeteer(object):
|
|||
wait = Wait(self.marionette, timeout=self.timeout)
|
||||
with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
|
||||
self.marionette.navigate(self.test_url)
|
||||
self.marionette.execute_script("""
|
||||
log('URL: {0}');""".format(self.test_url))
|
||||
print('URL: {}'.format(self.test_url))
|
||||
verbose_until(wait, self,
|
||||
expected.element_present(By.TAG_NAME, 'video'))
|
||||
videos_found = self.marionette.find_elements(By.CSS_SELECTOR,
|
||||
video_selector)
|
||||
if len(videos_found) > 1:
|
||||
self.marionette.log(type(self).__name__ + ': multiple video '
|
||||
'elements found. '
|
||||
'Using first.')
|
||||
print('{}: multiple video elements found. Using first.'.format(type(self).__name__))
|
||||
if len(videos_found) <= 0:
|
||||
self.marionette.log(type(self).__name__ + ': no video '
|
||||
'elements found.')
|
||||
print('{}: no video elements found.'.format(type(self).__name__))
|
||||
return
|
||||
self.video = videos_found[0]
|
||||
self.marionette.execute_script("log('video element obtained');")
|
||||
print('video element obtained')
|
||||
if autostart:
|
||||
self.start()
|
||||
|
||||
|
|
|
@ -93,8 +93,7 @@ class YouTubePuppeteer(VideoPuppeteer):
|
|||
'html5-video-player'))
|
||||
self.player = self.marionette.find_element(By.CLASS_NAME,
|
||||
'html5-video-player')
|
||||
self.marionette.execute_script("log('.html5-video-player "
|
||||
"element obtained');")
|
||||
print '.html5-video-player element obtained'
|
||||
# When an ad is playing, self.player_duration indicates the duration
|
||||
# of the spliced-in ad stream, not the duration of the main video, so
|
||||
# we attempt to skip the ad first.
|
||||
|
@ -140,8 +139,7 @@ class YouTubePuppeteer(VideoPuppeteer):
|
|||
try:
|
||||
return loads(text)
|
||||
except ValueError:
|
||||
self.marionette.log('Error loading json: DebugText',
|
||||
level='DEBUG')
|
||||
print 'Error loading JSON: DebugText'
|
||||
|
||||
def _execute_yt_script(self, script):
|
||||
"""
|
||||
|
@ -171,15 +169,13 @@ class YouTubePuppeteer(VideoPuppeteer):
|
|||
ad_timeout = (self._search_ad_duration() or 30) + 5
|
||||
wait = Wait(self, timeout=ad_timeout, interval=1)
|
||||
try:
|
||||
self.marionette.log('process_ad: waiting {} s for ad'
|
||||
.format(ad_timeout))
|
||||
print('process_ad: waiting {}s for ad'.format(ad_timeout))
|
||||
verbose_until(wait,
|
||||
self,
|
||||
YouTubePuppeteer._check_if_ad_ended,
|
||||
"Check if ad ended")
|
||||
except TimeoutException:
|
||||
self.marionette.log('Waiting for ad to end timed out',
|
||||
level='WARNING')
|
||||
print('Waiting for ad to end timed out')
|
||||
|
||||
def _search_ad_duration(self):
|
||||
"""
|
||||
|
@ -208,9 +204,7 @@ class YouTubePuppeteer(VideoPuppeteer):
|
|||
ad_seconds = int(ad_time.group('second'))
|
||||
return 60 * ad_minutes + ad_seconds
|
||||
except (TimeoutException, NoSuchElementException):
|
||||
self.marionette.log('Could not obtain '
|
||||
'element: {}'.format(selector),
|
||||
level='WARNING')
|
||||
print('Could not obtain element {}'.format(selector))
|
||||
return None
|
||||
|
||||
def _player_stalled(self):
|
||||
|
@ -461,7 +455,7 @@ class YouTubePuppeteer(VideoPuppeteer):
|
|||
if self._last_seen_player_state.player_buffering:
|
||||
# fall back on timeout in 'wait' call that comes after this
|
||||
# in test function
|
||||
self.marionette.log('Buffering and no playback progress.')
|
||||
print('Buffering and no playback progress')
|
||||
break
|
||||
else:
|
||||
message = '\n'.join(['Playback stalled', str(self)])
|
||||
|
|
|
@ -46,15 +46,13 @@ class TestBasicYouTubePlayback(MediaTestCase):
|
|||
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.logger.warn('time_left greater than '
|
||||
'final_piece - {}'
|
||||
.format(time_left))
|
||||
self.save_screenshot()
|
||||
else:
|
||||
self.marionette.log('Duration close to 0 - {}'
|
||||
.format(youtube),
|
||||
level='WARNING')
|
||||
self.logger.warn('Duration close to 0 - {}'
|
||||
.format(youtube))
|
||||
self.save_screenshot()
|
||||
try:
|
||||
verbose_until(Wait(youtube,
|
||||
|
|
Загрузка…
Ссылка в новой задаче