• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2014 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5
6from pylib.gtest import gtest_test_instance
7from pylib.hostside import hostside_test_instance
8from pylib.instrumentation import instrumentation_test_instance
9from pylib.junit import junit_test_instance
10from pylib.monkey import monkey_test_instance
11from pylib.utils import device_dependencies
12
13
14def CreateTestInstance(args, error_func):
15
16  if args.command == 'gtest':
17    return gtest_test_instance.GtestTestInstance(
18        args, device_dependencies.GetDataDependencies, error_func)
19  if args.command == 'hostside':
20    return hostside_test_instance.HostsideTestInstance(
21        args, error_func)
22  if args.command == 'instrumentation':
23    return instrumentation_test_instance.InstrumentationTestInstance(
24        args, device_dependencies.GetDataDependencies, error_func)
25  if args.command == 'junit':
26    return junit_test_instance.JunitTestInstance(args, error_func)
27  if args.command == 'monkey':
28    return monkey_test_instance.MonkeyTestInstance(args, error_func)
29
30  error_func('Unable to create %s test instance.' % args.command)
31  raise RuntimeError('error_func must call exit inside.')
32