blob: e4e46462f8f10d0d2ba5ab4a8299a72c280a937f [file] [log] [blame]
# Copyright (c) 2012 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.
from import cros_interface
from autotest_lib.client.bin import test
from autotest_lib.client.common_lib import error
from autotest_lib.client.cros import constants, cros_logging
from autotest_lib.client.cros import httpd
from autotest_lib.client.common_lib.cros import chrome
FLASH_PROCESS_NAME = 'chrome/chrome --type=ppapi'
class desktopui_FlashSanityCheck(test.test):
"""Sanity test that ensures flash instance is launched when a swf is played.
version = 4
def initialize(self):
self._test_url = 'http://localhost:8000/index.html'
self._testServer = httpd.HTTPListener(8000, docroot=self.bindir)
def cleanup(self):
def run_flash_sanity_test(self, browser, time_to_wait_secs):
"""Run the Flash sanity test.
@param browser: The Browser object to run the test with.
@param time_to_wait_secs: wait time for swf file to load.
tab = browser.tabs[0]
self._log_reader = cros_logging.LogReader()
# Ensure that the swf got pulled
latch = self._testServer.add_wait_url('/Trivial.swf')
prc = [proc for proc in cros_interface.CrOSInterface().ListProcesses()
if FLASH_PROCESS_NAME in proc[1]]
if not prc:
raise error.TestFail('No Flash process found.')
# Any better pattern matching?
msg = ' Received crash notification for ' + constants.BROWSER
if self._log_reader.can_find(msg):
raise error.TestFail('Browser crashed during test.')
def run_once(self, time_to_wait_secs=25):
with chrome.Chrome() as cr:
self.run_flash_sanity_test(cr.browser, time_to_wait_secs)