• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2013 The Chromium OS 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
5from autotest_lib.client.bin import test
6from autotest_lib.client.common_lib import error
7from telemetry.testing import run_chromeos_tests
8
9
10class telemetry_UnitTests(test.test):
11    """This is a client side wrapper for the Telemetry unit tests."""
12    version = 1
13
14
15    def run_once(self, browser_type, unit_tests, perf_tests):
16        """Runs telemetry/perf unit tests.
17
18        @param browser_type: The string type of browser to use, e.g., 'system'.
19        @param unit_tests: list of unit tests to run, [''] is all tests,
20                           [] is no tests.
21        @param perf_tests: list of perf unit tests to run, [''] is all tests,
22                           [] is no tests.
23        """
24        tests_to_run = []
25        if unit_tests:
26            tests_to_run.append((
27                    '/usr/local/telemetry/src/third_party/catapult/telemetry',
28                    unit_tests))
29        if perf_tests:
30            tests_to_run.append(('/usr/local/telemetry/src/tools/perf',
31                                 perf_tests))
32        error_str = run_chromeos_tests.RunChromeOSTests(browser_type,
33                                                        tests_to_run)
34        if error_str:
35            raise error.TestFail(error_str)
36