Title: [89793] trunk/Tools
Revision
89793
Author
[email protected]
Date
2011-06-27 00:20:11 -0700 (Mon, 27 Jun 2011)

Log Message

2011-06-27  Adam Barth  <[email protected]>

        Reviewed by Eric Seidel.

        Move update_webgl_conformance_tests.py to webkitpy.to_be_moved
        https://bugs.webkit.org/show_bug.cgi?id=63429

        This package as nothing to do with the layout_tests package.

        * Scripts/update-webgl-conformance-tests:
        * Scripts/webkitpy/layout_tests/update_webgl_conformance_tests.py: Removed.
        * Scripts/webkitpy/layout_tests/update_webgl_conformance_tests_unittest.py: Removed.
        * Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests.py: Copied from Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests.py.
        * Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests_unittest.py: Copied from Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests_unittest.py.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Tools/ChangeLog (89792 => 89793)


--- trunk/Tools/ChangeLog	2011-06-27 07:11:42 UTC (rev 89792)
+++ trunk/Tools/ChangeLog	2011-06-27 07:20:11 UTC (rev 89793)
@@ -2,6 +2,21 @@
 
         Reviewed by Eric Seidel.
 
+        Move update_webgl_conformance_tests.py to webkitpy.to_be_moved
+        https://bugs.webkit.org/show_bug.cgi?id=63429
+
+        This package as nothing to do with the layout_tests package.
+
+        * Scripts/update-webgl-conformance-tests:
+        * Scripts/webkitpy/layout_tests/update_webgl_conformance_tests.py: Removed.
+        * Scripts/webkitpy/layout_tests/update_webgl_conformance_tests_unittest.py: Removed.
+        * Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests.py: Copied from Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests.py.
+        * Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests_unittest.py: Copied from Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests_unittest.py.
+
+2011-06-27  Adam Barth  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
         Move deduplicate_tests.py into webkitpy.to_be_moved
         https://bugs.webkit.org/show_bug.cgi?id=63426
 

Modified: trunk/Tools/Scripts/update-webgl-conformance-tests (89792 => 89793)


--- trunk/Tools/Scripts/update-webgl-conformance-tests	2011-06-27 07:11:42 UTC (rev 89792)
+++ trunk/Tools/Scripts/update-webgl-conformance-tests	2011-06-27 07:20:11 UTC (rev 89793)
@@ -29,8 +29,8 @@
 
 """Wrapper around webkitpy/layout_tests/update-webgl-conformance-tests.py"""
 
-import webkitpy.layout_tests.update_webgl_conformance_tests
+import webkitpy.to_be_moved.update_webgl_conformance_tests
 import sys
 
 if __name__ == '__main__':
-    sys.exit(webkitpy.layout_tests.update_webgl_conformance_tests.main())
+    sys.exit(webkitpy.to_be_moved.update_webgl_conformance_tests.main())

Deleted: trunk/Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests.py (89792 => 89793)


