OSDN Git Service

Merge WebKit at r73109: Initial merge by git.
[android-x86/external-webkit.git] / WebKitTools / Scripts / webkitpy / layout_tests / port / test.py
index 3b81167..8e27f35 100644 (file)
@@ -36,6 +36,8 @@ import os
 import sys
 import time
 
+from webkitpy.layout_tests.layout_package import test_output
+
 import base
 
 
@@ -137,7 +139,7 @@ class TestPort(base.Port):
         return True
 
     def diff_image(self, expected_contents, actual_contents,
-                   diff_filename=None, tolerance=0):
+                   diff_filename=None):
         diffed = actual_contents != expected_contents
         if diffed and diff_filename:
             with codecs.open(diff_filename, "w", "utf-8") as diff_fh:
@@ -215,20 +217,17 @@ class TestPort(base.Port):
     def name(self):
         return self._name
 
-    def options(self):
-        return self._options
-
     def _path_to_wdiff(self):
         return None
 
     def results_directory(self):
-        return '/tmp/' + self._options.results_directory
+        return '/tmp/' + self.get_option('results_directory')
 
     def setup_test_run(self):
         pass
 
-    def create_driver(self, image_path, options):
-        return TestDriver(self, image_path, options, executive=None)
+    def create_driver(self, worker_number):
+        return TestDriver(self, worker_number)
 
     def start_http_server(self):
         pass
@@ -282,32 +281,29 @@ WONTFIX SKIP : failures/expected/exception.html = CRASH
 class TestDriver(base.Driver):
     """Test/Dummy implementation of the DumpRenderTree interface."""
 
-    def __init__(self, port, image_path, options, executive):
+    def __init__(self, port, worker_number):
         self._port = port
-        self._image_path = image_path
-        self._options = options
-        self._executive = executive
-        self._image_written = False
+
+    def cmd_line(self):
+        return ['None']
 
     def poll(self):
         return True
 
-    def run_test(self, uri, timeoutms, image_hash):
-        test_name = self._port.uri_to_test_name(uri)
+    def run_test(self, test_input):
+        start_time = time.time()
+        test_name = self._port.relative_test_filename(test_input.filename)
         test = self._port._tests[test_name]
         if test.keyboard:
             raise KeyboardInterrupt
         if test.exception:
             raise ValueError('exception from ' + test_name)
         if test.hang:
-            time.sleep((float(timeoutms) * 4) / 1000.0)
-
-        if self._port.options().pixel_tests and test.actual_image:
-            with open(self._image_path, 'w') as file:
-                file.write(test.actual_image)
-
-        return (test.crash, test.timeout, test.actual_checksum,
-                test.actual_text, test.error)
+            time.sleep((float(test_input.timeout) * 4) / 1000.0)
+        return test_output.TestOutput(test.actual_text, test.actual_image,
+                                      test.actual_checksum, test.crash,
+                                      time.time() - start_time, test.timeout,
+                                      test.error)
 
     def start(self):
         pass