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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 pass | 58 pass |
58 | 59 |
59 #override | 60 #override |
60 def _RunTest(self, test, timeout): | 61 def _RunTest(self, test, timeout): |
61 self.device.old_interface.ClearApplicationState(self._package) | 62 self.device.old_interface.ClearApplicationState(self._package) |
62 if self.flags: | 63 if self.flags: |
63 if 'Feature:FirstRunExperience' in self.test_pkg.GetTestAnnotations(test): | 64 if 'Feature:FirstRunExperience' in self.test_pkg.GetTestAnnotations(test): |
64 self.flags.RemoveFlags(['--disable-fre']) | 65 self.flags.RemoveFlags(['--disable-fre']) |
65 else: | 66 else: |
66 self.flags.AddFlags(['--disable-fre']) | 67 self.flags.AddFlags(['--disable-fre']) |
67 self.device.old_interface.StartActivity(self._package, | 68 self.device.StartActivity( |
68 self._activity, | 69 intent.Intent(action='android.intent.action.MAIN', |
69 wait_for_completion=True, | 70 activity=self._activity, |
70 action='android.intent.action.MAIN', | 71 package=self._package), |
71 force_stop=True) | 72 blocking=True, |
| 73 force_stop=True) |
72 return self.device.old_interface.RunUIAutomatorTest( | 74 return self.device.old_interface.RunUIAutomatorTest( |
73 test, self.test_pkg.GetPackageName(), timeout) | 75 test, self.test_pkg.GetPackageName(), timeout) |
OLD | NEW |