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

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

Issue 2610243002: Import wpt@5e1a3b80cea8d36774d2afd78b29a74792e9f15a (Closed)
Patch Set: Update code that deals with manifest. 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
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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 tests = [] 793 tests = []
794 for file_path in files: 794 for file_path in files:
795 # Path separators are normalized by relative_test_filename(). 795 # Path separators are normalized by relative_test_filename().
796 match = re.search(r'imported/wpt/(.*)$', file_path) 796 match = re.search(r'imported/wpt/(.*)$', file_path)
797 if not match: 797 if not match:
798 tests.append(file_path) 798 tests.append(file_path)
799 continue 799 continue
800 path_in_wpt = match.group(1) 800 path_in_wpt = match.group(1)
801 manifest_items = self._manifest_items_for_path(path_in_wpt) 801 manifest_items = self._manifest_items_for_path(path_in_wpt)
802 assert manifest_items is not None 802 assert manifest_items is not None
803 if len(manifest_items) != 1 or manifest_items[0]['url'][1:] != path_ in_wpt: 803 # For most testharness tests, manifest_items looks like:
804 # [["/some/test/path.html", {}]]
805 if len(manifest_items) != 1 or manifest_items[0][0][1:] != path_in_w pt:
804 # TODO(tkent): foo.any.js and bar.worker.js should be accessed 806 # TODO(tkent): foo.any.js and bar.worker.js should be accessed
805 # as foo.any.html, foo.any.worker, and bar.worker with WPTServe. 807 # as foo.any.html, foo.any.worker, and bar.worker with WPTServe.
806 continue 808 continue
807 tests.append(file_path) 809 tests.append(file_path)
808 return tests 810 return tests
809 811
810 @memoized 812 @memoized
811 def _wpt_manifest(self): 813 def _wpt_manifest(self):
812 path = self._filesystem.join(self.layout_tests_dir(), 'imported', 'wpt', 'MANIFEST.json') 814 path = self._filesystem.join(self.layout_tests_dir(), 'imported', 'wpt', 'MANIFEST.json')
813 return json.loads(self._filesystem.read_text_file(path)) 815 return json.loads(self._filesystem.read_text_file(path))
814 816
815 def _manifest_items_for_path(self, path_in_wpt): 817 def _manifest_items_for_path(self, path_in_wpt):
816 """Returns a list of a dict representing ManifestItem for the specified 818 """Returns a manifest item for the given WPT path, or None if not found.
817 path, or None if MANIFEST.json has no items for the specified path.
818 819
819 A ManifestItem has 'path', 'url', and optional 'timeout' fields. Also, 820 The format of a manifest item depends on
820 it has "references" list for reference tests. It's defined in 821 https://github.com/w3c/wpt-tools/blob/master/manifest/item.py
821 web-platform-tests/tools/manifest/item.py. 822 and is assumed to be a list of the format [url, extras],
823 or [url, references, extras] for reftests, or None if not found.
822 """ 824 """
823 # Because we generate MANIFEST.json before finishing import, all 825 items = self._wpt_manifest()['items']
qyearsley 2017/01/05 18:48:32 Note, if preferable, these changes (to base.py and
824 # entries are in 'local_changes'.
825 items = self._wpt_manifest()['local_changes']['items']
826 if path_in_wpt in items['manual']: 826 if path_in_wpt in items['manual']:
827 return items['manual'][path_in_wpt] 827 return items['manual'][path_in_wpt]
828 elif path_in_wpt in items['reftest']: 828 elif path_in_wpt in items['reftest']:
829 return items['reftest'][path_in_wpt] 829 return items['reftest'][path_in_wpt]
830 elif path_in_wpt in items['testharness']: 830 elif path_in_wpt in items['testharness']:
831 return items['testharness'][path_in_wpt] 831 return items['testharness'][path_in_wpt]
832 return None 832 return None
833 833
834 ALL_TEST_TYPES = ['audio', 'harness', 'pixel', 'ref', 'text', 'unknown'] 834 ALL_TEST_TYPES = ['audio', 'harness', 'pixel', 'ref', 'text', 'unknown']
835 835
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 1794
1795 def __init__(self, base, args, reference_args=None): 1795 def __init__(self, base, args, reference_args=None):
1796 self.name = base 1796 self.name = base
1797 self.base = base 1797 self.base = base
1798 self.args = args 1798 self.args = args
1799 self.reference_args = args if reference_args is None else reference_args 1799 self.reference_args = args if reference_args is None else reference_args
1800 self.tests = set() 1800 self.tests = set()
1801 1801
1802 def __repr__(self): 1802 def __repr__(self):
1803 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) 1803 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698