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 glob | 5 import glob |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 | 9 |
10 from pylib import android_commands | 10 from pylib import android_commands |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 #override | 361 #override |
362 def RunTest(self, test): | 362 def RunTest(self, test): |
363 test_results = base_test_result.TestRunResults() | 363 test_results = base_test_result.TestRunResults() |
364 if not test: | 364 if not test: |
365 return test_results, None | 365 return test_results, None |
366 | 366 |
367 try: | 367 try: |
368 self.test_package.ClearApplicationState() | 368 self.test_package.ClearApplicationState() |
369 self.test_package.CreateTestRunnerScript(test, self._test_arguments) | 369 self.test_package.CreateTestRunnerScript(test, self._test_arguments) |
370 test_results = self.test_package.RunTestsAndListResults() | 370 test_results = self.test_package.RunTestsAndListResults() |
371 except errors.DeviceUnresponsiveError as e: | |
372 # Make sure this device is not attached | |
373 logging.warning(e) | |
374 if android_commands.IsDeviceAttached(self.device): | |
375 raise | |
376 finally: | 371 finally: |
377 self.CleanupSpawningServerState() | 372 self.CleanupSpawningServerState() |
378 # Calculate unknown test results. | 373 # Calculate unknown test results. |
379 all_tests = set(test.split(':')) | 374 all_tests = set(test.split(':')) |
380 all_tests_ran = set([t.GetName() for t in test_results.GetAll()]) | 375 all_tests_ran = set([t.GetName() for t in test_results.GetAll()]) |
381 unknown_tests = all_tests - all_tests_ran | 376 unknown_tests = all_tests - all_tests_ran |
382 test_results.AddResults( | 377 test_results.AddResults( |
383 [base_test_result.BaseTestResult(t, base_test_result.ResultType.UNKNOWN) | 378 [base_test_result.BaseTestResult(t, base_test_result.ResultType.UNKNOWN) |
384 for t in unknown_tests]) | 379 for t in unknown_tests]) |
385 retry = ':'.join([t.GetName() for t in test_results.GetNotPass()]) | 380 retry = ':'.join([t.GetName() for t in test_results.GetNotPass()]) |
386 return test_results, retry | 381 return test_results, retry |
387 | 382 |
388 #override | 383 #override |
389 def SetUp(self): | 384 def SetUp(self): |
390 """Sets up necessary test enviroment for the test suite.""" | 385 """Sets up necessary test enviroment for the test suite.""" |
391 super(TestRunner, self).SetUp() | 386 super(TestRunner, self).SetUp() |
392 if _TestSuiteRequiresMockTestServer(self.test_package.test_suite_basename): | 387 if _TestSuiteRequiresMockTestServer(self.test_package.test_suite_basename): |
393 self.LaunchChromeTestServerSpawner() | 388 self.LaunchChromeTestServerSpawner() |
394 self.tool.SetupEnvironment() | 389 self.tool.SetupEnvironment() |
395 | 390 |
396 #override | 391 #override |
397 def TearDown(self): | 392 def TearDown(self): |
398 """Cleans up the test enviroment for the test suite.""" | 393 """Cleans up the test enviroment for the test suite.""" |
399 self.tool.CleanUpEnvironment() | 394 self.tool.CleanUpEnvironment() |
400 if self._cleanup_test_files: | 395 if self._cleanup_test_files: |
401 self.adb.RemovePushedFiles() | 396 self.adb.RemovePushedFiles() |
402 super(TestRunner, self).TearDown() | 397 super(TestRunner, self).TearDown() |
OLD | NEW |