Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py

Issue 2624333004: Simplify manifest-related code in Port to only support new format. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 tests = [] 763 tests = []
764 for file_path in files: 764 for file_path in files:
765 # Path separators are normalized by relative_test_filename(). 765 # Path separators are normalized by relative_test_filename().
766 match = re.search(r'imported/wpt/(.*)$', file_path) 766 match = re.search(r'imported/wpt/(.*)$', file_path)
767 if not match: 767 if not match:
768 tests.append(file_path) 768 tests.append(file_path)
769 continue 769 continue
770 path_in_wpt = match.group(1) 770 path_in_wpt = match.group(1)
771 manifest_items = self._manifest_items_for_path(path_in_wpt) 771 manifest_items = self._manifest_items_for_path(path_in_wpt)
772 assert manifest_items is not None 772 assert manifest_items is not None
773 # For most testharness tests, manifest_items looks like:
774 # [["/some/test/path.html", {}]]
775 if len(manifest_items) != 1: 773 if len(manifest_items) != 1:
776 continue 774 continue
777 # TODO(qyearsley): Simplify this after http://crbug.com/678077 is re solved. 775 url = manifest_items[0][0]
778 item = manifest_items[0]
779 url = item['url'] if 'url' in item else item[0]
780 if url[1:] != path_in_wpt: 776 if url[1:] != path_in_wpt:
781 # TODO(tkent): foo.any.js and bar.worker.js should be accessed 777 # TODO(tkent): foo.any.js and bar.worker.js should be accessed
782 # as foo.any.html, foo.any.worker, and bar.worker with WPTServe. 778 # as foo.any.html, foo.any.worker, and bar.worker with WPTServe.
783 continue 779 continue
784 tests.append(file_path) 780 tests.append(file_path)
785 return tests 781 return tests
786 782
787 @memoized 783 @memoized
788 def _wpt_manifest(self): 784 def _wpt_manifest(self):
789 path = self._filesystem.join(self.layout_tests_dir(), 'imported', 'wpt', 'MANIFEST.json') 785 path = self._filesystem.join(self.layout_tests_dir(), 'imported', 'wpt', 'MANIFEST.json')
790 return json.loads(self._filesystem.read_text_file(path)) 786 return json.loads(self._filesystem.read_text_file(path))
791 787
792 def _manifest_items_for_path(self, path_in_wpt): 788 def _manifest_items_for_path(self, path_in_wpt):
793 """Returns a manifest item for the given WPT path, or None if not found. 789 """Returns a manifest item for the given WPT path, or None if not found.
794 790
795 The format of a manifest item depends on 791 The format of a manifest item depends on
796 https://github.com/w3c/wpt-tools/blob/master/manifest/item.py 792 https://github.com/w3c/wpt-tools/blob/master/manifest/item.py
797 and is assumed to be a list of the format [url, extras], 793 and is assumed to be a list of the format [url, extras],
798 or [url, references, extras] for reftests, or None if not found. 794 or [url, references, extras] for reftests, or None if not found.
795
796 For most testharness tests, the returned manifest_items is expected
797 to look like this:: [["/some/test/path.html", {}]]
799 """ 798 """
800 # TODO(qyearsley): Simplify this after http://crbug.com/678077 is resolv ed. 799 items = self._wpt_manifest()['items']
801 if 'local_changes' in self._wpt_manifest():
802 items = self._wpt_manifest()['local_changes']['items']
803 else:
804 items = self._wpt_manifest()['items']
805 if path_in_wpt in items['manual']: 800 if path_in_wpt in items['manual']:
806 return items['manual'][path_in_wpt] 801 return items['manual'][path_in_wpt]
807 elif path_in_wpt in items['reftest']: 802 elif path_in_wpt in items['reftest']:
808 return items['reftest'][path_in_wpt] 803 return items['reftest'][path_in_wpt]
809 elif path_in_wpt in items['testharness']: 804 elif path_in_wpt in items['testharness']:
810 return items['testharness'][path_in_wpt] 805 return items['testharness'][path_in_wpt]
811 return None 806 return None
812 807
813 ALL_TEST_TYPES = ['audio', 'harness', 'pixel', 'ref', 'text', 'unknown'] 808 ALL_TEST_TYPES = ['audio', 'harness', 'pixel', 'ref', 'text', 'unknown']
814 809
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 1768
1774 def __init__(self, base, args, reference_args=None): 1769 def __init__(self, base, args, reference_args=None):
1775 self.name = base 1770 self.name = base
1776 self.base = base 1771 self.base = base
1777 self.args = args 1772 self.args = args
1778 self.reference_args = args if reference_args is None else reference_args 1773 self.reference_args = args if reference_args is None else reference_args
1779 self.tests = set() 1774 self.tests = set()
1780 1775
1781 def __repr__(self): 1776 def __repr__(self):
1782 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) 1777 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698