+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.
# 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
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
"""
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 = []
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."""
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:
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.