--- trunk/Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests.py	2011-06-27 07:11:42 UTC (rev 89792)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests.py	2011-06-27 07:20:11 UTC (rev 89793)
@@ -1,162 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2010 Google Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. OR
-# CONTRIBUTORS 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.
-
-from __future__ import with_statement
-
-import glob
-import logging
-import optparse
-import os
-import re
-import sys
-from webkitpy.common.checkout import scm
-
-_log = logging.getLogger("webkitpy.layout_tests."
-                         "update-webgl-conformance-tests")
-
-
-def remove_first_line_comment(text):
-    return re.compile(r'^<!--.*?-->\s*', re.DOTALL).sub('', text)
-
-
-def translate_includes(text):
-    # Mapping of single filename to relative path under WebKit root.
-    # Assumption: these filenames are globally unique.
-    include_mapping = {
-        "js-test-style.css": "../../js/resources",
-        "js-test-pre.js": "../../js/resources",
-        "js-test-post.js": "../../js/resources",
-        "desktop-gl-constants.js": "resources",
-    }
-
-    for filename, path in include_mapping.items():
-        search = r'(?:[^"\'= ]*/)?' + re.escape(filename)
-        # We use '/' instead of os.path.join in order to produce consistent
-        # output cross-platform.
-        replace = path + '/' + filename
-        text = re.sub(search, replace, text)
-
-    return text
-
-
-def translate_khronos_test(text):
-    """
-    This method translates the contents of a Khronos test to a WebKit test.
-    """
-
-    translateFuncs = [
-        remove_first_line_comment,
-        translate_includes,
-    ]
-
-    for f in translateFuncs:
-        text = f(text)
-
-    return text
-
-
-def update_file(in_filename, out_dir):
-    # check in_filename exists
-    # check out_dir exists
-    out_filename = os.path.join(out_dir, os.path.basename(in_filename))
-
-    _log.debug("Processing " + in_filename)
-    with open(in_filename, 'r') as in_file:
-        with open(out_filename, 'w') as out_file:
-            out_file.write(translate_khronos_test(in_file.read()))
-
-
-def update_directory(in_dir, out_dir):
-    for filename in glob.glob(os.path.join(in_dir, '*.html')):
-        update_file(os.path.join(in_dir, filename), out_dir)
-
-
-def default_out_dir():
-    current_scm = scm.detect_scm_system(os.path.dirname(sys.argv[0]))
-    if not current_scm:
-        return os.getcwd()
-    root_dir = current_scm.checkout_root
-    if not root_dir:
-        return os.getcwd()
-    out_dir = os.path.join(root_dir, "LayoutTests/fast/canvas/webgl")
-    if os.path.isdir(out_dir):
-        return out_dir
-    return os.getcwd()
-
-
-def configure_logging(options):
-    """Configures the logging system."""
-    log_fmt = '%(levelname)s: %(message)s'
-    log_datefmt = '%y%m%d %H:%M:%S'
-    log_level = logging.INFO
-    if options.verbose:
-        log_fmt = ('%(asctime)s %(filename)s:%(lineno)-4d %(levelname)s '
-                   '%(message)s')
-        log_level = logging.DEBUG
-    logging.basicConfig(level=log_level, format=log_fmt,
-                        datefmt=log_datefmt)
-
-
-def option_parser():
-    usage = "usage: %prog [options] (input file or directory)"
-    parser = optparse.OptionParser(usage=usage)
-    parser.add_option('-v', '--verbose',
-                             action='',
-                             default=False,
-                             help='include debug-level logging')
-    parser.add_option('-o', '--output',
-                             action='',
-                             type='string',
-                             default=default_out_dir(),
-                             metavar='DIR',
-                             help='specify an output directory to place files '
-                                  'in [default: %default]')
-    return parser
-
-
-def main():
-    parser = option_parser()
-    (options, args) = parser.parse_args()
-    configure_logging(options)
-
-    if len(args) == 0:
-        _log.error("Must specify an input directory or filename.")
-        parser.print_help()
-        return 1
-
-    in_name = args[0]
-    if os.path.isfile(in_name):
-        update_file(in_name, options.output)
-    elif os.path.isdir(in_name):
-        update_directory(in_name, options.output)
-    else:
-        _log.error("'%s' is not a directory or a file.", in_name)
-        return 2
-
-    return 0
-
-
-if __name__ == "__main__":
-    sys.exit(main())

Deleted: trunk/Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests_unittest.py (89792 => 89793)


--- trunk/Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests_unittest.py	2011-06-27 07:11:42 UTC (rev 89792)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests_unittest.py	2011-06-27 07:20:11 UTC (rev 89793)
@@ -1,102 +0,0 @@
-#!/usr/bin/python
-# Copyright (C) 2010 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-#     * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#     * 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.
-#     * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "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
-# OWNER OR CONTRIBUTORS 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.
-
-"""Unit tests for update_webgl_conformance_tests."""
-
-import unittest
-from webkitpy.layout_tests import update_webgl_conformance_tests as webgl
-
-
-def construct_script(name):
-    return "<script src="" + name + "\"></script>\n"
-
-
-def construct_style(name):
-    return "<link rel=\"stylesheet\" href="" + name + "\">"
-
-
-class TestTranslation(unittest.TestCase):
-    def assert_unchanged(self, text):
-        self.assertEqual(text, webgl.translate_khronos_test(text))
-
-    def assert_translate(self, input, output):
-        self.assertEqual(output, webgl.translate_khronos_test(input))
-
-    def test_simple_unchanged(self):
-        self.assert_unchanged("")
-        self.assert_unchanged("<html></html>")
-
-    def test_header_strip(self):
-        single_line_header = "<!-- single line header. -->"
-        multi_line_header = """<!-- this is a multi-line
-                header.  it should all be removed too.
-                -->"""
-        text = "<html></html>"
-        self.assert_translate(single_line_header, "")
-        self.assert_translate(single_line_header + text, text)
-        self.assert_translate(multi_line_header + text, text)
-
-    def dont_strip_other_headers(self):
-        self.assert_unchanged("<html>\n<!-- don't remove comments on other lines. -->\n</html>")
-
-    def test_include_rewriting(self):
-        # Mappings to None are unchanged
-        styles = {
-            "../resources/js-test-style.css": "../../js/resources/js-test-style.css",
-            "fail.css": None,
-            "resources/stylesheet.css": None,
-            "../resources/style.css": None,
-        }
-        scripts = {
-            "../resources/js-test-pre.js": "../../js/resources/js-test-pre.js",
-            "../resources/js-test-post.js": "../../js/resources/js-test-post.js",
-            "../resources/desktop-gl-constants.js": "resources/desktop-gl-constants.js",
-
-            "resources/shadow-offset.js": None,
-            "../resources/js-test-post-async.js": None,
-        }
-
-        input_text = ""
-        output_text = ""
-        for input, output in styles.items():
-            input_text += construct_style(input)
-            output_text += construct_style(output if output else input)
-        for input, output in scripts.items():
-            input_text += construct_script(input)
-            output_text += construct_script(output if output else input)
-
-        head = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">\n<html>\n<head>\n'
-        foot = '</head>\n<body>\n</body>\n</html>'
-        input_text = head + input_text + foot
-        output_text = head + output_text + foot
-        self.assert_translate(input_text, output_text)
-
-
-if __name__ == '__main__':
-    unittest.main()

