当前位置: 首页>>代码示例>>Python>>正文


Python utils.verbose_until函数代码示例

本文整理汇总了Python中external_media_tests.utils.verbose_until函数的典型用法代码示例。如果您正苦于以下问题:Python verbose_until函数的具体用法?Python verbose_until怎么用?Python verbose_until使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了verbose_until函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, marionette, url, autostart=True, **kwargs):
     self.player = None
     self._last_seen_player_state = None
     super(YouTubePuppeteer,
           self).__init__(marionette, url,
                          video_selector='.html5-video-player video',
                          autostart=False,
                          **kwargs)
     wait = Wait(self.marionette, timeout=30)
     with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
         verbose_until(wait, self,
                       expected.element_present(By.CLASS_NAME,
                                                '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');")
     # 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.
     for attempt in range(5):
         sleep(1)
         self.process_ad()
         if (self._last_seen_player_state.player_ad_inactive and
                 self._last_seen_video_state.duration and not
                 self._last_seen_player_state.player_buffering):
             break
     self._update_expected_duration()
     if autostart:
         self.start()
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:30,代码来源:youtube_puppeteer.py

示例2: __init__

 def __init__(self, marionette, url, video_selector='video', interval=1,
              set_duration=0, stall_wait_time=0, timeout=60,
              autostart=True):
     self.marionette = marionette
     self.test_url = url
     self.interval = interval
     self.stall_wait_time = stall_wait_time
     self.timeout = timeout
     self._set_duration = set_duration
     self.video = None
     self.expected_duration = 0
     self._first_seen_time = 0
     self._first_seen_wall_time = 0
     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))
         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.')
         if len(videos_found) <= 0:
             self.marionette.log(type(self).__name__ + ': no video '
                                                       'elements found.')
             return
         self.video = videos_found[0]
         self.marionette.execute_script("log('video element obtained');")
         if autostart:
             self.start()
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:34,代码来源:video_puppeteer.py

示例3: start

 def start(self):
     # To get an accurate expected_duration, playback must have started
     wait = Wait(self, timeout=self.timeout)
     verbose_until(wait, self, playback_started,
                   "Check if video has played some range")
     self._first_seen_time = self.current_time
     self._first_seen_wall_time = clock()
     self.update_expected_duration()
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:8,代码来源:video_puppeteer.py

示例4: start

 def start(self):
     # To get an accurate expected_duration, playback must have started
     wait = Wait(self, timeout=self.timeout)
     verbose_until(wait, self, lambda v: v.current_time > 0,
                   "Check if video current_time > 0")
     self._start_time = self.current_time
     self._start_wall_time = clock()
     self.update_expected_duration()
开发者ID:MekliCZ,项目名称:positron,代码行数:8,代码来源:video_puppeteer.py

示例5: check_playback_starts

 def check_playback_starts(self, video):
     with self.marionette.using_context('content'):
         self.logger.info(video.test_url)
         try:
             verbose_until(Wait(video, timeout=video.timeout),
                           video, playback_started)
         except TimeoutException as e:
             raise self.failureException(e)
开发者ID:LaiPhil,项目名称:gecko-dev,代码行数:8,代码来源:testcase.py

示例6: run_playback

 def run_playback(self, video):
     with self.marionette.using_context('content'):
         self.logger.info(video.test_url)
         try:
             verbose_until(Wait(video, interval=video.interval,
                                timeout=video.expected_duration * 1.3 +
                                video.stall_wait_time),
                           video, playback_done)
         except VideoException as e:
             raise self.failureException(e)
开发者ID:LaiPhil,项目名称:gecko-dev,代码行数:10,代码来源:testcase.py

示例7: process_ad

 def process_ad(self):
     if self.attempt_ad_skip() or self.ad_inactive:
         return
     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 s for ad' % ad_timeout)
         verbose_until(wait, self, lambda y: y.ad_ended, "Check if ad ended")
     except TimeoutException:
         self.marionette.log('Waiting for ad to end timed out',
                             level='WARNING')
开发者ID:LaiPhil,项目名称:gecko-dev,代码行数:11,代码来源:youtube_puppeteer.py

示例8: check_mse_src

    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)
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:12,代码来源:test_prefs.py

示例9: test_mse_is_enabled_by_default

 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)
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:13,代码来源:test_basic_playback.py

示例10: check_playback_starts

    def check_playback_starts(self, video):
        """
        Check to see if a given video will start. Raises if the video does not
        start.

        :param video: VideoPuppeteer instance to play.
        """
        with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
            self.logger.info(video.test_url)
            try:
                verbose_until(Wait(video, timeout=video.timeout), video, VideoPuppeteer.playback_started)
            except TimeoutException as e:
                raise self.failureException(e)
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:13,代码来源:testcase.py

示例11: test_mse_is_enabled_by_default

 def test_mse_is_enabled_by_default(self):
     with self.marionette.using_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,
                           lambda y: y.video_src.startswith('mediasource'),
                           "Failed to find 'mediasource' in video src url.")
         except TimeoutException as e:
             raise self.failureException(e)
开发者ID:LaiPhil,项目名称:gecko-dev,代码行数:13,代码来源:test_basic_playback.py

示例12: run_playback

    def run_playback(self, video):
        """
        Play the video all of the way through, or for the requested duration,
        whichever comes first. Raises if the video stalls for too long.

        :param video: VideoPuppeteer instance to play.
        """
        with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
            self.logger.info(video.test_url)
            try:
                verbose_until(Wait(video, interval=video.interval,
                                   timeout=video.expected_duration * 1.3 +
                                   video.stall_wait_time),
                              video, VideoPuppeteer.playback_done)
            except VideoException as e:
                raise self.failureException(e)
开发者ID:lazyparser,项目名称:gecko-dev,代码行数:16,代码来源:testcase.py

示例13: check_src

    def check_src(self, src_type, url):
        # Why wait to check src until initial ad is done playing?
        # - src attribute in video element is sometimes null during ad playback
        # - many ads still don't use MSE even if main video does
        with self.marionette.using_context('content'):
            youtube = YouTubePuppeteer(self.marionette, url)
            youtube.attempt_ad_skip()
            wait = Wait(youtube,
                        timeout=min(self.max_timeout,
                                    youtube.player_duration * 1.3),
                        interval=1)

            def cond(y):
                return y.video_src.startswith(src_type)

            verbose_until(wait, youtube, cond)
开发者ID:LaiPhil,项目名称:gecko-dev,代码行数:16,代码来源:test_prefs.py

示例14: __init__

 def __init__(self, marionette, url, autostart=True,
              set_duration=10.0, **kwargs):
     self.player = None
     self._last_seen_player_state = None
     super(TwitchPuppeteer,
           self).__init__(marionette, url, set_duration=set_duration,
                          autostart=False, **kwargs)
     wait = Wait(self.marionette, timeout=30)
     with self.marionette.using_context(Marionette.CONTEXT_CONTENT):
         verbose_until(wait, self,
                       expected.element_present(By.CLASS_NAME,
                                                'player'))
         self.player = self.marionette.find_element(By.CLASS_NAME,
                                                    'player')
         self.marionette.execute_script("log('.player "
                                        "element obtained');")
         if autostart:
             self.start()
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:18,代码来源:twitch_puppeteer.py

示例15: process_ad

 def process_ad(self):
     """
     Wait for this ad to finish. Refreshes state.
     """
     self._refresh_state()
     if self._last_seen_player_state.player_ad_inactive:
         return
     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))
         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')
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:19,代码来源:youtube_puppeteer.py


注:本文中的external_media_tests.utils.verbose_until函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。