Chromium Code Reviews| 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 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import re | 7 import re |
| 8 | 8 |
| 9 from pylib import android_commands | 9 from pylib import android_commands |
| 10 from pylib import constants | 10 from pylib import constants |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 | 153 |
| 154 return results | 154 return results |
| 155 | 155 |
| 156 #override | 156 #override |
| 157 def RunTest(self, test): | 157 def RunTest(self, test): |
| 158 test_results = base_test_result.TestRunResults() | 158 test_results = base_test_result.TestRunResults() |
| 159 if not test: | 159 if not test: |
| 160 return test_results, None | 160 return test_results, None |
| 161 | 161 |
| 162 try: | 162 try: |
| 163 self.test_package.ClearApplicationState(self.adb) | |
| 164 self.test_package.CreateCommandLineFileOnDevice( | 163 self.test_package.CreateCommandLineFileOnDevice( |
| 165 self.adb, test, self._test_arguments) | 164 self.adb, test, self._test_arguments) |
| 166 test_results = self._ParseTestOutput( | 165 test_results = self._ParseTestOutput( |
| 167 self.test_package.SpawnTestProcess(self.adb)) | 166 self.test_package.SpawnTestProcess(self.adb)) |
| 168 finally: | 167 finally: |
| 168 self.test_package.ClearApplicationState(self.adb) | |
|
craigdh
2013/08/12 16:11:06
It's now possible the tests start with some applic
frankf
2013/08/12 18:17:21
I removed the precondition assumption. Now we clea
| |
| 169 # Content shell creates a profile on the sdscard which accumulates cache | |
| 170 # files over time. | |
| 171 self.adb.RunShellCommand('rm -r ' + | |
| 172 os.path.join(self.adb.GetExternalStorage(), 'content_shell'), | |
| 173 timeout_time=60 * 2) | |
| 169 self.CleanupSpawningServerState() | 174 self.CleanupSpawningServerState() |
| 170 # Calculate unknown test results. | 175 # Calculate unknown test results. |
| 171 all_tests = set(test.split(':')) | 176 all_tests = set(test.split(':')) |
| 172 all_tests_ran = set([t.GetName() for t in test_results.GetAll()]) | 177 all_tests_ran = set([t.GetName() for t in test_results.GetAll()]) |
| 173 unknown_tests = all_tests - all_tests_ran | 178 unknown_tests = all_tests - all_tests_ran |
| 174 test_results.AddResults( | 179 test_results.AddResults( |
| 175 [base_test_result.BaseTestResult(t, base_test_result.ResultType.UNKNOWN) | 180 [base_test_result.BaseTestResult(t, base_test_result.ResultType.UNKNOWN) |
| 176 for t in unknown_tests]) | 181 for t in unknown_tests]) |
| 177 retry = ':'.join([t.GetName() for t in test_results.GetNotPass()]) | 182 retry = ':'.join([t.GetName() for t in test_results.GetNotPass()]) |
| 178 return test_results, retry | 183 return test_results, retry |
| 179 | 184 |
| 180 #override | 185 #override |
| 181 def SetUp(self): | 186 def SetUp(self): |
| 182 """Sets up necessary test enviroment for the test suite.""" | 187 """Sets up necessary test enviroment for the test suite.""" |
| 183 super(TestRunner, self).SetUp() | 188 super(TestRunner, self).SetUp() |
| 184 if _TestSuiteRequiresMockTestServer(self.test_package.suite_name): | 189 if _TestSuiteRequiresMockTestServer(self.test_package.suite_name): |
| 185 self.LaunchChromeTestServerSpawner() | 190 self.LaunchChromeTestServerSpawner() |
| 186 self.tool.SetupEnvironment() | 191 self.tool.SetupEnvironment() |
| 187 | 192 |
| 188 #override | 193 #override |
| 189 def TearDown(self): | 194 def TearDown(self): |
| 190 """Cleans up the test enviroment for the test suite.""" | 195 """Cleans up the test enviroment for the test suite.""" |
| 191 # Content shell creates a profile on the sdscard which accumulates cache | |
| 192 # files over time. | |
| 193 self.adb.RunShellCommand('rm -r ' + | |
| 194 os.path.join(self.adb.GetExternalStorage(), 'content_shell'), | |
| 195 timeout_time=60 * 2) | |
| 196 self.tool.CleanUpEnvironment() | 196 self.tool.CleanUpEnvironment() |
| 197 super(TestRunner, self).TearDown() | 197 super(TestRunner, self).TearDown() |
| OLD | NEW |