2011-02-09 Hayato Ito <hayato@chromium.org>
authorhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Feb 2011 05:31:16 +0000 (05:31 +0000)
committerhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Feb 2011 05:31:16 +0000 (05:31 +0000)
        Reviewed by Tony Chang.

        [NRWT] Remove encoding parameters where we can assume data can be
        written in binary mode.

        https://bugs.webkit.org/show_bug.cgi?id=54066

        * Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py:
        * Scripts/webkitpy/layout_tests/port/base.py:

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

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py
Tools/Scripts/webkitpy/layout_tests/port/base.py

index 2561615cec7f96fc42518da84569ebbf8704a55f..6697325f4e38c0aa269dceeb015943604db6c4cb 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-09  Hayato Ito  <hayato@chromium.org>
+
+        Reviewed by Tony Chang.
+
+        [NRWT] Remove encoding parameters where we can assume data can be
+        written in binary mode.
+
+        https://bugs.webkit.org/show_bug.cgi?id=54066
+
+        * Scripts/webkitpy/layout_tests/layout_package/single_test_runner.py:
+        * Scripts/webkitpy/layout_tests/port/base.py:
+
 2011-02-09  Dirk Pranke  <dpranke@chromium.org>
 
         Reviewed by Tony Chang.
index 178743f8ef5b1f0d5a57b99bdabe6cceb9e334b1..96e3ee6e80433eb0c5177a247fa92b2a3ea850d4 100644 (file)
@@ -203,17 +203,15 @@ class SingleTestRunner:
         # Although all test_shell/DumpRenderTree output should be utf-8,
         # we do not ever decode it inside run-webkit-tests.  For some tests
         # DumpRenderTree may not output utf-8 text (e.g. webarchives).
-        self._save_baseline_data(driver_output.text, ".txt", encoding=None,
+        self._save_baseline_data(driver_output.text, ".txt",
                                  generate_new_baseline=self._options.new_baseline)
         if self._options.pixel_tests and driver_output.image_hash:
-            self._save_baseline_data(driver_output.image, ".png", encoding=None,
+            self._save_baseline_data(driver_output.image, ".png",
                                      generate_new_baseline=self._options.new_baseline)
             self._save_baseline_data(driver_output.image_hash, ".checksum",
-                                     encoding="ascii",
                                      generate_new_baseline=self._options.new_baseline)
 
-    def _save_baseline_data(self, data, modifier, encoding,
-                            generate_new_baseline=True):
+    def _save_baseline_data(self, data, modifier, generate_new_baseline=True):
         """Saves a new baseline file into the port's baseline directory.
 
         The file will be named simply "<test>-expected<modifier>", suitable for
@@ -222,7 +220,6 @@ class SingleTestRunner:
         Args:
           data: result to be saved as the new baseline
           modifier: type of the result file, e.g. ".txt" or ".png"
-          encoding: file encoding (none, "utf-8", etc.)
           generate_new_baseline: whether to enerate a new, platform-specific
             baseline, or update the existing one
         """
@@ -242,7 +239,7 @@ class SingleTestRunner:
             output_path = port.expected_filename(self._filename, modifier)
             _log.debug('resetting baseline result "%s"' % output_path)
 
-        port.update_baseline(output_path, data, encoding)
+        port.update_baseline(output_path, data)
 
     def _handle_error(self, driver_output):
         failures = []
index e3d5f8e9a458f19d19306681137109c8dce74ffe..8f3c8401ee7b58a7667b2f6ab1322eb7e396a1c6 100644 (file)
@@ -318,7 +318,7 @@ class Port(object):
         path = self.expected_filename(test, '.checksum')
         if not self.path_exists(path):
             return None
-        return self._filesystem.read_text_file(path)
+        return self._filesystem.read_binary_file(path)
 
     def expected_image(self, test):
         """Returns the image we expect the test to produce."""
@@ -396,7 +396,7 @@ class Port(object):
         driver = self.create_driver(0)
         return driver.cmd_line()
 
-    def update_baseline(self, path, data, encoding):
+    def update_baseline(self, path, data):
         """Updates the baseline for a test.
 
         Args:
@@ -404,14 +404,8 @@ class Port(object):
               the test. This function is used to update either generic or
               platform-specific baselines, but we can't infer which here.
             data: contents of the baseline.
-            encoding: file encoding to use for the baseline.
         """
-        # FIXME: remove the encoding parameter in favor of text/binary
-        # functions.
-        if encoding is None:
-            self._filesystem.write_binary_file(path, data)
-        else:
-            self._filesystem.write_text_file(path, data)
+        self._filesystem.write_binary_file(path, data)
 
     def uri_to_test_name(self, uri):
         """Return the base layout test name for a given URI.