| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 @staticmethod | 633 @staticmethod |
| 634 def _has_supported_extension(filesystem, filename): | 634 def _has_supported_extension(filesystem, filename): |
| 635 """Return true if filename is one of the file extensions we want to run
a test on.""" | 635 """Return true if filename is one of the file extensions we want to run
a test on.""" |
| 636 extension = filesystem.splitext(filename)[1] | 636 extension = filesystem.splitext(filename)[1] |
| 637 return extension in Port._supported_file_extensions | 637 return extension in Port._supported_file_extensions |
| 638 | 638 |
| 639 @staticmethod | 639 @staticmethod |
| 640 def is_test_file(filesystem, dirname, filename): | 640 def is_test_file(filesystem, dirname, filename): |
| 641 return Port._has_supported_extension(filesystem, filename) and not Port.
is_reference_html_file(filesystem, dirname, filename) | 641 return Port._has_supported_extension(filesystem, filename) and not Port.
is_reference_html_file(filesystem, dirname, filename) |
| 642 | 642 |
| 643 ALL_TEST_TYPES = ['audio', 'harness', 'pixel', 'ref', 'text', 'unknown'] |
| 644 |
| 645 def test_type(self, test_name): |
| 646 fs = self._filesystem |
| 647 if fs.exists(self.expected_filename(test_name, '.png')): |
| 648 return 'pixel' |
| 649 if fs.exists(self.expected_filename(test_name, '.wav')): |
| 650 return 'audio' |
| 651 if self.reference_files(test_name): |
| 652 return 'ref' |
| 653 txt = self.expected_text(test_name) |
| 654 if txt: |
| 655 if 'layer at (0,0) size 800x600' in txt: |
| 656 return 'pixel' |
| 657 for line in txt.splitlines(): |
| 658 if line.startswith('FAIL') or line.startswith('TIMEOUT') or line
.startswith('PASS'): |
| 659 return 'harness' |
| 660 return 'text' |
| 661 return 'unknown' |
| 662 |
| 643 def test_key(self, test_name): | 663 def test_key(self, test_name): |
| 644 """Turns a test name into a list with two sublists, the natural key of t
he | 664 """Turns a test name into a list with two sublists, the natural key of t
he |
| 645 dirname, and the natural key of the basename. | 665 dirname, and the natural key of the basename. |
| 646 | 666 |
| 647 This can be used when sorting paths so that files in a directory. | 667 This can be used when sorting paths so that files in a directory. |
| 648 directory are kept together rather than being mixed in with files in | 668 directory are kept together rather than being mixed in with files in |
| 649 subdirectories.""" | 669 subdirectories.""" |
| 650 dirname, basename = self.split_test(test_name) | 670 dirname, basename = self.split_test(test_name) |
| 651 return (self._natural_sort_key(dirname + self.TEST_PATH_SEPARATOR), self
._natural_sort_key(basename)) | 671 return (self._natural_sort_key(dirname + self.TEST_PATH_SEPARATOR), self
._natural_sort_key(basename)) |
| 652 | 672 |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 | 1468 |
| 1449 class VirtualTestSuite(object): | 1469 class VirtualTestSuite(object): |
| 1450 def __init__(self, name, base, args, tests=None): | 1470 def __init__(self, name, base, args, tests=None): |
| 1451 self.name = name | 1471 self.name = name |
| 1452 self.base = base | 1472 self.base = base |
| 1453 self.args = args | 1473 self.args = args |
| 1454 self.tests = tests or set() | 1474 self.tests = tests or set() |
| 1455 | 1475 |
| 1456 def __repr__(self): | 1476 def __repr__(self): |
| 1457 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self.
args) | 1477 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self.
args) |
| OLD | NEW |