# Copyright (c) 2014 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os, time from autotest_lib.client.bin import test, utils from autotest_lib.client.common_lib import error from autotest_lib.client.common_lib.cros import chrome from autotest_lib.client.cros.video import youtube_helper from autotest_lib.client.cros.video import helper_logger FLASH_PROCESS_NAME = 'chrome/chrome --type=ppapi' PLAYER_PLAYING_STATE = 'Playing' PLAYBACK_TEST_TIME_S = 10 class video_MultiplePlayback(test.test): """This test verify simultaneous video playback. We are testing using Youtube html5 and a local video. """ version = 1 def verify_localvideo_playback(self, tab1): """To verify local video playback @param tab1: browser tab. """ playback = 0 # seconds prev_playback = 0 while (int(tab1.EvaluateJavaScript('testvideo.currentTime')) < int(tab1.EvaluateJavaScript('testvideo.duration')) and playback < PLAYBACK_TEST_TIME_S): if (int(tab1.EvaluateJavaScript('testvideo.currentTime')) <= prev_playback): raise error.TestError('Video is not playing.') prev_playback = int(tab1.EvaluateJavaScript( 'testvideo.currentTime')) time.sleep(1) playback = playback + 1 def run_video_tests(self, browser): """Play youtube html5 and a local video, and verify the playback. @param browser: The Browser object to run the test with. """ browser.platform.SetHTTPServerDirectories(self.bindir) tab1 = browser.tabs.New() # Verifying