Copied: trunk/Tools/Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests.py (from rev 89785, trunk/Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests.py) (0 => 89793)


--- trunk/Tools/Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests.py	                        (rev 0)
+++ trunk/Tools/Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests.py	2011-06-27 07:20:11 UTC (rev 89793)
@@ -0,0 +1,162 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2010 Google Inc. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. OR
+# CONTRIBUTORS 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.
+
+from __future__ import with_statement
+
+import glob
+import logging
+import optparse
+import os
+import re
+import sys
+from webkitpy.common.checkout import scm
+
+_log = logging.getLogger("webkitpy.layout_tests."
+                         "update-webgl-conformance-tests")
+
+
+def remove_first_line_comment(text):
+    return re.compile(r'^<!--.*?-->\s*', re.DOTALL).sub('', text)
+
+
+def translate_includes(text):
+    # Mapping of single filename to relative path under WebKit root.
+    # Assumption: these filenames are globally unique.
+    include_mapping = {
+        "js-test-style.css": "../../js/resources",
+        "js-test-pre.js": "../../js/resources",
+        "js-test-post.js": "../../js/resources",
+        "desktop-gl-constants.js": "resources",
+    }
+
+    for filename, path in include_mapping.items():
+        search = r'(?:[^"\'= ]*/)?' + re.escape(filename)
+        # We use '/' instead of os.path.join in order to produce consistent
+        # output cross-platform.
+        replace = path + '/' + filename
+        text = re.sub(search, replace, text)
+
+    return text
+
+
+def translate_khronos_test(text):
+    """
+    This method translates the contents of a Khronos test to a WebKit test.
+    """
+
+    translateFuncs = [
+        remove_first_line_comment,
+        translate_includes,
+    ]
+
+    for f in translateFuncs:
+        text = f(text)
+
+    return text
+
+
+def update_file(in_filename, out_dir):
+    # check in_filename exists
+    # check out_dir exists
+    out_filename = os.path.join(out_dir, os.path.basename(in_filename))
+
+    _log.debug("Processing " + in_filename)
+    with open(in_filename, 'r') as in_file:
+        with open(out_filename, 'w') as out_file:
+            out_file.write(translate_khronos_test(in_file.read()))
+
+
+def update_directory(in_dir, out_dir):
+    for filename in glob.glob(os.path.join(in_dir, '*.html')):
+        update_file(os.path.join(in_dir, filename), out_dir)
+
+
+def default_out_dir():
+    current_scm = scm.detect_scm_system(os.path.dirname(sys.argv[0]))
+    if not current_scm:
+        return os.getcwd()
+    root_dir = current_scm.checkout_root
+    if not root_dir:
+        return os.getcwd()
+    out_dir = os.path.join(root_dir, "LayoutTests/fast/canvas/webgl")
+    if os.path.isdir(out_dir):
+        return out_dir
+    return os.getcwd()
+
+
+def configure_logging(options):
+    """Configures the logging system."""
+    log_fmt = '%(levelname)s: %(message)s'
+    log_datefmt = '%y%m%d %H:%M:%S'
+    log_level = logging.INFO
+    if options.verbose:
+        log_fmt = ('%(asctime)s %(filename)s:%(lineno)-4d %(levelname)s '
+                   '%(message)s')
+        log_level = logging.DEBUG
+    logging.basicConfig(level=log_level, format=log_fmt,
+                        datefmt=log_datefmt)
+
+
+def option_parser():
+    usage = "usage: %prog [options] (input file or directory)"
+    parser = optparse.OptionParser(usage=usage)
+    parser.add_option('-v', '--verbose',
+                             action='',
+                             default=False,
+                             help='include debug-level logging')
+    parser.add_option('-o', '--output',
+                             action='',
+                             type='string',
+                             default=default_out_dir(),
+                             metavar='DIR',
+                             help='specify an output directory to place files '
+                                  'in [default: %default]')
+    return parser
+
+
+def main():
+    parser = option_parser()
+    (options, args) = parser.parse_args()
+    configure_logging(options)
+
+    if len(args) == 0:
+        _log.error("Must specify an input directory or filename.")
+        parser.print_help()
+        return 1
+
+    in_name = args[0]
+    if os.path.isfile(in_name):
+        update_file(in_name, options.output)
+    elif os.path.isdir(in_name):
+        update_directory(in_name, options.output)
+    else:
+        _log.error("'%s' is not a directory or a file.", in_name)
+        return 2
+
+    return 0
+
+
+if __name__ == "__main__":
+    sys.exit(main())

