OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from pylib.gtest import gtest_test_instance | 5 from pylib.gtest import gtest_test_instance |
6 from pylib.instrumentation import instrumentation_test_instance | 6 from pylib.instrumentation import instrumentation_test_instance |
7 from pylib.junit import junit_test_instance | 7 from pylib.junit import junit_test_instance |
| 8 from pylib.monkey import monkey_test_instance |
8 from pylib.local.device import local_device_environment | 9 from pylib.local.device import local_device_environment |
9 from pylib.local.device import local_device_gtest_run | 10 from pylib.local.device import local_device_gtest_run |
10 from pylib.local.device import local_device_instrumentation_test_run | 11 from pylib.local.device import local_device_instrumentation_test_run |
| 12 from pylib.local.device import local_device_monkey_test_run |
11 from pylib.local.device import local_device_perf_test_run | 13 from pylib.local.device import local_device_perf_test_run |
12 from pylib.local.machine import local_machine_environment | 14 from pylib.local.machine import local_machine_environment |
13 from pylib.local.machine import local_machine_junit_test_run | 15 from pylib.local.machine import local_machine_junit_test_run |
14 from pylib.perf import perf_test_instance | 16 from pylib.perf import perf_test_instance |
15 | 17 |
16 | 18 |
17 def _CreatePerfTestRun(args, env, test_instance): | 19 def _CreatePerfTestRun(args, env, test_instance): |
18 if args.print_step: | 20 if args.print_step: |
19 return local_device_perf_test_run.PrintStep( | 21 return local_device_perf_test_run.PrintStep( |
20 env, test_instance) | 22 env, test_instance) |
21 elif args.output_json_list: | 23 elif args.output_json_list: |
22 return local_device_perf_test_run.OutputJsonList( | 24 return local_device_perf_test_run.OutputJsonList( |
23 env, test_instance) | 25 env, test_instance) |
24 return local_device_perf_test_run.LocalDevicePerfTestRun( | 26 return local_device_perf_test_run.LocalDevicePerfTestRun( |
25 env, test_instance) | 27 env, test_instance) |
26 | 28 |
27 | 29 |
28 def CreateTestRun(args, env, test_instance, error_func): | 30 def CreateTestRun(args, env, test_instance, error_func): |
29 if isinstance(env, local_device_environment.LocalDeviceEnvironment): | 31 if isinstance(env, local_device_environment.LocalDeviceEnvironment): |
30 if isinstance(test_instance, gtest_test_instance.GtestTestInstance): | 32 if isinstance(test_instance, gtest_test_instance.GtestTestInstance): |
31 return local_device_gtest_run.LocalDeviceGtestRun(env, test_instance) | 33 return local_device_gtest_run.LocalDeviceGtestRun(env, test_instance) |
32 if isinstance(test_instance, | 34 if isinstance(test_instance, |
33 instrumentation_test_instance.InstrumentationTestInstance): | 35 instrumentation_test_instance.InstrumentationTestInstance): |
34 return (local_device_instrumentation_test_run | 36 return (local_device_instrumentation_test_run |
35 .LocalDeviceInstrumentationTestRun(env, test_instance)) | 37 .LocalDeviceInstrumentationTestRun(env, test_instance)) |
| 38 if isinstance(test_instance, monkey_test_instance.MonkeyTestInstance): |
| 39 return (local_device_monkey_test_run |
| 40 .LocalDeviceMonkeyTestRun(env, test_instance)) |
36 if isinstance(test_instance, | 41 if isinstance(test_instance, |
37 perf_test_instance.PerfTestInstance): | 42 perf_test_instance.PerfTestInstance): |
38 return _CreatePerfTestRun(args, env, test_instance) | 43 return _CreatePerfTestRun(args, env, test_instance) |
39 | 44 |
40 if isinstance(env, local_machine_environment.LocalMachineEnvironment): | 45 if isinstance(env, local_machine_environment.LocalMachineEnvironment): |
41 if isinstance(test_instance, junit_test_instance.JunitTestInstance): | 46 if isinstance(test_instance, junit_test_instance.JunitTestInstance): |
42 return (local_machine_junit_test_run | 47 return (local_machine_junit_test_run |
43 .LocalMachineJunitTestRun(env, test_instance)) | 48 .LocalMachineJunitTestRun(env, test_instance)) |
44 | 49 |
45 error_func('Unable to create test run for %s tests in %s environment' | 50 error_func('Unable to create test run for %s tests in %s environment' |
46 % (str(test_instance), str(env))) | 51 % (str(test_instance), str(env))) |
47 | 52 |
OLD | NEW |