Create a script to import W3C tests

https://bugs.webkit.org/show_bug.cgi?id=111513

Patch by Rebecca Hauck <rhauck@adobe.com> on 2013-05-03
Reviewed by Dirk Pranke.

Script to automate the import of W3C tests into WebKit.
For the full description of how it works, see the comments
at the top of test_importer.py.

* Scripts/import-w3c-tests: Added.
* Scripts/webkitpy/w3c/__init__.py: Added.
* Scripts/webkitpy/w3c/test_converter.py: Added.
(TestConverter):
(TestConverter.__init__):
(TestConverter.load_prefixed_prop_list):
(TestConverter.load_file):
(TestConverter.convert_for_webkit):
(TestConverter.convert_testharness_paths):
(TestConverter.convert_prefixed_properties):
(TestConverter.scrub_unprefixed_props):
(TestConverter.replace_tag):
* Scripts/webkitpy/w3c/test_converter_unittest.py: Added.
(TestConverterTest):
(TestConverterTest.testLoadPrefixedPropList):
(TestConverterTest.test_convertForWebkitNothingToConvert):
(test_convertForWebkitHarnessOnly):
(test_convertForWebkitPropsOnly):
(test_convertForWebkitHarnessAndProps):
(test_convertTestHarnessPaths):
(test_convertPrefixedProperties):
(verifyTestHarnessPaths):
(verifyPrefixedProperties):
(generateTestContent):
* Scripts/webkitpy/w3c/test_importer.py: Added.
(main):
(parse_args):
(validate_import_directory):
(TestImporter):
(TestImporter.__init__):
(TestImporter.do_import):
(TestImporter.get_changeset):
(TestImporter.scan_source_directory):
(TestImporter.import_tests):
(TestImporter.setup_destination_directory):
(TestImporter.get_test_status):
(TestImporter.remove_deleted_files):
(TestImporter.write_import_log):
* Scripts/webkitpy/w3c/test_importer_unittest.py: Added.
(TestImporterTest):
(TestImporterTest.test_ImportDirWithNoTests):
* Scripts/webkitpy/w3c/test_parser.py: Added.
(TestParser):
(TestParser.__init__):
(TestParser.load_file):
(TestParser.analyze_test):
(TestParser.get_reftests):
(TestParser.is_jstest):
(TestParser.get_support_files):
* Scripts/webkitpy/w3c/test_parser_unittest.py: Added.
(TestParserTest):
(TestParserTest.test_analyzeTestReftestOneMatch):
(test_analyzeTestReftestMultipleMatches):
(test_analyzeTestReftestMatchAndMismatch):
(test_analyzeTestReftestWithRefSupportFiles):
(test_analyzeJSTest):
(test_analyzePixelTestAllTrue):
(test_analyzePixelTestAllFalse):
(test_analyzeNonHTMLFile):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1cc115d3
2013-05-03 Rebecca Hauck <rhauck@adobe.com>
Create a script to import W3C tests
https://bugs.webkit.org/show_bug.cgi?id=111513
Reviewed by Dirk Pranke.
Script to automate the import of W3C tests into WebKit.
For the full description of how it works, see the comments
at the top of test_importer.py.
* Scripts/import-w3c-tests: Added.
* Scripts/webkitpy/w3c/__init__.py: Added.
* Scripts/webkitpy/w3c/test_converter.py: Added.
(TestConverter):
(TestConverter.__init__):
(TestConverter.load_prefixed_prop_list):
(TestConverter.load_file):
(TestConverter.convert_for_webkit):
(TestConverter.convert_testharness_paths):
(TestConverter.convert_prefixed_properties):
(TestConverter.scrub_unprefixed_props):
(TestConverter.replace_tag):
* Scripts/webkitpy/w3c/test_converter_unittest.py: Added.
(TestConverterTest):
(TestConverterTest.testLoadPrefixedPropList):
(TestConverterTest.test_convertForWebkitNothingToConvert):
(test_convertForWebkitHarnessOnly):
(test_convertForWebkitPropsOnly):
(test_convertForWebkitHarnessAndProps):
(test_convertTestHarnessPaths):
(test_convertPrefixedProperties):
(verifyTestHarnessPaths):
(verifyPrefixedProperties):
(generateTestContent):
* Scripts/webkitpy/w3c/test_importer.py: Added.
(main):
(parse_args):
(validate_import_directory):
(TestImporter):
(TestImporter.__init__):
(TestImporter.do_import):
(TestImporter.get_changeset):
(TestImporter.scan_source_directory):
(TestImporter.import_tests):
(TestImporter.setup_destination_directory):
(TestImporter.get_test_status):
(TestImporter.remove_deleted_files):
(TestImporter.write_import_log):
* Scripts/webkitpy/w3c/test_importer_unittest.py: Added.
(TestImporterTest):
(TestImporterTest.test_ImportDirWithNoTests):
* Scripts/webkitpy/w3c/test_parser.py: Added.
(TestParser):
(TestParser.__init__):
(TestParser.load_file):
(TestParser.analyze_test):
(TestParser.get_reftests):
(TestParser.is_jstest):
(TestParser.get_support_files):
* Scripts/webkitpy/w3c/test_parser_unittest.py: Added.
(TestParserTest):
(TestParserTest.test_analyzeTestReftestOneMatch):
(test_analyzeTestReftestMultipleMatches):
(test_analyzeTestReftestMatchAndMismatch):
(test_analyzeTestReftestWithRefSupportFiles):
(test_analyzeJSTest):
(test_analyzePixelTestAllTrue):
(test_analyzePixelTestAllFalse):
(test_analyzeNonHTMLFile):
2013-05-03 Christophe Dumez <ch.dumez@sisa.samsung.com>
Unreviewed. Update Viatcheslav Ostapenko's email in contributors.json.
......
#!/usr/bin/env python
# Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
import sys
from webkitpy.w3c import test_importer
sys.exit(test_importer.main(sys.argv[1:], sys.stdout, sys.stderr))
# Required for Python to search this directory for module files
#!/usr/bin/env python
# Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
import re
import os
from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup, Tag
SOURCE_SUBDIR = 'Source'
WEBCORE_SUBDIR = 'WebCore'
CSS_SUBDIR = 'css'
CSS_PROPERTY_NAMES_IN = 'CSSPropertyNames.in'
LAYOUT_TESTS_DIRECTORY = 'LayoutTests'
RESOURCES_DIRECTORY = 'resources'
WEBKIT_ROOT = __file__.split(os.path.sep + 'Tools')[0]
class TestConverter(object):
def __init__(self):
self.prefixed_properties = self.load_prefixed_prop_list()
def load_prefixed_prop_list(self):
""" Reads the current list of CSS properties requiring the -webkit- prefix from Source/WebCore/CSS/CSSPropertyNames.in and stores them in an instance variable """
prefixed_prop_list = []
# Open CSSPropertyNames.in to get the current list of things requiring prefixes
f = open(os.path.join(os.path.sep, WEBKIT_ROOT, SOURCE_SUBDIR, WEBCORE_SUBDIR,
CSS_SUBDIR, CSS_PROPERTY_NAMES_IN))
lines = f.readlines()
for line in lines:
# Look for anything with the -webkit- prefix
match = re.search('^-webkit-[\w|-]*', line)
if match is not None:
# Ignore the ones where both the prefixed and non-prefixed property
# are supported - denoted by -webkit-some-property = some-property
if len(line.split('=')) == 2 and \
line.split('=')[1].strip() in line.split('=')[0].strip():
continue
else:
prefixed_prop_list.append(match.group(0))
return prefixed_prop_list
def load_file(self, filename):
""" Opens the test file |filename| to convert """
f = open(filename)
contents = f.read()
f.close()
return contents
def convert_for_webkit(self, new_path, contents=None, filename=None):
""" Converts a file's |contents| so it will function correctly in its |new_path| in Webkit. Returns the list of prefixed CSS properties and the modified contents."""
if contents is None and filename is None:
return None
if contents is None:
contents = self.load_file(filename)
# Handle plain old CSS files
if filename.endswith('.css'):
return self.scrub_unprefixed_props(contents)
# Otherwise, parse it as if HTML
doc = BeautifulSoup(contents)
jstest = self.convert_testharness_paths(doc, new_path)
converted = self.convert_prefixed_properties(doc)
if len(converted[0]) > 0 or jstest is True:
return converted
else:
return None
def convert_testharness_paths(self, doc, new_path):
""" Update links to testharness.js in the BeautifulSoup |doc| to point to the copy in |new_path|. Returns whether the document was modified."""
# Look for the W3C-style path to any testharness files - scripts (.js) or links (.css)
pattern = re.compile('/resources/testharness')
script_tags = doc.findAll(src=pattern)
link_tags = doc.findAll(href=pattern)
testharness_tags = script_tags + link_tags
if len(testharness_tags) != 0:
# Construct the relative path from the new directory to LayoutTests/resources
resources_path = os.path.join(os.path.sep, WEBKIT_ROOT, LAYOUT_TESTS_DIRECTORY, RESOURCES_DIRECTORY)
resources_relpath = os.path.relpath(resources_path, new_path)
for tag in testharness_tags:
# Build a new tag with the correct path
attr = 'src'
if tag.name != 'script':
attr = 'href'
# Build a new tag with the correct relative path
old_path = tag[attr]
new_tag = Tag(doc, tag.name, tag.attrs)
new_tag[attr] = re.sub(pattern, resources_relpath + '/testharness', old_path)
# Update the doc with the new tag
self.replace_tag(doc, tag, new_tag)
return True
else:
return False
def convert_prefixed_properties(self, doc):
""" Searches a BeautifulSoup |doc| for any CSS properties requiring the -webkit- prefix and converts them. Returns the list of converted properties and the modified document as a string """
converted_props = []
# Look for inline and document styles
inline_styles = doc.findAll(style=re.compile('.*'))
style_tags = doc.findAll('style')
all_styles = inline_styles + style_tags
for tag in all_styles:
# Get the text whether in a style tag or style attribute
style_text = ''
if tag.name == 'style':
if len(tag.contents) == 0:
continue
else:
style_text = tag.contents[0]
else:
style_text = tag['style']
# Scrub it for props requiring prefixes
scrubbed_style = self.scrub_unprefixed_props(style_text)
# Rewrite tag only if changes were made
if len(scrubbed_style[0]) > 0:
converted_props.extend(scrubbed_style[0])
# Build a new tag with the modified text
new_tag = Tag(doc, tag.name, tag.attrs)
new_tag.insert(0, scrubbed_style[1])
# Update the doc with the new tag
self.replace_tag(doc, tag, new_tag)
return (converted_props, doc.prettify())
def scrub_unprefixed_props(self, text):
""" Searches |text| for instances of properties requiring the -webkit- prefix and adds the prefix. Returns the list of converted properties and the modified string """
converted_props = []
# Spin through the whole list of prefixed properties
for prefixed_prop in self.prefixed_properties:
# Pull the prefix off
unprefixed_prop = prefixed_prop.replace('-webkit-', '')
# Look for the various ways it might be in the CSS
# Match the the property preceded by either whitespace or left curly brace
# or at the beginning of the string (for inline style attribute)
pattern = '([\s{]|^)' + unprefixed_prop + '(\s+:|:)'
if re.search(pattern, text):
print 'converting ' + unprefixed_prop + ' -> ' + prefixed_prop
converted_props.append(prefixed_prop)
text = re.sub(pattern, prefixed_prop + ':', text)
# TODO: Handle the JS versions of these properties, too.
return (converted_props, text)
def replace_tag(self, doc, old_tag, new_tag):
""" Inserts a |new_tag| into a BeautifulSoup |doc| and removes the |old_tag| """
# Replace the previous tag with the new one
index = old_tag.parent.contents.index(old_tag)
old_tag.parent.insert(index, new_tag)
old_tag.extract()
#!/usr/bin/env python
# Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
import os
from random import randint
import re
import unittest2 as unittest
from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup
from webkitpy.w3c.test_converter import TestConverter
from webkitpy.w3c import test_converter
class TestConverterTest(unittest.TestCase):
def testLoadPrefixedPropList(self):
""" Tests that the current list of properties requiring the -webkit- prefix load correctly """
# Get the full list of prefixed properties
converter = TestConverter()
prop_list = converter.prefixed_properties
# Verify we got properties back
self.assertGreater(len(prop_list), 0, 'No prefixed properties found')
# Verify they're all prefixed
for prop in prop_list:
self.assertTrue(prop.startswith('-webkit-'))
def test_convertForWebkitNothingToConvert(self):
""" Tests convert_for_webkit() using a basic test that has nothing to convert """
test_html = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Test: DESCRIPTION OF TEST</title>
<link rel="author" title="NAME_OF_AUTHOR"
href="mailto:EMAIL OR http://CONTACT_PAGE"/>
<link rel="help" href="RELEVANT_SPEC_SECTION"/>
<meta name="assert" content="TEST ASSERTION"/>
<style type="text/css"><![CDATA[
CSS FOR TEST
]]></style>
</head>
<body>
CONTENT OF TEST
</body>
</html>
"""
converter = TestConverter()
# Try to convert the html
converted = converter.convert_for_webkit('/nothing/to/convert', contents=test_html, filename='somefile.html')
# Verify nothing was converted
self.assertEqual(converted, None, 'test was should not have been converted')
def test_convertForWebkitHarnessOnly(self):
""" Tests convert_for_webkit() using a basic JS test that uses testharness.js only and has no prefixed properties """
test_html = """<head>
<link href="/resources/testharness.css" rel="stylesheet" type="text/css">
<script src="/resources/testharness.js"></script>
</head>
"""
converter = TestConverter()
# Create path to a fake test directory
test_path = os.path.join(os.path.sep, test_converter.WEBKIT_ROOT,
test_converter.LAYOUT_TESTS_DIRECTORY,
test_converter.CSS_SUBDIR,
'harnessonly')
# Convert the html
converted = converter.convert_for_webkit(test_path, contents=test_html, filename='somefile.html')
# Verify a conversion happened
self.assertNotEqual(converted, None, 'test was not converted')
# Verify that both the harness paths were converted correctly
self.verifyTestHarnessPaths(converted[1], test_path, 1, 1)
# Verify no properties were converted
self.verifyPrefixedProperties(converted, [])
def test_convertForWebkitPropsOnly(self):
""" Tests convert_for_webkit() using a test that has 2 prefixed properties: 1 in a style block + 1 inline style """
test_html = """<html>
<head>
<link href="/resources/testharness.css" rel="stylesheet" type="text/css">
<script src="/resources/testharness.js"></script>
<style type="text/css">
#block1 { @test0@: propvalue; }
</style>
</head>
<body>
<div id="elem1" style="@test1@: propvalue;"></div>
</body>
</html>
"""
converter = TestConverter()
# Create path to a fake test directory
test_path = os.path.join(os.path.sep, test_converter.WEBKIT_ROOT,
test_converter.LAYOUT_TESTS_DIRECTORY,
test_converter.CSS_SUBDIR,
'harnessandprops')
# Generate & insert the test properties into the test_html
test_content = self.generateTestContent(converter.prefixed_properties, 2, test_html)
# Convert the html
converted = converter.convert_for_webkit(test_path, contents=test_content[1], filename='somefile.html')
# Verify a conversion happened
self.assertNotEqual(converted, None, 'test was not converted')
# Verify that both the harness paths and properties were all converted correctly
self.verifyTestHarnessPaths(converted[1], test_path, 1, 1)
self.verifyPrefixedProperties(converted, test_content[0])
def test_convertForWebkitHarnessAndProps(self):
""" Tests convert_for_webkit() using a basic JS test that uses testharness.js and testharness.css and has 4 prefixed properties: 3 in a style block + 1 inline style """
test_html = """<html>
<head>
<link href="/resources/testharness.css" rel="stylesheet" type="text/css">
<script src="/resources/testharness.js"></script>
<style type="text/css">
#block1 { @test0@: propvalue; }
#block2 { @test1@: propvalue; }
#block3 { @test2@: propvalue; }
</style>
</head>
<body>
<div id="elem1" style="@test3@: propvalue;"></div>
</body>
</html>
"""
converter = TestConverter()
# Create path to a fake test directory
test_path = os.path.join(os.path.sep, test_converter.WEBKIT_ROOT,
test_converter.LAYOUT_TESTS_DIRECTORY,
test_converter.CSS_SUBDIR,
'harnessandprops')
# Generate & insert the test properties into the test_html
test_content = self.generateTestContent(converter.prefixed_properties, 4, test_html)
# Convert the html
converted = converter.convert_for_webkit(test_path, contents=test_content[1], filename='somefile.html')
# Verify a conversion happened
self.assertNotEqual(converted, None, 'test was not converted')
# Verify that both the harness paths and properties were all converted correctly
self.verifyTestHarnessPaths(converted[1], test_path, 1, 1)
self.verifyPrefixedProperties(converted, test_content[0])
def test_convertTestHarnessPaths(self):
""" Tests convert_testharness_paths() with a test that uses all three testharness files """
# Basic test content using all three testharness files
test_html = """<head>
<link href="/resources/testharness.css" rel="stylesheet" type="text/css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
"""
converter = TestConverter()
# Create path to a fake test directory
test_path = os.path.join(os.path.sep, test_converter.WEBKIT_ROOT,
test_converter.LAYOUT_TESTS_DIRECTORY,
test_converter.CSS_SUBDIR,
'testharnesspaths')
# Convert the html
doc = BeautifulSoup(test_html)
converted = converter.convert_testharness_paths(doc, test_path)
# Verify a conversion happened
self.assertTrue(converted, 'test was not converted')
# Verify all got converted correctly
self.verifyTestHarnessPaths(doc, test_path, 2, 1)
def test_convertPrefixedProperties(self):
""" Tests convert_prefixed_properties() file that has 20 properties requiring the -webkit- prefix:
10 in one style block + 5 in another style
block + 5 inline styles, including one with multiple prefixed properties.
The properties in the test content are in all sorts of wack formatting.
"""
test_html = """<html>
<style type="text/css"><![CDATA[
.block1 {
width: 300px;
height: 300px
}
.block2 {
@test0@: propvalue;
}
.block3{@test1@: propvalue;}
.block4 { @test2@:propvalue; }
.block5{ @test3@ :propvalue; }
#block6 { @test4@ : propvalue; }
#block7
{
@test5@: propvalue;
}
#block8 { @test6@: propvalue; }
#block9:pseudo
{
@test7@: propvalue;
@test8@: propvalue propvalue propvalue;;
}
]]></style>
</head>
<body>
<div id="elem1" style="@test9@: propvalue;"></div>
<div id="elem2" style="propname: propvalue; @test10@ : propvalue; propname:propvalue;"></div>
<div id="elem2" style="@test11@: propvalue; @test12@ : propvalue; @test13@ :propvalue;"></div>
<div id="elem3" style="@test14@:propvalue"></div>
</body>
<style type="text/css"><![CDATA[
.block10{ @test15@: propvalue; }
.block11{ @test16@: propvalue; }
.block12{ @test17@: propvalue; }
#block13:pseudo
{
@test18@: propvalue;
@test19@: propvalue;
}
]]></style>
</html>
"""
converter = TestConverter()
# Generate & insert the test properties into the test_html
test_content = self.generateTestContent(converter.prefixed_properties, 20, test_html)
# Convert the html
converted = converter.convert_prefixed_properties(BeautifulSoup(test_content[1]))
# Verify a conversion happened
self.assertNotEqual(converted, None, 'test was not converted')
# Verify all the generated test properties were converted correctly
self.verifyPrefixedProperties(converted, test_content[0])
def verifyTestHarnessPaths(self, converted, test_path, num_src_paths, num_href_paths):
""" Verifies all W3C-style paths to test harness files were converted correctly """
# Make soup if we need to
if isinstance(converted, basestring):
converted = BeautifulSoup(converted)
# Build the path to LayoutTests/resources
resources_dir = os.path.join(os.path.sep, test_converter.WEBKIT_ROOT,
test_converter.LAYOUT_TESTS_DIRECTORY,
test_converter.RESOURCES_DIRECTORY)
# Verify the original paths are no longer there
orig_path_pattern = re.compile('\"/resources/testharness')
self.</