2011-04-11 Dirk Pranke <dpranke@chromium.org>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2011 19:28:11 +0000 (19:28 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2011 19:28:11 +0000 (19:28 +0000)
        Reviewed by Ojan Vafai.

        new-run-webkit-tests: add unit tests for Port.diff_image()
        https://bugs.webkit.org/show_bug.cgi?id=58196

        Add the unit tests for the fix in bug 58195.

        * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
        * Scripts/webkitpy/layout_tests/port/port_testcase.py:
        * Scripts/webkitpy/layout_tests/port/webkit_unittest.py:

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

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py

index e7392ff..9e8c4f5 100644 (file)
@@ -1,5 +1,18 @@
 2011-04-11  Dirk Pranke  <dpranke@chromium.org>
 
+        Reviewed by Ojan Vafai.
+
+        new-run-webkit-tests: add unit tests for Port.diff_image()
+        https://bugs.webkit.org/show_bug.cgi?id=58196
+
+        Add the unit tests for the fix in bug 58195.
+
+        * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
+        * Scripts/webkitpy/layout_tests/port/port_testcase.py:
+        * Scripts/webkitpy/layout_tests/port/webkit_unittest.py:
+
+2011-04-11  Dirk Pranke  <dpranke@chromium.org>
+
         Reviewed by Tony Chang.
 
         new-run-webkit-tests: implement support for audio, take two
index e798034..0260dff 100644 (file)
@@ -41,8 +41,10 @@ import chromium_linux
 import chromium_mac
 import chromium_win
 
-class ChromiumDriverTest(unittest.TestCase):
+from webkitpy.layout_tests.port import port_testcase
+
 
+class ChromiumDriverTest(unittest.TestCase):
     def setUp(self):
         mock_port = Mock()
         mock_port.get_option = lambda option_name: ''
@@ -112,7 +114,19 @@ class ChromiumDriverTest(unittest.TestCase):
         self.assertTrue(self.wait_called)
         self.assertEquals(self.pid, 1)
 
-class ChromiumPortTest(unittest.TestCase):
+
+class ChromiumPortTest(port_testcase.PortTestCase):
+    def port_maker(self, platform):
+        return chromium.ChromiumPort
+
+    def test_driver_cmd_line(self):
+        # Override this test since ChromiumPort doesn't implement driver_cmd_line().
+        pass
+
+    def test_baseline_search_path(self):
+        # Override this test since ChromiumPort doesn't implement baseline_search_path().
+        pass
+
     class TestMacPort(chromium_mac.ChromiumMacPort):
         def __init__(self, options):
             chromium_mac.ChromiumMacPort.__init__(self,
index 649e33c..b5f94ed 100644 (file)
@@ -113,6 +113,30 @@ class PortTestCase(unittest.TestCase):
 
         port._filesystem.remove(tmpfile)
 
+    def test_diff_image__missing_both(self):
+        port = self.make_port()
+        if not port:
+            return
+        self.assertFalse(port.diff_image(None, None, None))
+        self.assertFalse(port.diff_image(None, '', None))
+        self.assertFalse(port.diff_image('', None, None))
+        self.assertFalse(port.diff_image('', '', None))
+
+    def test_diff_image__missing_actual(self):
+        port = self.make_port()
+        if not port:
+            return
+        self.assertTrue(port.diff_image(None, 'foo', None))
+        self.assertTrue(port.diff_image('', 'foo', None))
+
+    def test_diff_image__missing_expected(self):
+        port = self.make_port()
+        if not port:
+            return
+        self.assertTrue(port.diff_image('foo', None, None))
+        self.assertTrue(port.diff_image('foo', '', None))
+
+
     def disabled_test_websocket_server(self):
         port = self.make_port()
         if not port:
index c72a411..ef1a1c2 100644 (file)
@@ -30,6 +30,7 @@ import unittest
 from webkitpy.common.system import filesystem_mock
 
 from webkitpy.layout_tests.port.webkit import WebKitPort
+from webkitpy.layout_tests.port import port_testcase
 
 
 class TestWebKitPort(WebKitPort):
@@ -63,7 +64,18 @@ class TestWebKitPort(WebKitPort):
             return [self.skips_file]
         return []
 
-class WebKitPortTest(unittest.TestCase):
+
+class WebKitPortTest(port_testcase.PortTestCase):
+    def port_maker(self, platform):
+        return WebKitPort
+
+    def test_driver_cmd_line(self):
+        # Routine is not implemented.
+        pass
+
+    def test_baseline_search_path(self):
+        # Routine is not implemented.
+        pass
 
     def test_skipped_directories_for_symbols(self):
         supported_symbols = ["GraphicsLayer", "WebCoreHas3DRendering", "isXHTMLMPDocument", "fooSymbol"]