OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """Class representing uiautomator test package.""" | 5 """Class representing uiautomator test package.""" |
6 | 6 |
7 import os | 7 import os |
8 | 8 |
9 from pylib import constants | 9 from pylib import constants |
10 from pylib.instrumentation import test_jar | 10 from pylib.instrumentation import test_jar |
11 | 11 |
12 | 12 |
13 class TestPackage(test_jar.TestJar): | 13 class TestPackage(test_jar.TestJar): |
| 14 |
| 15 UIAUTOMATOR_PATH = 'uiautomator/' |
| 16 UIAUTOMATOR_DEVICE_DIR = os.path.join(constants.TEST_EXECUTABLE_DIR, |
| 17 UIAUTOMATOR_PATH) |
| 18 |
14 def __init__(self, jar_path, jar_info_path): | 19 def __init__(self, jar_path, jar_info_path): |
15 test_jar.TestJar.__init__(self, jar_info_path) | 20 test_jar.TestJar.__init__(self, jar_info_path) |
16 | 21 |
17 if not os.path.exists(jar_path): | 22 if not os.path.exists(jar_path): |
18 raise Exception('%s not found, please build it' % jar_path) | 23 raise Exception('%s not found, please build it' % jar_path) |
19 self._jar_path = jar_path | 24 self._jar_path = jar_path |
20 | 25 |
21 def GetPackageName(self): | 26 def GetPackageName(self): |
22 """Returns the JAR named that is installed on the device.""" | 27 """Returns the JAR named that is installed on the device.""" |
23 return os.path.basename(self._jar_path) | 28 return os.path.basename(self._jar_path) |
24 | 29 |
25 # Override. | 30 # Override. |
26 def Install(self, device): | 31 def Install(self, device): |
27 device.PushChangedFiles([(self._jar_path, constants.TEST_EXECUTABLE_DIR)]) | 32 device.PushChangedFiles([(self._jar_path, self.UIAUTOMATOR_DEVICE_DIR + |
| 33 self.GetPackageName())]) |
OLD | NEW |