| 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_options as instr_test_options | 7 from pylib.instrumentation import test_options as instr_test_options |
| 8 from pylib.instrumentation import test_runner as instr_test_runner | 8 from pylib.instrumentation import test_runner as instr_test_runner |
| 9 | 9 |
| 10 | 10 |
| 11 class TestRunner(instr_test_runner.TestRunner): | 11 class TestRunner(instr_test_runner.TestRunner): |
| 12 """Responsible for running a series of tests connected to a single device.""" | 12 """Responsible for running a series of tests connected to a single device.""" |
| 13 | 13 |
| 14 def __init__(self, test_options, device, shard_index, test_pkg, | 14 def __init__(self, test_options, device, shard_index, test_pkg, |
| 15 ports_to_forward): | 15 ports_to_forward): |
| 16 """Create a new TestRunner. | 16 """Create a new TestRunner. |
| 17 | 17 |
| 18 Args: | 18 Args: |
| 19 test_options: A UIAutomatorOptions object. | 19 test_options: A UIAutomatorOptions object. |
| 20 device: Attached android device. | 20 device: Attached android device. |
| 21 shard_index: Shard index. | 21 shard_index: Shard index. |
| 22 test_pkg: A TestPackage object. | 22 test_pkg: A TestPackage object. |
| 23 ports_to_forward: A list of port numbers for which to set up forwarders. | 23 ports_to_forward: A list of port numbers for which to set up forwarders. |
| 24 Can be optionally requested by a test case. | 24 Can be optionally requested by a test case. |
| 25 """ | 25 """ |
| 26 # Create an InstrumentationOptions object to pass to the super class | 26 # Create an InstrumentationOptions object to pass to the super class |
| 27 instrumentation_options = instr_test_options.InstrumentationOptions( | 27 instrumentation_options = instr_test_options.InstrumentationOptions( |
| 28 test_options.build_type, | |
| 29 test_options.tool, | 28 test_options.tool, |
| 30 test_options.cleanup_test_files, | 29 test_options.cleanup_test_files, |
| 31 test_options.push_deps, | 30 test_options.push_deps, |
| 32 test_options.annotations, | 31 test_options.annotations, |
| 33 test_options.exclude_annotations, | 32 test_options.exclude_annotations, |
| 34 test_options.test_filter, | 33 test_options.test_filter, |
| 35 test_options.test_data, | 34 test_options.test_data, |
| 36 test_options.save_perf_json, | 35 test_options.save_perf_json, |
| 37 test_options.screenshot_failures, | 36 test_options.screenshot_failures, |
| 38 wait_for_debugger=False, | 37 wait_for_debugger=False, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 54 | 53 |
| 55 #override | 54 #override |
| 56 def _RunTest(self, test, timeout): | 55 def _RunTest(self, test, timeout): |
| 57 self.adb.ClearApplicationState(self.package_name) | 56 self.adb.ClearApplicationState(self.package_name) |
| 58 if 'Feature:FirstRunExperience' in self.test_pkg.GetTestAnnotations(test): | 57 if 'Feature:FirstRunExperience' in self.test_pkg.GetTestAnnotations(test): |
| 59 self.flags.RemoveFlags(['--disable-fre']) | 58 self.flags.RemoveFlags(['--disable-fre']) |
| 60 else: | 59 else: |
| 61 self.flags.AddFlags(['--disable-fre']) | 60 self.flags.AddFlags(['--disable-fre']) |
| 62 return self.adb.RunUIAutomatorTest( | 61 return self.adb.RunUIAutomatorTest( |
| 63 test, self.test_pkg.GetPackageName(), timeout) | 62 test, self.test_pkg.GetPackageName(), timeout) |
| OLD | NEW |