| 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 | 6 |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import shlex | 9 import shlex |
| 10 import sys | 10 import sys |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 adb.StartActivity( | 80 adb.StartActivity( |
| 81 self._test_apk_package_name, | 81 self._test_apk_package_name, |
| 82 self._test_activity_name, | 82 self._test_activity_name, |
| 83 wait_for_completion=True, | 83 wait_for_completion=True, |
| 84 action='android.intent.action.MAIN', | 84 action='android.intent.action.MAIN', |
| 85 force_stop=True) | 85 force_stop=True) |
| 86 | 86 |
| 87 #override | 87 #override |
| 88 def ClearApplicationState(self, adb): | 88 def ClearApplicationState(self, adb): |
| 89 adb.ClearApplicationState(self._test_apk_package_name) | 89 adb.ClearApplicationState(self._test_apk_package_name) |
| 90 # Content shell creates a profile on the sdscard which accumulates cache |
| 91 # files over time. |
| 92 if self.suite_name == 'content_browsertests': |
| 93 adb.RunShellCommand( |
| 94 'rm -r %s/content_shell' % adb.GetExternalStorage(), |
| 95 timeout_time=60 * 2) |
| 90 | 96 |
| 91 #override | 97 #override |
| 92 def CreateCommandLineFileOnDevice(self, adb, test_filter, test_arguments): | 98 def CreateCommandLineFileOnDevice(self, adb, test_filter, test_arguments): |
| 93 self._CreateCommandLineFileOnDevice( | 99 self._CreateCommandLineFileOnDevice( |
| 94 adb, '--gtest_filter=%s %s' % (test_filter, test_arguments)) | 100 adb, '--gtest_filter=%s %s' % (test_filter, test_arguments)) |
| 95 | 101 |
| 96 #override | 102 #override |
| 97 def GetAllTests(self, adb): | 103 def GetAllTests(self, adb): |
| 98 self._CreateCommandLineFileOnDevice(adb, '--gtest_list_tests') | 104 self._CreateCommandLineFileOnDevice(adb, '--gtest_list_tests') |
| 99 try: | 105 try: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 120 finally: | 126 finally: |
| 121 self.tool.CleanUpEnvironment() | 127 self.tool.CleanUpEnvironment() |
| 122 logfile = android_commands.NewLineNormalizer(sys.stdout) | 128 logfile = android_commands.NewLineNormalizer(sys.stdout) |
| 123 return self._WatchFifo(adb, timeout=10, logfile=logfile) | 129 return self._WatchFifo(adb, timeout=10, logfile=logfile) |
| 124 | 130 |
| 125 #override | 131 #override |
| 126 def Install(self, adb): | 132 def Install(self, adb): |
| 127 self.tool.CopyFiles() | 133 self.tool.CopyFiles() |
| 128 adb.ManagedInstall(self.suite_path, False, | 134 adb.ManagedInstall(self.suite_path, False, |
| 129 package_name=self._test_apk_package_name) | 135 package_name=self._test_apk_package_name) |
| OLD | NEW |