OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 collections | 5 import collections |
6 import copy | 6 import copy |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import pickle | 9 import pickle |
10 import re | 10 import re |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 for t in self._test_data: | 457 for t in self._test_data: |
458 device_rel_path, host_rel_path = t.split(':') | 458 device_rel_path, host_rel_path = t.split(':') |
459 host_abs_path = os.path.join(host_paths.DIR_SOURCE_ROOT, host_rel_path) | 459 host_abs_path = os.path.join(host_paths.DIR_SOURCE_ROOT, host_rel_path) |
460 self._data_deps.extend( | 460 self._data_deps.extend( |
461 [(host_abs_path, | 461 [(host_abs_path, |
462 [None, 'chrome', 'test', 'data', device_rel_path])]) | 462 [None, 'chrome', 'test', 'data', device_rel_path])]) |
463 | 463 |
464 def GetDataDependencies(self): | 464 def GetDataDependencies(self): |
465 return self._data_deps | 465 return self._data_deps |
466 | 466 |
467 def GetTests(self): | 467 def _GetAllTests(self): |
468 pickle_path = '%s-proguard.pickle' % self.test_jar | 468 pickle_path = '%s-proguard.pickle' % self.test_jar |
469 try: | 469 try: |
470 tests = self._GetTestsFromPickle(pickle_path, self.test_jar) | 470 tests = self._GetTestsFromPickle(pickle_path, self.test_jar) |
471 except self.ProguardPickleException as e: | 471 except self.ProguardPickleException as e: |
472 logging.info('Getting tests from JAR via proguard. (%s)', str(e)) | 472 logging.info('Getting tests from JAR via proguard. (%s)', str(e)) |
473 tests = self._GetTestsFromProguard(self.test_jar) | 473 tests = self._GetTestsFromProguard(self.test_jar) |
474 self._SaveTestsToPickle(pickle_path, self.test_jar, tests) | 474 self._SaveTestsToPickle(pickle_path, self.test_jar, tests) |
475 return self._ParametrizeTestsWithFlags( | 475 return tests |
476 self._InflateTests(self._FilterTests(tests))) | 476 |
| 477 def TotalTestAmount(self): |
| 478 total_test_amount = 0 |
| 479 tests = self._GetAllTests() |
| 480 for c in tests: |
| 481 total_test_amount += len(c['methods']) |
| 482 return total_test_amount |
| 483 |
| 484 def GetFilteredTests(self): |
| 485 tests = self._GetAllTests() |
| 486 return self._FilterTests(tests) |
| 487 |
| 488 def GetTests(self): |
| 489 filtered_tests = self.GetFilteredTests() |
| 490 return self._ParametrizeTestsWithFlags(filtered_tests) |
477 | 491 |
478 class ProguardPickleException(Exception): | 492 class ProguardPickleException(Exception): |
479 pass | 493 pass |
480 | 494 |
481 def _GetTestsFromPickle(self, pickle_path, jar_path): | 495 def _GetTestsFromPickle(self, pickle_path, jar_path): |
482 if not os.path.exists(pickle_path): | 496 if not os.path.exists(pickle_path): |
483 raise self.ProguardPickleException('%s does not exist.' % pickle_path) | 497 raise self.ProguardPickleException('%s does not exist.' % pickle_path) |
484 if os.path.getmtime(pickle_path) <= os.path.getmtime(jar_path): | 498 if os.path.getmtime(pickle_path) <= os.path.getmtime(jar_path): |
485 raise self.ProguardPickleException( | 499 raise self.ProguardPickleException( |
486 '%s newer than %s.' % (jar_path, pickle_path)) | 500 '%s newer than %s.' % (jar_path, pickle_path)) |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 def GenerateTestResults( | 649 def GenerateTestResults( |
636 result_code, result_bundle, statuses, start_ms, duration_ms): | 650 result_code, result_bundle, statuses, start_ms, duration_ms): |
637 return GenerateTestResults(result_code, result_bundle, statuses, | 651 return GenerateTestResults(result_code, result_bundle, statuses, |
638 start_ms, duration_ms) | 652 start_ms, duration_ms) |
639 | 653 |
640 #override | 654 #override |
641 def TearDown(self): | 655 def TearDown(self): |
642 if self._isolate_delegate: | 656 if self._isolate_delegate: |
643 self._isolate_delegate.Clear() | 657 self._isolate_delegate.Clear() |
644 | 658 |
OLD | NEW |