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

Unified Diff: Tools/Scripts/webkitpy/w3c/test_converter.py

Issue 353983003: Making it possible to import mediastream tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Setting execute bits on importer scripts. Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/resources/vendor-prefix.js ('k') | Tools/Scripts/webkitpy/w3c/test_converter_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/Scripts/webkitpy/w3c/test_converter.py
diff --git a/Tools/Scripts/webkitpy/w3c/test_converter.py b/Tools/Scripts/webkitpy/w3c/test_converter.py
old mode 100644
new mode 100755
index 5b102754d4d19ec2284a1de8dd0452f2c5baddf1..1c49a5bf34470af9245d274f6f451dc18412f841
--- a/Tools/Scripts/webkitpy/w3c/test_converter.py
+++ b/Tools/Scripts/webkitpy/w3c/test_converter.py
@@ -68,7 +68,7 @@ class _W3CTestConverter(HTMLParser):
resources_path = self.path_from_webkit_root('LayoutTests', 'resources')
resources_relpath = self._filesystem.relpath(resources_path, new_path)
- self.new_test_harness_path = resources_relpath
+ self.resources_relpath = resources_relpath
# These settings might vary between WebKit and Blink
self._css_property_file = self.path_from_webkit_root('Source', 'core', 'css', 'CSSPropertyNames.in')
@@ -76,8 +76,6 @@ class _W3CTestConverter(HTMLParser):
self.prefixed_properties = self.read_webkit_prefixed_css_property_list()
- self.test_harness_re = re.compile('/resources/testharness')
-
self.prefixed_properties = self.read_webkit_prefixed_css_property_list()
prop_regex = '([\s{]|^)(' + "|".join(prop.replace('-webkit-', '') for prop in self.prefixed_properties) + ')(\s+:|:)'
self.prop_re = re.compile(prop_regex)
@@ -138,18 +136,28 @@ class _W3CTestConverter(HTMLParser):
def convert_attributes_if_needed(self, tag, attrs):
converted = self.get_starttag_text()
if tag in ('script', 'link'):
- attr_name = 'src'
+ target_attr = 'src'
if tag != 'script':
- attr_name = 'href'
- for attr in attrs:
- if attr[0] == attr_name:
- new_path = re.sub(self.test_harness_re, self.new_test_harness_path + '/testharness', attr[1])
- converted = re.sub(attr[1], new_path, converted)
-
- for attr in attrs:
- if attr[0] == 'style':
- new_style = self.convert_style_data(attr[1])
- converted = re.sub(attr[1], new_style, converted)
+ target_attr = 'href'
+ for attr_name, attr_value in attrs:
+ if attr_name == target_attr:
+ new_path = re.sub('/resources/testharness',
+ self.resources_relpath + '/testharness',
+ attr_value)
+ converted = re.sub(attr_value, new_path, converted)
+ new_path = re.sub('/common/vendor-prefix',
+ self.resources_relpath + '/vendor-prefix',
+ attr_value)
+ converted = re.sub(attr_value, new_path, converted)
+
+ for attr_name, attr_value in attrs:
+ if attr_name == 'style':
+ new_style = self.convert_style_data(attr_value)
+ converted = re.sub(attr_value, new_style, converted)
+ if attr_name == 'class' and 'instructions' in attr_value:
+ # Always hide instructions, they're for manual testers.
+ converted = re.sub(' style=".*?"', '', converted)
+ converted = re.sub('\>', ' style="display:none">', converted)
self.converted_data.append(converted)
« no previous file with comments | « LayoutTests/resources/vendor-prefix.js ('k') | Tools/Scripts/webkitpy/w3c/test_converter_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698