blob: 885de9f83ab0a123bec02733f43c0fed67af8216 [file] [log] [blame]
# Copyright 2016 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
import shutil
import logging
from autotest_lib.client.bin import test, utils
from autotest_lib.client.common_lib.cros import chrome, arc_common
from import constants
from import native_html5_player
from import helper_logger
class video_VideoSanity(test.test):
"""This test verify the media elements and video sanity.
- verify support for mp4, vp8 and vp9 media.
- verify html5 video playback.
version = 2
def run_once(self, video_file, arc_mode=False):
Tests whether the requested video is playable
@param video_file: Sample video file to be played in Chrome.
blacklist = [
# (board, arc_mode) # None means don't care
('x86-mario', None),
('x86-zgb', None),
# The result on elm and oak is flaky in arc mode.
# TODO(wuchengli): remove them once is fixed.
('elm', True),
('oak', True)]
dut_board = utils.get_current_board()
for (blacklist_board, blacklist_arc_mode) in blacklist:
if blacklist_board == dut_board:
if blacklist_arc_mode is None or blacklist_arc_mode == arc_mode:"Skipping test run on this board.")
if arc_mode:
arc_mode_str = arc_common.ARC_MODE_ENABLED
arc_mode_str = arc_common.ARC_MODE_DISABLED
with chrome.Chrome(
init_network_controller=True) as cr:
shutil.copy2(constants.VIDEO_HTML_FILEPATH, self.bindir)
video_path = os.path.join(constants.CROS_VIDEO_DIR,
'files', video_file)
shutil.copy2(video_path, self.bindir)
tab = cr.browser.tabs.New()
html_fullpath = os.path.join(self.bindir, 'video.html')
url = cr.browser.platform.http_server.UrlOf(html_fullpath)
player = native_html5_player.NativeHtml5Player(
full_url = url,
video_id = 'video',
video_src_path = video_file,
event_timeout = 120)