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 for running uiautomator tests on a single device.""" | 5 """Class for running uiautomator tests on a single device.""" |
6 | 6 |
7 from pylib import constants | |
7 from pylib.instrumentation import test_options as instr_test_options | 8 from pylib.instrumentation import test_options as instr_test_options |
8 from pylib.instrumentation import test_runner as instr_test_runner | 9 from pylib.instrumentation import test_runner as instr_test_runner |
9 | 10 |
10 | 11 |
11 class TestRunner(instr_test_runner.TestRunner): | 12 class TestRunner(instr_test_runner.TestRunner): |
12 """Responsible for running a series of tests connected to a single device.""" | 13 """Responsible for running a series of tests connected to a single device.""" |
13 | 14 |
14 def __init__(self, test_options, device, shard_index, test_pkg, | 15 def __init__(self, test_options, device, shard_index, test_pkg, |
15 ports_to_forward): | 16 ports_to_forward): |
16 """Create a new TestRunner. | 17 """Create a new TestRunner. |
(...skipping 18 matching lines...) Expand all Loading... | |
35 test_options.save_perf_json, | 36 test_options.save_perf_json, |
36 test_options.screenshot_failures, | 37 test_options.screenshot_failures, |
37 wait_for_debugger=False, | 38 wait_for_debugger=False, |
38 coverage_dir=None, | 39 coverage_dir=None, |
39 test_apk=None, | 40 test_apk=None, |
40 test_apk_path=None, | 41 test_apk_path=None, |
41 test_apk_jar_path=None) | 42 test_apk_jar_path=None) |
42 super(TestRunner, self).__init__(instrumentation_options, device, | 43 super(TestRunner, self).__init__(instrumentation_options, device, |
43 shard_index, test_pkg, ports_to_forward) | 44 shard_index, test_pkg, ports_to_forward) |
44 | 45 |
45 self.package_name = test_options.package_name | 46 self._package = constants.PACKAGE_INFO[test_options.package].package |
47 self._activity = constants.PACKAGE_INFO[test_options.package].activity | |
46 | 48 |
47 #override | 49 #override |
48 def InstallTestPackage(self): | 50 def InstallTestPackage(self): |
49 self.test_pkg.Install(self.adb) | 51 self.test_pkg.Install(self.adb) |
50 | 52 |
51 #override | 53 #override |
52 def PushDataDeps(self): | 54 def PushDataDeps(self): |
53 pass | 55 pass |
54 | 56 |
55 #override | 57 #override |
56 def _RunTest(self, test, timeout): | 58 def _RunTest(self, test, timeout): |
57 self.adb.ClearApplicationState(self.package_name) | 59 self.adb.ClearApplicationState(self._package) |
58 if 'Feature:FirstRunExperience' in self.test_pkg.GetTestAnnotations(test): | 60 if 'Feature:FirstRunExperience' in self.test_pkg.GetTestAnnotations(test): |
59 self.flags.RemoveFlags(['--disable-fre']) | 61 self.flags.RemoveFlags(['--disable-fre']) |
60 else: | 62 else: |
61 self.flags.AddFlags(['--disable-fre']) | 63 self.flags.AddFlags(['--disable-fre']) |
64 self.adb.StartActivity(self._package, | |
craigdh
2013/10/08 16:57:49
How was this being started before?
| |
65 self._activity, | |
66 wait_for_completion=True, | |
67 action='android.intent.action.MAIN', | |
68 force_stop=True) | |
62 return self.adb.RunUIAutomatorTest( | 69 return self.adb.RunUIAutomatorTest( |
63 test, self.test_pkg.GetPackageName(), timeout) | 70 test, self.test_pkg.GetPackageName(), timeout) |
OLD | NEW |