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.instrumentation import test_runner as instr_test_runner | 7 from pylib.instrumentation import test_runner as instr_test_runner |
8 | 8 |
9 | 9 |
10 class TestRunner(instr_test_runner.TestRunner): | 10 class TestRunner(instr_test_runner.TestRunner): |
11 """Responsible for running a series of tests connected to a single device.""" | 11 """Responsible for running a series of tests connected to a single device.""" |
12 | 12 |
13 def __init__(self, package_name, build_type, test_data, save_perf_json, | 13 def __init__(self, package_name, build_type, test_data, save_perf_json, |
14 screenshot_failures, tool, wait_for_debugger, | 14 screenshot_failures, tool, wait_for_debugger, |
15 disable_assertions, push_deps, cleanup_test_files, device, | 15 disable_assertions, push_deps, cleanup_test_files, device, |
16 shard_index, test_pkg, ports_to_forward): | 16 shard_index, test_pkg, ports_to_forward): |
17 """Create a new TestRunner. | 17 """Create a new TestRunner. |
18 | 18 |
19 Args: | 19 Args: |
20 package_name: Application package name under test. | 20 package_name: Application package name under test. |
21 See the super class for all other args. | 21 See the super class for all other args. |
22 """ | 22 """ |
23 super(TestRunner, self).__init__( | 23 super(TestRunner, self).__init__( |
24 build_type, test_data, False, save_perf_json, screenshot_failures, tool, | 24 build_type, test_data, save_perf_json, screenshot_failures, tool, |
25 wait_for_debugger, disable_assertions, push_deps, cleanup_test_files, | 25 wait_for_debugger, disable_assertions, push_deps, cleanup_test_files, |
26 device, shard_index, test_pkg, ports_to_forward) | 26 device, shard_index, test_pkg, ports_to_forward) |
27 | 27 |
28 self.package_name = package_name | 28 self.package_name = package_name |
29 | 29 |
30 #override | 30 #override |
31 def InstallTestPackage(self): | 31 def InstallTestPackage(self): |
32 self.test_pkg.Install(self.adb) | 32 self.test_pkg.Install(self.adb) |
33 | 33 |
34 #override | 34 #override |
35 def PushDataDeps(self): | 35 def PushDataDeps(self): |
36 pass | 36 pass |
37 | 37 |
38 #override | 38 #override |
39 def _RunTest(self, test, timeout): | 39 def _RunTest(self, test, timeout): |
40 self.adb.ClearApplicationState(self.package_name) | 40 self.adb.ClearApplicationState(self.package_name) |
41 if 'Feature:FirstRunExperience' in self.test_pkg.GetTestAnnotations(test): | 41 if 'Feature:FirstRunExperience' in self.test_pkg.GetTestAnnotations(test): |
42 self.flags.RemoveFlags(['--disable-fre']) | 42 self.flags.RemoveFlags(['--disable-fre']) |
43 else: | 43 else: |
44 self.flags.AddFlags(['--disable-fre']) | 44 self.flags.AddFlags(['--disable-fre']) |
45 return self.adb.RunUIAutomatorTest( | 45 return self.adb.RunUIAutomatorTest( |
46 test, self.test_pkg.GetPackageName(), timeout) | 46 test, self.test_pkg.GetPackageName(), timeout) |
OLD | NEW |