OLD | NEW |
---|---|
(Empty) | |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 """Run specific test on specific environment.""" | |
6 | |
7 import logging | |
8 import os | |
9 import sys | |
10 | |
11 from pylib import constants | |
12 from pylib.remote.device import remote_device_test_run | |
13 from pylib.remote.device import remote_device_helper | |
14 | |
15 sys.path.append(os.path.join( | |
16 constants.DIR_SOURCE_ROOT, 'third_party', 'appurify-python', 'src')) | |
17 import appurify.api | |
18 import appurify.utils | |
19 | |
20 class RemoteDeviceGtestRun(remote_device_test_run.RemoteDeviceTestRun): | |
21 """Run gtests and uirobot tests on a remote device.""" | |
22 | |
23 DEFAULT_RUNNER_TYPE = 'robotium' | |
24 DEFAULT_RUNNER_PACKAGE = ( | |
25 'org.chromium.native_test.ChromiumNativeTestInstrumentationTestRunner') | |
26 | |
27 def __init__(self, env, test_instance): | |
28 """Constructor. | |
29 | |
30 Args: | |
31 env: Environment the tests will run in. | |
32 test_instance: The test that will be run. | |
33 """ | |
34 super(RemoteDeviceGtestRun, self).__init__(env, test_instance) | |
35 | |
36 def TestPackage(self): | |
37 pass | |
38 | |
39 #override | |
40 def SetUp(self): | |
41 """Setup the test run.""" | |
42 self._app_id = self.UploadAppToDevice() | |
43 | |
44 if not self._env.runner_type: | |
45 runner_type = self.DEFAULT_RUNNER_TYPE | |
46 logging.debug('Using default runner type: %s', self.DEFAULT_RUNNER_TYPE) | |
47 else: | |
48 runner_type = self._env.runner_type | |
49 if not self._env.runner_package: | |
jbudorick
2014/12/03 22:46:09
This might be a bit more readable with a line brea
rnephew (Reviews Here)
2014/12/03 23:49:25
Done.
| |
50 runner_package = self.DEFAULT_RUNNER_PACKAGE | |
51 logging.debug('Using default runner package: %s', | |
52 self.DEFAULT_RUNNER_TYPE) | |
53 else: | |
54 runner_package = self._env.runner_package | |
55 self._test_id = self.UploadTestToDevice(runner_type) | |
jbudorick
2014/12/03 22:46:09
Same.
rnephew (Reviews Here)
2014/12/03 23:49:25
Done.
| |
56 config_body = {'runner': runner_package} | |
57 self.SetTestConfig(runner_type, config_body) | |
58 | |
OLD | NEW |