[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
dpranke at chromium.org
dpranke at chromium.org
Sun Feb 20 23:11:50 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit e6034d22f0b5d3d3aa3bdae58350ef51d891fb95
Author: dpranke at chromium.org <dpranke at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jan 18 21:43:15 2011 +0000
2011-01-18 Dirk Pranke <dpranke at chromium.org>
Reviewed by Ojan Vafai.
Update rebaseline-chromium-webkit-tests unit tests to use a mock
filesystem. Also fix a couple of "with" statements missed by
r76050.
https://bugs.webkit.org/show_bug.cgi?id=52487
* Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76059 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 9bed6bb..2f7e9d6 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-18 Dirk Pranke <dpranke at chromium.org>
+
+ Reviewed by Ojan Vafai.
+
+ Update rebaseline-chromium-webkit-tests unit tests to use a mock
+ filesystem. Also fix a couple of "with" statements missed by
+ r76050.
+
+ https://bugs.webkit.org/show_bug.cgi?id=52487
+
+ * Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py:
+
2011-01-18 Sergio Villar Senin <svillar at igalia.com>
Reviewed by Martin Robinson.
diff --git a/Tools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py b/Tools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
index 7641f55..848079e 100644
--- a/Tools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
+++ b/Tools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
@@ -554,9 +554,10 @@ class Rebaseliner(object):
base_file = get_result_file_fullpath(self._filesystem, self._options.html_directory,
baseline_filename, self._platform,
'old')
- # We should be using an explicit encoding here.
- with open(base_file, "wb") as file:
- file.write(output)
+ if base_file.upper().endswith('.PNG'):
+ self._filesystem.write_binary_file(base_file, output)
+ else:
+ self._filesystem.write_text_file(base_file, output)
_log.info(' Html: created old baseline file: "%s".',
base_file)
@@ -567,8 +568,7 @@ class Rebaseliner(object):
diff_file = get_result_file_fullpath(self._filesystem,
self._options.html_directory, baseline_filename,
self._platform, 'diff')
- with open(diff_file, 'wb') as file:
- file.write(output)
+ self._filesystem.write_text_file(diff_file, output)
_log.info(' Html: created baseline diff file: "%s".',
diff_file)
diff --git a/Tools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py b/Tools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py
index 6c4c689..50c0204 100644
--- a/Tools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py
+++ b/Tools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py
@@ -29,10 +29,10 @@
"""Unit tests for rebaseline_chromium_webkit_tests.py."""
-import sys
import unittest
from webkitpy.tool import mocktool
+from webkitpy.common.system import filesystem_mock
from webkitpy.common.system.executive import Executive, ScriptError
import port
@@ -88,9 +88,10 @@ class TestRebaseliner(unittest.TestCase):
def make_rebaseliner(self):
options = mocktool.MockOptions(configuration=None,
html_directory=None)
- host_port_obj = port.get('test', options)
+ filesystem = filesystem_mock.MockFileSystem()
+ host_port_obj = port.get('test', options, filesystem=filesystem)
target_options = options
- target_port_obj = port.get('test', target_options)
+ target_port_obj = port.get('test', target_options, filesystem=filesystem)
platform = 'test'
return rebaseline_chromium_webkit_tests.Rebaseliner(
host_port_obj, target_port_obj, platform, options)
@@ -128,9 +129,9 @@ class TestRebaseliner(unittest.TestCase):
class TestHtmlGenerator(unittest.TestCase):
- def make_generator(self, tests):
+ def make_generator(self, files, tests):
options = mocktool.MockOptions(configuration=None, html_directory='/tmp')
- host_port = port.get('test', options)
+ host_port = port.get('test', options, filesystem=filesystem_mock.MockFileSystem(files))
generator = rebaseline_chromium_webkit_tests.HtmlGenerator(
host_port,
target_port=None,
@@ -140,17 +141,16 @@ class TestHtmlGenerator(unittest.TestCase):
return generator, host_port
def test_generate_baseline_links(self):
- orig_platform = sys.platform
- try:
- # FIXME: Use the mock filesystem instead of monkey-patching sys.platform
- sys.platform = 'darwin'
- generator, host_port = self.make_generator(["foo.txt"])
- host_port._filesystem.exists = lambda x: True
- links = generator._generate_baseline_links("foo", ".txt", "mac")
- expected_links = '<td align=center><a href="file:///tmp/foo-expected-mac-old.txt">foo-expected.txt</a></td><td align=center><a href="file:///tmp/foo-expected-mac-new.txt">foo-expected.txt</a></td><td align=center><a href="file:///tmp/foo-expected-mac-diff.txt">Diff</a></td>'
- self.assertEqual(links, expected_links)
- finally:
- sys.platform = orig_platform
+ files = {
+ "/tmp/foo-expected-mac-old.txt": "",
+ "/tmp/foo-expected-mac-new.txt": "",
+ "/tmp/foo-expected-mac-diff.txt": "",
+ }
+ tests = ["foo.txt"]
+ generator, host_port = self.make_generator(files, tests)
+ links = generator._generate_baseline_links("foo", ".txt", "mac")
+ expected_links = '<td align=center><a href="file:///tmp/foo-expected-mac-old.txt">foo-expected.txt</a></td><td align=center><a href="file:///tmp/foo-expected-mac-new.txt">foo-expected.txt</a></td><td align=center><a href="file:///tmp/foo-expected-mac-diff.txt">Diff</a></td>'
+ self.assertEqual(links, expected_links)
if __name__ == '__main__':
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list