1# Copyright 2018 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import logging
6
7from autotest_lib.client.common_lib import error
8from autotest_lib.client.cros import chrome_binary_test
9from autotest_lib.client.cros.graphics import graphics_utils
10
11
12class graphics_Chrome(graphics_utils.GraphicsTest,
13                      chrome_binary_test.ChromeBinaryTest):
14    """Runs a given Chrome unittests binary."""
15    version = 1
16
17    @chrome_binary_test.nuke_chrome
18    @graphics_utils.GraphicsTest.failure_report_decorator('graphics_Chrome')
19    def run_once(self, unittests_binary_name, unittests_timeout):
20        logging.debug('Starting %s', unittests_binary_name)
21        try:
22            self.run_chrome_test_binary(
23                unittests_binary_name, timeout=unittests_timeout)
24        except error.CmdTimeoutError:
25            raise error.TestFail(
26                'Failed: timeout running %s' % unittests_binary_name)
27        except:
28            # TODO(ihf): Consider parsing the output from the test.
29            raise error.TestFail('Failed: %s' % unittests_binary_name)
30