blob: 24f53b04ec10bd4d6037d6f4df040bfe75575050 [file] [log] [blame]
# Copyright 2015 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 logging
import os
from autotest_lib.client.bin import test
from autotest_lib.client.bin import utils
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib.cros import chrome
from import helper_logger
EXTRA_BROWSER_ARGS = ['--use-fake-ui-for-media-stream',
# Polling timeout.
class video_WebRtcSanity(test.test):
"""Local getUserMedia test with fake webcam at VGA and 720p."""
version = 1
def start_getusermedia(self, cr):
"""Opens the test page.
@param cr: Autotest Chrome instance.
cr.browser.platform.SetHTTPServerDirectories(self.bindir) = cr.browser.tabs[0]
os.path.join(self.bindir, 'getusermedia.html')))
def wait_test_completed(self, timeout_secs):
"""Waits until the test is done.
@param timeout_secs Max time to wait in seconds.
@returns True if test completed, False otherwise.
def _test_done():
status ='getStatus()')
return status != 'running'
_test_done, timeout=timeout_secs, sleep_interval=1,
desc = 'getusermedia.html reports itself as finished')
def run_once(self):
"""Runs the test."""
with chrome.Chrome(extra_browser_args=EXTRA_BROWSER_ARGS +\
init_network_controller=True) as cr:
def verify_successful(self):
"""Checks the results of the test.
@raises TestError if an error occurred.
status ='getStatus()')'Status: %s', status)
if status != 'ok-video-playing':
raise error.TestFail('Failed: %s' % status)