| 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 import constants |
| 8 from pylib import flag_changer | 8 from pylib import flag_changer |
| 9 from pylib.device import intent |
| 9 from pylib.instrumentation import test_options as instr_test_options | 10 from pylib.instrumentation import test_options as instr_test_options |
| 10 from pylib.instrumentation import test_runner as instr_test_runner | 11 from pylib.instrumentation import test_runner as instr_test_runner |
| 11 | 12 |
| 12 | 13 |
| 13 class TestRunner(instr_test_runner.TestRunner): | 14 class TestRunner(instr_test_runner.TestRunner): |
| 14 """Responsible for running a series of tests connected to a single device.""" | 15 """Responsible for running a series of tests connected to a single device.""" |
| 15 | 16 |
| 16 def __init__(self, test_options, device, shard_index, test_pkg): | 17 def __init__(self, test_options, device, shard_index, test_pkg): |
| 17 """Create a new TestRunner. | 18 """Create a new TestRunner. |
| 18 | 19 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 pass | 59 pass |
| 59 | 60 |
| 60 #override | 61 #override |
| 61 def _RunTest(self, test, timeout): | 62 def _RunTest(self, test, timeout): |
| 62 self.device.old_interface.ClearApplicationState(self._package) | 63 self.device.old_interface.ClearApplicationState(self._package) |
| 63 if self.flags: | 64 if self.flags: |
| 64 if 'Feature:FirstRunExperience' in self.test_pkg.GetTestAnnotations(test): | 65 if 'Feature:FirstRunExperience' in self.test_pkg.GetTestAnnotations(test): |
| 65 self.flags.RemoveFlags(['--disable-fre']) | 66 self.flags.RemoveFlags(['--disable-fre']) |
| 66 else: | 67 else: |
| 67 self.flags.AddFlags(['--disable-fre']) | 68 self.flags.AddFlags(['--disable-fre']) |
| 68 self.device.old_interface.StartActivity(self._package, | 69 self.device.StartActivity( |
| 69 self._activity, | 70 intent.Intent(action='android.intent.action.MAIN', |
| 70 wait_for_completion=True, | 71 activity=self._activity, |
| 71 action='android.intent.action.MAIN', | 72 package=self._package), |
| 72 force_stop=True) | 73 blocking=True, |
| 74 force_stop=True) |
| 73 return self.device.old_interface.RunUIAutomatorTest( | 75 return self.device.old_interface.RunUIAutomatorTest( |
| 74 test, self.test_pkg.GetPackageName(), timeout) | 76 test, self.test_pkg.GetPackageName(), timeout) |
| OLD | NEW |