OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Defines TestPackageApk to help run APK-based native tests.""" | 5 """Defines TestPackageApk to help run APK-based native tests.""" |
6 # pylint: disable=W0212 | 6 # pylint: disable=W0212 |
7 | 7 |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import shlex | 10 import shlex |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 device.StartActivity( | 75 device.StartActivity( |
76 intent.Intent(package=self._package_info.package, | 76 intent.Intent(package=self._package_info.package, |
77 activity=self._package_info.activity, | 77 activity=self._package_info.activity, |
78 action='android.intent.action.MAIN'), | 78 action='android.intent.action.MAIN'), |
79 # No wait since the runner waits for FIFO creation anyway. | 79 # No wait since the runner waits for FIFO creation anyway. |
80 blocking=False, | 80 blocking=False, |
81 force_stop=True) | 81 force_stop=True) |
82 | 82 |
83 #override | 83 #override |
84 def ClearApplicationState(self, device): | 84 def ClearApplicationState(self, device): |
85 device.old_interface.ClearApplicationState(self._package_info.package) | 85 device.ClearApplicationState(self._package_info.package) |
86 # Content shell creates a profile on the sdscard which accumulates cache | 86 # Content shell creates a profile on the sdscard which accumulates cache |
87 # files over time. | 87 # files over time. |
88 if self.suite_name == 'content_browsertests': | 88 if self.suite_name == 'content_browsertests': |
89 try: | 89 try: |
90 device.RunShellCommand( | 90 device.RunShellCommand( |
91 'rm -r %s/content_shell' % device.GetExternalStoragePath(), | 91 'rm -r %s/content_shell' % device.GetExternalStoragePath(), |
92 timeout=60 * 2) | 92 timeout=60 * 2) |
93 except device_errors.CommandFailedError: | 93 except device_errors.CommandFailedError: |
94 # TODO(jbudorick) Handle this exception appropriately once the | 94 # TODO(jbudorick) Handle this exception appropriately once the |
95 # conversions are done. | 95 # conversions are done. |
(...skipping 30 matching lines...) Expand all Loading... |
126 self._StartActivity(device) | 126 self._StartActivity(device) |
127 finally: | 127 finally: |
128 self.tool.CleanUpEnvironment() | 128 self.tool.CleanUpEnvironment() |
129 logfile = android_commands.NewLineNormalizer(sys.stdout) | 129 logfile = android_commands.NewLineNormalizer(sys.stdout) |
130 return self._WatchFifo(device, timeout=10, logfile=logfile) | 130 return self._WatchFifo(device, timeout=10, logfile=logfile) |
131 | 131 |
132 #override | 132 #override |
133 def Install(self, device): | 133 def Install(self, device): |
134 self.tool.CopyFiles() | 134 self.tool.CopyFiles() |
135 device.Install(self.suite_path) | 135 device.Install(self.suite_path) |
OLD | NEW |