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.local.device import local_device_environment | 7 from pylib.local.device import local_device_environment |
8 from pylib.local.device import local_device_gtest_run | 8 from pylib.local.device import local_device_gtest_run |
9 from pylib.local.device import local_device_instrumentation_test_run | 9 from pylib.local.device import local_device_instrumentation_test_run |
10 from pylib.local.device import local_device_perf_test_run | |
11 from pylib.perf import perf_test_instance | |
10 from pylib.uirobot import uirobot_test_instance | 12 from pylib.uirobot import uirobot_test_instance |
11 | 13 |
12 try: | 14 try: |
13 from pylib.remote.device import remote_device_environment | 15 from pylib.remote.device import remote_device_environment |
14 from pylib.remote.device import remote_device_gtest_run | 16 from pylib.remote.device import remote_device_gtest_run |
15 from pylib.remote.device import remote_device_instrumentation_test_run | 17 from pylib.remote.device import remote_device_instrumentation_test_run |
16 from pylib.remote.device import remote_device_uirobot_test_run | 18 from pylib.remote.device import remote_device_uirobot_test_run |
17 except ImportError: | 19 except ImportError: |
18 remote_device_environment = None | 20 remote_device_environment = None |
19 remote_device_gtest_run = None | 21 remote_device_gtest_run = None |
20 remote_device_instrumentation_test_run = None | 22 remote_device_instrumentation_test_run = None |
21 remote_device_uirobot_test_run = None | 23 remote_device_uirobot_test_run = None |
22 | 24 |
23 | 25 |
24 def CreateTestRun(_args, env, test_instance, error_func): | 26 def CreateTestRun(_args, env, test_instance, error_func): |
25 if isinstance(env, local_device_environment.LocalDeviceEnvironment): | 27 if isinstance(env, local_device_environment.LocalDeviceEnvironment): |
26 if isinstance(test_instance, gtest_test_instance.GtestTestInstance): | 28 if isinstance(test_instance, gtest_test_instance.GtestTestInstance): |
27 return local_device_gtest_run.LocalDeviceGtestRun(env, test_instance) | 29 return local_device_gtest_run.LocalDeviceGtestRun(env, test_instance) |
28 if isinstance(test_instance, | 30 if isinstance(test_instance, |
29 instrumentation_test_instance.InstrumentationTestInstance): | 31 instrumentation_test_instance.InstrumentationTestInstance): |
30 return (local_device_instrumentation_test_run | 32 return (local_device_instrumentation_test_run |
31 .LocalDeviceInstrumentationTestRun(env, test_instance)) | 33 .LocalDeviceInstrumentationTestRun(env, test_instance)) |
34 if isinstance(test_instance, | |
35 perf_test_instance.PerfTestInstance): | |
36 return (local_device_perf_test_run.LocalDevicePerfTestRun(env, | |
mikecase (-- gone --)
2016/06/01 17:40:27
nit: the outer parenthesis arent necessary.
rnephew (Reviews Here)
2016/06/01 20:32:04
Done.
| |
37 test_instance)) | |
32 | 38 |
33 if (remote_device_environment | 39 if (remote_device_environment |
34 and isinstance(env, remote_device_environment.RemoteDeviceEnvironment)): | 40 and isinstance(env, remote_device_environment.RemoteDeviceEnvironment)): |
35 # The remote_device modules should be all or nothing. | 41 # The remote_device modules should be all or nothing. |
36 assert (remote_device_gtest_run | 42 assert (remote_device_gtest_run |
37 and remote_device_instrumentation_test_run | 43 and remote_device_instrumentation_test_run |
38 and remote_device_uirobot_test_run) | 44 and remote_device_uirobot_test_run) |
39 | 45 |
40 if isinstance(test_instance, gtest_test_instance.GtestTestInstance): | 46 if isinstance(test_instance, gtest_test_instance.GtestTestInstance): |
41 return remote_device_gtest_run.RemoteDeviceGtestTestRun( | 47 return remote_device_gtest_run.RemoteDeviceGtestTestRun( |
42 env, test_instance) | 48 env, test_instance) |
43 if isinstance(test_instance, | 49 if isinstance(test_instance, |
44 instrumentation_test_instance.InstrumentationTestInstance): | 50 instrumentation_test_instance.InstrumentationTestInstance): |
45 return (remote_device_instrumentation_test_run | 51 return (remote_device_instrumentation_test_run |
46 .RemoteDeviceInstrumentationTestRun(env, test_instance)) | 52 .RemoteDeviceInstrumentationTestRun(env, test_instance)) |
47 if isinstance(test_instance, uirobot_test_instance.UirobotTestInstance): | 53 if isinstance(test_instance, uirobot_test_instance.UirobotTestInstance): |
48 return remote_device_uirobot_test_run.RemoteDeviceUirobotTestRun( | 54 return remote_device_uirobot_test_run.RemoteDeviceUirobotTestRun( |
49 env, test_instance) | 55 env, test_instance) |
50 | 56 |
51 | 57 |
52 error_func('Unable to create test run for %s tests in %s environment' | 58 error_func('Unable to create test run for %s tests in %s environment' |
53 % (str(test_instance), str(env))) | 59 % (str(test_instance), str(env))) |
54 | 60 |
OLD | NEW |