2010-08-11 Tony Chang <tony@chromium.org>
authortony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Aug 2010 16:33:19 +0000 (16:33 +0000)
committertony@chromium.org <tony@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Aug 2010 16:33:19 +0000 (16:33 +0000)
        Reviewed by David Levin.

        [chromium] add google-chrome layout test result directories
        https://bugs.webkit.org/show_bug.cgi?id=43889

        * Scripts/webkitpy/layout_tests/port/chromium_win.py:
        * Scripts/webkitpy/layout_tests/port/factory.py:
        * Scripts/webkitpy/layout_tests/port/google_chrome.py: Added.
        * Scripts/webkitpy/layout_tests/test_types/image_diff.py:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@65250 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
WebKitTools/Scripts/webkitpy/layout_tests/port/factory.py
WebKitTools/Scripts/webkitpy/layout_tests/port/google_chrome.py [new file with mode: 0644]
WebKitTools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py [new file with mode: 0644]
WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py

index 9e27903..7bd8a75 100644 (file)
@@ -1,3 +1,15 @@
+2010-08-11  Tony Chang  <tony@chromium.org>
+
+        Reviewed by David Levin.
+
+        [chromium] add google-chrome layout test result directories
+        https://bugs.webkit.org/show_bug.cgi?id=43889
+
+        * Scripts/webkitpy/layout_tests/port/chromium_win.py:
+        * Scripts/webkitpy/layout_tests/port/factory.py:
+        * Scripts/webkitpy/layout_tests/port/google_chrome.py: Added.
+        * Scripts/webkitpy/layout_tests/test_types/image_diff.py:
+
 2010-08-11  Kent Tamura  <tkent@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index 8072bc0..e9a81e7 100644 (file)
@@ -69,9 +69,9 @@ class ChromiumWinPort(chromium.ChromiumPort):
 
     def baseline_search_path(self):
         port_names = []
-        if self._name == 'chromium-win-xp':
+        if self._name.endswith('-win-xp'):
             port_names.append("chromium-win-xp")
-        if self._name in ('chromium-win-xp', 'chromium-win-vista'):
+        if self._name.endswith('-win-xp') or self._name.endswith('-win-vista'):
             port_names.append("chromium-win-vista")
         # FIXME: This may need to include mac-snowleopard like win.py.
         port_names.extend(["chromium-win", "chromium", "win", "mac"])
index 95b90da..258bf33 100644 (file)
@@ -83,5 +83,8 @@ def get(port_name=None, options=None):
     elif port_to_use.startswith('chromium-win'):
         import chromium_win
         return chromium_win.ChromiumWinPort(port_name, options)
+    elif port_to_use.startswith('google-chrome'):
+        import google_chrome
+        return google_chrome.GetGoogleChromePort(port_name, options)
 
     raise NotImplementedError('unsupported port: %s' % port_to_use)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/google_chrome.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/google_chrome.py
new file mode 100644 (file)
index 0000000..1ea053b
--- /dev/null
@@ -0,0 +1,74 @@
+#!/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:
+#
+#     * 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.
+
+# 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.
+
+
+def GetGoogleChromePort(port_name, options):
+    """Some tests have slightly different results when compiled as Google
+    Chrome vs Chromium.  In those cases, we prepend an additional directory to
+    to the baseline paths."""
+    if port_name == 'google-chrome-linux32':
+        import chromium_linux
+
+        class GoogleChromeLinux32Port(chromium_linux.ChromiumLinuxPort):
+            def baseline_search_path(self):
+                paths = chromium_linux.ChromiumLinuxPort.baseline_search_path(
+                    self)
+                paths.insert(0, self._webkit_baseline_path(self._name))
+                return paths
+        return GoogleChromeLinux32Port(port_name, options)
+    elif port_name == 'google-chrome-linux64':
+        import chromium_linux
+
+        class GoogleChromeLinux64Port(chromium_linux.ChromiumLinuxPort):
+            def baseline_search_path(self):
+                paths = chromium_linux.ChromiumLinuxPort.baseline_search_path(
+                    self)
+                paths.insert(0, self._webkit_baseline_path(self._name))
+                return paths
+        return GoogleChromeLinux64Port(port_name, options)
+    elif port_name.startswith('google-chrome-mac'):
+        import chromium_mac
+
+        class GoogleChromeMacPort(chromium_mac.ChromiumMacPort):
+            def baseline_search_path(self):
+                paths = chromium_mac.ChromiumMacPort.baseline_search_path(
+                    self)
+                paths.insert(0, self._webkit_baseline_path(
+                    'google-chrome-mac'))
+                return paths
+        return GoogleChromeMacPort(port_name, options)
+    elif port_name.startswith('google-chrome-win'):
+        import chromium_win
+
+        class GoogleChromeWinPort(chromium_win.ChromiumWinPort):
+            def baseline_search_path(self):
+                paths = chromium_win.ChromiumWinPort.baseline_search_path(
+                    self)
+                paths.insert(0, self._webkit_baseline_path(
+                    'google-chrome-win'))
+                return paths
+        return GoogleChromeWinPort(port_name, options)
+    raise NotImplementedError('unsupported port: %s' % port_name)
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py
new file mode 100644 (file)
index 0000000..a2d7056
--- /dev/null
@@ -0,0 +1,46 @@
+#!/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:
+#
+#     * 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.
+
+# 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.
+
+import os
+import unittest
+import google_chrome
+
+
+class GetGoogleChromePortTest(unittest.TestCase):
+    def test_get_google_chrome_port(self):
+        test_ports = ('google-chrome-linux32', 'google-chrome-linux64',
+            'google-chrome-mac', 'google-chrome-win')
+        for port in test_ports:
+            self._verify_baseline_path(port, port)
+
+        self._verify_baseline_path('google-chrome-mac', 'google-chrome-mac-leopard')
+        self._verify_baseline_path('google-chrome-win', 'google-chrome-win-xp')
+        self._verify_baseline_path('google-chrome-win', 'google-chrome-win-vista')
+
+    def _verify_baseline_path(self, expected_path, port_name):
+        port = google_chrome.GetGoogleChromePort(port_name, None)
+        path = port.baseline_search_path()[0]
+        self.assertEqual(expected_path, os.path.split(path)[1])
index 65f8f3a..2a54686 100644 (file)
@@ -136,7 +136,7 @@ class ImageDiff(test_type_base.TestTypeBase):
         # If we're generating a new baseline, we pass.
         if test_args.new_baseline or test_args.reset_results:
             self._save_baseline_files(filename, test_args.png_path,
-                                    test_args.hash, test_args.new_baseline)
+                                      test_args.hash, test_args.new_baseline)
             return failures
 
         # Compare hashes.