Copied: trunk/Tools/Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests_unittest.py (from rev 89785, trunk/Tools/Scripts/webkitpy/layout_tests/update_webgl_conformance_tests_unittest.py) (0 => 89793)


--- trunk/Tools/Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests_unittest.py	                        (rev 0)
+++ trunk/Tools/Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests_unittest.py	2011-06-27 07:20:11 UTC (rev 89793)
@@ -0,0 +1,102 @@
+#!/usr/bin/python
+# Copyright (C) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * 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.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "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
+# OWNER OR CONTRIBUTORS 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.
+
+"""Unit tests for update_webgl_conformance_tests."""
+
+import unittest
+from webkitpy.to_be_moved import update_webgl_conformance_tests as webgl
+
+
+def construct_script(name):
+    return "<script src="" + name + "\"></script>\n"
+
+
+def construct_style(name):
+    return "<link rel=\"stylesheet\" href="" + name + "\">"
+
+
+class TestTranslation(unittest.TestCase):
+    def assert_unchanged(self, text):
+        self.assertEqual(text, webgl.translate_khronos_test(text))
+
+    def assert_translate(self, input, output):
+        self.assertEqual(output, webgl.translate_khronos_test(input))
+
+    def test_simple_unchanged(self):
+        self.assert_unchanged("")
+        self.assert_unchanged("<html></html>")
+
+    def test_header_strip(self):
+        single_line_header = "<!-- single line header. -->"
+        multi_line_header = """<!-- this is a multi-line
+                header.  it should all be removed too.
+                -->"""
+        text = "<html></html>"
+        self.assert_translate(single_line_header, "")
+        self.assert_translate(single_line_header + text, text)
+        self.assert_translate(multi_line_header + text, text)
+
+    def dont_strip_other_headers(self):
+        self.assert_unchanged("<html>\n<!-- don't remove comments on other lines. -->\n</html>")
+
+    def test_include_rewriting(self):
+        # Mappings to None are unchanged
+        styles = {
+            "../resources/js-test-style.css": "../../js/resources/js-test-style.css",
+            "fail.css": None,
+            "resources/stylesheet.css": None,
+            "../resources/style.css": None,
+        }
+        scripts = {
+            "../resources/js-test-pre.js": "../../js/resources/js-test-pre.js",
+            "../resources/js-test-post.js": "../../js/resources/js-test-post.js",
+            "../resources/desktop-gl-constants.js": "resources/desktop-gl-constants.js",
+
+            "resources/shadow-offset.js": None,
+            "../resources/js-test-post-async.js": None,
+        }
+
+        input_text = ""
+        output_text = ""
+        for input, output in styles.items():
+            input_text += construct_style(input)
+            output_text += construct_style(output if output else input)
+        for input, output in scripts.items():
+            input_text += construct_script(input)
+            output_text += construct_script(output if output else input)
+
+        head = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">\n<html>\n<head>\n'
+        foot = '</head>\n<body>\n</body>\n</html>'
+        input_text = head + input_text + foot
+        output_text = head + output_text + foot
+        self.assert_translate(input_text, output_text)
+
+
+if __name__ == '__main__':
+    unittest.main()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to