Title: [172118] trunk/Tools
Revision
172118
Author
dfar...@apple.com
Date
2014-08-05 18:39:58 -0700 (Tue, 05 Aug 2014)

Log Message

[iOS] Run ImageDiff in the sim bootstrap
https://bugs.webkit.org/show_bug.cgi?id=135624

Reviewed by David Kilzer.

* Scripts/webkitpy/port/image_diff.py:
(ImageDiffer.stop):
(IOSSimulatorImageDiffer):
(IOSSimulatorImageDiffer._start):
* Scripts/webkitpy/port/ios.py:
(IOSSimulatorPort.diff_image):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (172117 => 172118)


--- trunk/Tools/ChangeLog	2014-08-06 01:38:06 UTC (rev 172117)
+++ trunk/Tools/ChangeLog	2014-08-06 01:39:58 UTC (rev 172118)
@@ -1,5 +1,19 @@
 2014-08-05  David Farler  <dfar...@apple.com>
 
+        [iOS] Run ImageDiff in the sim bootstrap
+        https://bugs.webkit.org/show_bug.cgi?id=135624
+
+        Reviewed by David Kilzer.
+
+        * Scripts/webkitpy/port/image_diff.py:
+        (ImageDiffer.stop):
+        (IOSSimulatorImageDiffer):
+        (IOSSimulatorImageDiffer._start):
+        * Scripts/webkitpy/port/ios.py:
+        (IOSSimulatorPort.diff_image):
+
+2014-08-05  David Farler  <dfar...@apple.com>
+
         [iOS] run-webkit-tests: defaults for --runtime and --device-type flags
         https://bugs.webkit.org/show_bug.cgi?id=135441
 

Modified: trunk/Tools/Scripts/webkitpy/port/image_diff.py (172117 => 172118)


--- trunk/Tools/Scripts/webkitpy/port/image_diff.py	2014-08-06 01:38:06 UTC (rev 172117)
+++ trunk/Tools/Scripts/webkitpy/port/image_diff.py	2014-08-06 01:39:58 UTC (rev 172118)
@@ -113,3 +113,13 @@
         if self._process:
             self._process.stop()
             self._process = None
+
+
+class IOSSimulatorImageDiffer(ImageDiffer):
+    def _start(self, tolerance):
+        command = ['xcrun', '-sdk', 'iphonesimulator', 'sim', '--environment=preserve', '--adopt-pid', self._port._path_to_image_diff(), '--tolerance', str(tolerance)]
+        print ' '.join(command)
+        environment = self._port.setup_environ_for_server('ImageDiff')
+        self._process = self._port._server_process_constructor(self._port, 'ImageDiff', command, environment)
+        self._process.start()
+        self._tolerance = tolerance

Modified: trunk/Tools/Scripts/webkitpy/port/ios.py (172117 => 172118)


--- trunk/Tools/Scripts/webkitpy/port/ios.py	2014-08-06 01:38:06 UTC (rev 172117)
+++ trunk/Tools/Scripts/webkitpy/port/ios.py	2014-08-06 01:39:58 UTC (rev 172118)
@@ -31,7 +31,7 @@
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
 from webkitpy.common.system.crashlogs import CrashLogs
 from webkitpy.common.system.executive import ScriptError
-from webkitpy.port import driver
+from webkitpy.port import driver, image_diff
 from webkitpy.port.base import Port
 from webkitpy.port.leakdetector import LeakDetector
 from webkitpy.port import config as port_config
@@ -338,6 +338,18 @@
         binary_name = 'LayoutTestHelper'
         return self._build_path(binary_name)
 
+    def diff_image(self, expected_contents, actual_contents, tolerance=None):
+        if not actual_contents and not expected_contents:
+            return (None, 0, None)
+        if not actual_contents or not expected_contents:
+            return (True, 0, None)
+        if not self._image_differ:
+            self._image_differ = image_diff.IOSSimulatorImageDiffer(self)
+        self.set_option_default('tolerance', 0.1)
+        if tolerance is None:
+            tolerance = self.get_option('tolerance')
+        return self._image_differ.diff_image(expected_contents, actual_contents, tolerance)
+
     def reset_preferences(self):
         simulator_path = self.simulator_path(self.simulator_udid())
         if not simulator_path:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to