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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 wait_for_completion=False, | 78 wait_for_completion=False, |
79 action='android.intent.action.MAIN', | 79 action='android.intent.action.MAIN', |
80 force_stop=True) | 80 force_stop=True) |
81 | 81 |
82 #override | 82 #override |
83 def ClearApplicationState(self, device): | 83 def ClearApplicationState(self, device): |
84 device.old_interface.ClearApplicationState(self._package_info.package) | 84 device.old_interface.ClearApplicationState(self._package_info.package) |
85 # Content shell creates a profile on the sdscard which accumulates cache | 85 # Content shell creates a profile on the sdscard which accumulates cache |
86 # files over time. | 86 # files over time. |
87 if self.suite_name == 'content_browsertests': | 87 if self.suite_name == 'content_browsertests': |
88 device.old_interface.RunShellCommand( | 88 try: |
89 'rm -r %s/content_shell' % device.old_interface.GetExternalStorage(), | 89 device.old_interface.RunShellCommand( |
90 timeout_time=60 * 2) | 90 'rm -r %s/content_shell' % device.GetExternalStoragePath(), |
| 91 timeout_time=60 * 2) |
| 92 except device_errors.CommandFailedError: |
| 93 # TODO(jbudorick) Handle this exception appropriately once the |
| 94 # conversions are done. |
| 95 pass |
91 | 96 |
92 #override | 97 #override |
93 def CreateCommandLineFileOnDevice(self, device, test_filter, test_arguments): | 98 def CreateCommandLineFileOnDevice(self, device, test_filter, test_arguments): |
94 self._CreateCommandLineFileOnDevice( | 99 self._CreateCommandLineFileOnDevice( |
95 device, '--gtest_filter=%s %s' % (test_filter, test_arguments)) | 100 device, '--gtest_filter=%s %s' % (test_filter, test_arguments)) |
96 | 101 |
97 #override | 102 #override |
98 def GetAllTests(self, device): | 103 def GetAllTests(self, device): |
99 self._CreateCommandLineFileOnDevice(device, '--gtest_list_tests') | 104 self._CreateCommandLineFileOnDevice(device, '--gtest_list_tests') |
100 try: | 105 try: |
(...skipping 20 matching lines...) Expand all Loading... |
121 finally: | 126 finally: |
122 self.tool.CleanUpEnvironment() | 127 self.tool.CleanUpEnvironment() |
123 logfile = android_commands.NewLineNormalizer(sys.stdout) | 128 logfile = android_commands.NewLineNormalizer(sys.stdout) |
124 return self._WatchFifo(device, timeout=10, logfile=logfile) | 129 return self._WatchFifo(device, timeout=10, logfile=logfile) |
125 | 130 |
126 #override | 131 #override |
127 def Install(self, device): | 132 def Install(self, device): |
128 self.tool.CopyFiles() | 133 self.tool.CopyFiles() |
129 device.old_interface.ManagedInstall( | 134 device.old_interface.ManagedInstall( |
130 self.suite_path, False, package_name=self._package_info.package) | 135 self.suite_path, False, package_name=self._package_info.package) |
OLD | NEW |