Diff
Modified: trunk/Tools/ChangeLog (103252 => 103253)
--- trunk/Tools/ChangeLog 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/ChangeLog 2011-12-19 20:04:41 UTC (rev 103253)
@@ -1,3 +1,72 @@
+2011-12-19 Dirk Pranke <dpra...@chromium.org>
+
+ webkitpy: update unit tests in preparation for making host a mandatory parameter to Port objects
+ https://bugs.webkit.org/show_bug.cgi?id=74562
+
+ Reviewed by Eric Seidel.
+
+ Apart from a minor change to style/checkers/test_expectations.py
+ to take a host as a parameter to a TestExpectationsChecker(),
+ there are only refactoring changes to unit tests here.
+
+ * Scripts/webkitpy/layout_tests/controllers/test_result_writer_unittest.py:
+ (TestResultWriterTest.test_reftest_diff_image):
+ * Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py:
+ (JSONGeneratorTest._test_json_generation):
+ (JSONGeneratorTest.test_test_timings_trie):
+ * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+ (Base.__init__):
+ * Scripts/webkitpy/layout_tests/port/base_unittest.py:
+ (PortTest.make_port):
+ (PortTest.test_layout_tests_skipping):
+ (PortTest.test_test_dirs):
+ (PortTest.test_additional_platform_directory):
+ (PortTest.test_uses_test_expectations_file):
+ (PortTest.test_find_no_paths_specified):
+ (PortTest.test_find_one_test):
+ (PortTest.test_find_glob):
+ (PortTest.test_find_with_skipped_directories):
+ (PortTest.test_find_with_skipped_directories_2):
+ (PortTest.test_parse_reftest_list):
+ * Scripts/webkitpy/layout_tests/port/dryrun.py:
+ (DryRunPort.__init__):
+ * Scripts/webkitpy/layout_tests/port/factory_unittest.py:
+ (FactoryTest.setUp):
+ (FactoryTest.tearDown):
+ (FactoryTest.assert_port):
+ (FactoryTest.assert_platform_port):
+ (FactoryTest.test_unknown_specified):
+ (FactoryTest.test_unknown_default):
+ * Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py:
+ (GetGoogleChromePortTest._verify_expectations_overrides):
+ * Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py:
+ (MockDRTPortTest.make_port):
+ (MockDRTTest.assertTest):
+ (MockDRTTest.test_main):
+ (MockChromiumDRTTest.test_pixeltest__fails):
+ * Scripts/webkitpy/layout_tests/port/qt_unittest.py:
+ (QtPortTest._assert_search_path):
+ * Scripts/webkitpy/layout_tests/port/webkit_unittest.py:
+ (TestWebKitPort.__init__):
+ (WebKitPortTest.test_skipped_directories_for_symbols):
+ (test_skipped_directories_for_features):
+ (test_skipped_layout_tests):
+ (test_skipped_file_search_paths):
+ (test_root_option):
+ (test_test_expectations):
+ (test_build_driver):
+ (test_linux_distro_detection):
+ (test_apache_config_file_name_for_platform):
+ (test_path_to_apache_config_file):
+ (WebKitDriverTest.test_read_block):
+ * Scripts/webkitpy/style/checkers/test_expectations.py:
+ (TestExpectationsChecker.__init__):
+ * Scripts/webkitpy/style/checkers/test_expectations_unittest.py:
+ (TestExpectationsTestCase._expect_port_for_expectations_path):
+ (TestExpectationsTestCase.assert_lines_lint):
+ * Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py:
+ (get_test_config.TestMacPort):
+
2011-12-19 Raphael Kubo da Costa <k...@profusion.mobi>
[Efl] Fix path returned by builtDylibPathForName in webkitdirs.pm
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer_unittest.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer_unittest.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer_unittest.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -26,6 +26,7 @@
import unittest
+from webkitpy.common.host_mock import MockHost
from webkitpy.layout_tests.controllers import test_result_writer
from webkitpy.layout_tests.models import test_failures
from webkitpy.layout_tests.port.driver import DriverOutput
@@ -43,14 +44,14 @@
used_tolerance_values.append(tolerance)
return (True, 1)
- port = ImageDiffTestPort()
- fs = port._filesystem
+ host = MockHost()
+ port = ImageDiffTestPort(host)
test_name = 'failures/unexpected/reftest.html'
- test_reference_file = fs.join(port.layout_tests_dir(), 'failures/unexpected/reftest-expected.html')
+ test_reference_file = host.filesystem.join(port.layout_tests_dir(), 'failures/unexpected/reftest-expected.html')
driver_output1 = DriverOutput('text1', 'image1', 'imagehash1', 'audio1')
driver_output2 = DriverOutput('text2', 'image2', 'imagehash2', 'audio2')
failures = [test_failures.FailureReftestMismatch(test_reference_file)]
- test_result_writer.write_test_result(ImageDiffTestPort(), test_name,
+ test_result_writer.write_test_result(ImageDiffTestPort(host), test_name,
driver_output1, driver_output2, failures)
self.assertEqual([0], used_tolerance_values)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -32,7 +32,7 @@
import optparse
import random
-from webkitpy.common.system import filesystem_mock
+from webkitpy.common.host_mock import MockHost
from webkitpy.layout_tests.layout_package import json_results_generator
from webkitpy.layout_tests.models import test_expectations
from webkitpy.layout_tests.port import test
@@ -89,8 +89,9 @@
failed=(test in failed_tests),
elapsed_time=test_timings[test])
+ host = MockHost()
port = Mock()
- port._filesystem = filesystem_mock.MockFileSystem()
+ port._filesystem = host.filesystem
generator = json_results_generator.JSONResultsGeneratorBase(port,
self.builder_name, self.build_name, self.build_number,
'',
@@ -213,7 +214,7 @@
self._test_json_generation(['foo/A'], ['foo/B', 'bar/C'])
def test_test_timings_trie(self):
- test_port = test.TestPort()
+ test_port = test.TestPort(MockHost())
individual_test_timings = []
individual_test_timings.append(json_results_generator.TestResult('foo/bar/baz.html', elapsed_time=1.2))
individual_test_timings.append(json_results_generator.TestResult('bar.html', elapsed_time=0.0001))
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -94,7 +94,7 @@
def __init__(self, testFunc, setUp=None, tearDown=None, description=None):
host = MockHost()
self._port = host.port_factory.get('test-win-xp', None)
- self._fs = self._port._filesystem
+ self._fs = host.filesystem
self._exp = None
unittest.TestCase.__init__(self, testFunc)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -47,11 +47,12 @@
import config
import config_mock
-
class PortTest(unittest.TestCase):
- def make_port(self, host=None, **kwargs):
- host = host or MockHost()
- return Port(host, **kwargs)
+ def make_port(self, executive=None, **kwargs):
+ host = MockHost()
+ if executive:
+ host.executive = executive
+ return Port(host, executive=executive, **kwargs)
def test_default_child_processes(self):
port = self.make_port()
@@ -204,11 +205,9 @@
self.assertEqual(port.default_configuration(), 'default')
def test_layout_tests_skipping(self):
- filesystem = MockFileSystem({
- '/mock-checkout/LayoutTests/media/video-zoom.html': '',
- '/mock-checkout/LayoutTests/foo/bar.html': '',
- })
- port = self.make_port(filesystem=filesystem)
+ port = self.make_port()
+ port.filesystem.write_text_file(port.layout_tests_dir() + '/media/video-zoom.html', '')
+ port.filesystem.write_text_file(port.layout_tests_dir() + '/foo/bar.html', '')
port.skipped_layout_tests = lambda: ['foo/bar.html', 'media']
self.assertTrue(port.skips_layout_test('foo/bar.html'))
self.assertTrue(port.skips_layout_test('media/video-zoom.html'))
@@ -220,11 +219,10 @@
port.setup_test_run()
def test_test_dirs(self):
- filesystem = MockFileSystem({
- '/mock-checkout/LayoutTests/canvas/test': '',
- '/mock-checkout/LayoutTests/css2.1/test': '',
- })
- port = self.make_port(filesystem=filesystem)
+ port = self.make_port()
+ # FIXME: Consider adding a filesystem.touch()?
+ port._filesystem.write_text_file(port.layout_tests_dir() + '/canvas/test', '')
+ port._filesystem.write_text_file(port.layout_tests_dir() + '/css2.1/test', '')
dirs = port.test_dirs()
self.assertTrue('canvas' in dirs)
self.assertTrue('css2.1' in dirs)
@@ -262,8 +260,7 @@
self.assertEqual(port.name(), 'foo')
def test_additional_platform_directory(self):
- filesystem = MockFileSystem()
- port = self.make_port(port_name='foo', filesystem=filesystem)
+ port = self.make_port(port_name='foo')
port.baseline_search_path = lambda: ['LayoutTests/platform/foo']
layout_test_dir = port.layout_tests_dir()
test_file = 'fast/test.html'
@@ -276,9 +273,7 @@
# Simple additional platform directory
port._options.additional_platform_directory = ['/tmp/local-baselines']
- filesystem.files = {
- '/tmp/local-baselines/fast/test-expected.txt': 'foo',
- }
+ port._filesystem.write_text_file('/tmp/local-baselines/fast/test-expected.txt', 'foo')
self.assertEqual(
port.expected_baselines(test_file, '.txt'),
[('/tmp/local-baselines', 'fast/test-expected.txt')])
@@ -292,36 +287,35 @@
self.assertEqual(port.baseline_path(), '/foo')
def test_uses_test_expectations_file(self):
- filesystem = MockFileSystem()
- port = self.make_port(port_name='foo', filesystem=filesystem)
+ port = self.make_port(port_name='foo')
port.path_to_test_expectations_file = lambda: '/mock-results/test_expectations.txt'
self.assertFalse(port.uses_test_expectations_file())
port._filesystem = MockFileSystem({'/mock-results/test_expectations.txt': ''})
self.assertTrue(port.uses_test_expectations_file())
def test_find_no_paths_specified(self):
- port = TestPort()
+ port = TestPort(MockHost())
layout_tests_dir = port.layout_tests_dir()
tests = port.tests([])
self.assertNotEqual(len(tests), 0)
def test_find_one_test(self):
- port = TestPort()
+ port = TestPort(MockHost())
tests = port.tests(['failures/expected/image.html'])
self.assertEqual(len(tests), 1)
def test_find_glob(self):
- port = TestPort()
+ port = TestPort(MockHost())
tests = port.tests(['failures/expected/im*'])
self.assertEqual(len(tests), 2)
def test_find_with_skipped_directories(self):
- port = TestPort()
+ port = TestPort(MockHost())
tests = port.tests('userscripts')
self.assertTrue('userscripts/resources/iframe.html' not in tests)
def test_find_with_skipped_directories_2(self):
- port = TestPort()
+ port = TestPort(MockHost())
tests = port.tests(['userscripts/resources'])
self.assertEqual(tests, set([]))
@@ -341,7 +335,7 @@
self.assertFalse(Port._is_test_file(filesystem, '', 'notref-foo.xhr'))
def test_parse_reftest_list(self):
- port = TestPort()
+ port = TestPort(MockHost())
port.host.filesystem.files['bar/reftest.list'] = "\n".join(["== test.html test-ref.html",
"",
"# some comment",
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/dryrun.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/dryrun.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/dryrun.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -53,7 +53,9 @@
from webkitpy.layout_tests.port import Driver, DriverOutput, factory
-# FIXME: Why not inherit from Port?
+# Note that we don't inherit from base.Port in order for delegation to
+# work properly: except for the methods defined here, we want to ensure that
+# all of the methods are passed to the __delegate, not to the base class.
class DryRunPort(object):
"""DryRun implementation of the Port interface."""
@@ -64,7 +66,7 @@
kwargs['port_name'] = kwargs['port_name'][len(pfx):]
else:
kwargs['port_name'] = None
- self.__delegate = host.port_factory.get(**kwargs)
+ self.__delegate = factory.PortFactory(host).get(**kwargs)
def __getattr__(self, name):
return getattr(self.__delegate, name)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -30,7 +30,7 @@
import unittest
from webkitpy.tool.mocktool import MockOptions
-from webkitpy.common.host_mock import MockHost
+from webkitpy.common.system.systemhost_mock import MockSystemHost
import chromium_gpu
import chromium_linux
@@ -59,15 +59,11 @@
self.real_sys_platform = sys.platform
self.webkit_options = MockOptions(pixel_tests=False)
self.chromium_options = MockOptions(pixel_tests=False, chromium=True)
+ self.factory = factory.PortFactory(MockSystemHost())
def tearDown(self):
sys.platform = self.real_sys_platform
- def make_factory(self):
- host = MockHost()
- # The PortFactory on MockHost is a real PortFactory with a MockFileSystem, etc.
- return host.port_factory
-
def assert_port(self, port_name, expected_port, port_obj=None):
"""Helper assert for port_name.
@@ -76,7 +72,7 @@
expected_port: class of expected port object.
port_obj: optional port object
"""
- port_obj = port_obj or self.make_factory().get(port_name=port_name)
+ port_obj = port_obj or self.factory.get(port_name=port_name)
self.assertTrue(isinstance(port_obj, expected_port))
def assert_platform_port(self, platform, options, expected_port):
@@ -92,7 +88,7 @@
orig_platform = sys.platform
sys.platform = platform
# FIXME: We need a better way to mock this.
- self.assertTrue(isinstance(self.make_factory().get(options=options), expected_port))
+ self.assertTrue(isinstance(self.factory.get(options=options), expected_port))
sys.platform = orig_platform
def test_mac(self):
@@ -153,13 +149,13 @@
def test_unknown_specified(self):
# Test what happens when you specify an unknown port.
- self.assertRaises(NotImplementedError, self.make_factory().get, port_name='unknown')
+ self.assertRaises(NotImplementedError, self.factory.get, port_name='unknown')
def test_unknown_default(self):
# Test what happens when you're running on an unknown platform.
orig_platform = sys.platform
sys.platform = 'unknown'
- self.assertRaises(NotImplementedError, self.make_factory().get)
+ self.assertRaises(NotImplementedError, self.factory.get)
sys.platform = orig_platform
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/google_chrome_unittest.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -27,13 +27,9 @@
import unittest
from webkitpy.common.host_mock import MockHost
-from webkitpy.common.system.filesystem_mock import MockFileSystem
-from webkitpy.common.system.executive_mock import MockExecutive
+from webkitpy.layout_tests.port import google_chrome
-import google_chrome
-
-
class GetGoogleChromePortTest(unittest.TestCase):
def test_get_google_chrome_port(self):
test_ports = ('google-chrome-linux32', 'google-chrome-linux64', 'google-chrome-mac', 'google-chrome-win')
@@ -59,7 +55,7 @@
host = MockHost()
chromium_port = host.port_factory.get("chromium-cg-mac")
chromium_base = chromium_port.path_from_chromium_base()
- port = google_chrome.GetGoogleChromePort(port_name=port_name, options=None, host=host)
+ port = google_chrome.GetGoogleChromePort(host, port_name=port_name, options=None)
expected_chromium_overrides = '// chromium overrides\n'
expected_chrome_overrides = '// chrome overrides\n'
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -46,10 +46,11 @@
class MockDRTPortTest(port_testcase.PortTestCase):
def make_port(self, options=mock_options):
+ host = MockHost()
if sys.platform == 'win32':
# We use this because the 'win' port doesn't work yet.
- return mock_drt.MockDRTPort(MockHost(), port_name='mock-chromium-win', options=options)
- return mock_drt.MockDRTPort(MockHost(), options=options)
+ return mock_drt.MockDRTPort(host, port_name='mock-chromium-win', options=options)
+ return mock_drt.MockDRTPort(host, options=options)
def test_default_worker_model(self):
# only overridding the default test; we don't care about this one.
@@ -137,10 +138,9 @@
'#EOF\n',
'#EOF\n']
- def assertTest(self, test_name, pixel_tests, expected_checksum=None, drt_output=None, filesystem=None):
+ def assertTest(self, test_name, pixel_tests, expected_checksum=None, drt_output=None, host=None):
port_name = 'test'
- host = MockHost()
- host.filesystem = filesystem or test.unit_test_filesystem()
+ host = host or MockHost()
port = host.port_factory.get(port_name)
drt_input, drt_output = self.make_input_output(port, test_name,
pixel_tests, expected_checksum, drt_output)
@@ -163,7 +163,6 @@
def test_main(self):
host = MockHost()
- host.filesystem = test.unit_test_filesystem()
stdin = newstringio.StringIO()
stdout = newstringio.StringIO()
stderr = newstringio.StringIO()
@@ -236,7 +235,7 @@
'#EOF\n']
def test_pixeltest__fails(self):
- filesystem = test.unit_test_filesystem()
+ host = MockHost()
self.assertTest('failures/expected/checksum.html', pixel_tests=True,
expected_checksum='wrong-checksum',
drt_output=['#URL:file:///test.checkout/LayoutTests/failures/expected/checksum.html\n',
@@ -244,8 +243,8 @@
'checksum-txt',
'\n',
'#EOF\n'],
- filesystem=filesystem)
- self.assertEquals(filesystem.written_files,
+ host=host)
+ self.assertEquals(host.filesystem.written_files,
{'/tmp/png_result0.png': 'checksum\x8a-pngtEXtchecksum\x00checksum-checksum'})
def test_chromium_parse_options(self):
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -29,7 +29,6 @@
import unittest
from webkitpy.common.system.executive_mock import MockExecutive2
-from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.layout_tests.port.qt import QtPort
from webkitpy.layout_tests.port import port_testcase
@@ -45,10 +44,9 @@
# FIXME: Port constructors should not "parse" the port name, but
# rather be passed components (directly or via setters). Once
# we fix that, this method will need a re-write.
- port = QtPort(sys_platform=sys_platform,
- options=MockOptions(webkit_test_runner=use_webkit2, platform='qt'),
- host=MockHost(),
- executive=MockExecutive2(self._qt_version(qt_version)))
+ host = MockHost()
+ host.executive = MockExecutive2(self._qt_version(qt_version))
+ port = QtPort(host, sys_platform=sys_platform, options=MockOptions(webkit_test_runner=use_webkit2, platform='qt'))
absolute_search_paths = map(port._webkit_baseline_path, search_paths)
self.assertEquals(port.baseline_search_path(), absolute_search_paths)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -149,11 +149,10 @@
def test_test_expectations(self):
# Check that we read the expectations file
- files = {
- '/mock-checkout/LayoutTests/platform/testwebkitport/test_expectations.txt': 'BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL\n',
- }
- mock_fs = MockFileSystem(files)
- port = TestWebKitPort(filesystem=mock_fs)
+ host = MockHost()
+ host.filesystem.write_text_file('/mock-checkout/LayoutTests/platform/testwebkitport/test_expectations.txt',
+ 'BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL\n')
+ port = TestWebKitPort(host=host)
self.assertEqual(port.test_expectations(), 'BUG_TESTEXPECTATIONS SKIP : fast/html/article-element.html = FAIL\n')
def test_build_driver(self):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -67,15 +67,15 @@
_log.warn("Exception while getting port for path %s" % expectations_path)
return None
- def __init__(self, file_path, handle_style_error):
+ def __init__(self, file_path, handle_style_error, host=None):
self._file_path = file_path
self._handle_style_error = handle_style_error
self._handle_style_error.turn_off_line_filtering()
self._tab_checker = TabChecker(file_path, handle_style_error)
self._output_regex = re.compile('Line:(?P<line>\d+)\s*(?P<message>.+)')
- # FIXME: A host should be passed to the constructor instead!
- host = Host()
+ # FIXME: host should be a required parameter, not an optional one.
+ host = host or Host()
host._initialize_scm()
# Determining the port of this expectations.
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -65,7 +65,7 @@
def _expect_port_for_expectations_path(self, expected_port_or_port_class, expectations_path):
host = MockHost()
- checker = TestExpectationsChecker(expectations_path, ErrorCollector())
+ checker = TestExpectationsChecker(expectations_path, ErrorCollector(), host=host)
port = checker._determine_port_from_exepectations_path(host, expectations_path)
if port:
self.assertEquals(port.__class__.__name__, expected_port_or_port_class)
@@ -79,7 +79,7 @@
def assert_lines_lint(self, lines, expected):
self._error_collector.reset_errors()
checker = TestExpectationsChecker('test/test_expectations.txt',
- self._error_collector)
+ self._error_collector, host=MockHost())
checker.check_test_expectations(expectations_str='\n'.join(lines),
tests=[self._test_file],
overrides=None)
Modified: trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py (103252 => 103253)
--- trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py 2011-12-19 20:00:45 UTC (rev 103252)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py 2011-12-19 20:04:41 UTC (rev 103253)
@@ -35,9 +35,7 @@
import webkitpy.thirdparty.simplejson as json
-from webkitpy.common.checkout.scm.scm_mock import MockSCM
from webkitpy.common.net import resultsjsonparser_unittest
-from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.host_mock import MockHost
from webkitpy.layout_tests.layout_package.json_results_generator import strip_json_wrapper
from webkitpy.layout_tests.port.webkit import WebKitPort
@@ -301,23 +299,21 @@
# We could grab this from port.layout_tests_dir(), but instantiating a fully mocked port is a pain.
layout_tests_directory = "/mock-checkout/LayoutTests"
results_directory = '/WebKitBuild/Debug/layout-test-results'
- mock_filesystem = MockFileSystem()
+ host = MockHost()
for file in test_files:
- file_path = mock_filesystem.join(layout_tests_directory, file)
- mock_filesystem.files[file_path] = ''
+ file_path = host.filesystem.join(layout_tests_directory, file)
+ host.filesystem.files[file_path] = ''
for file in result_files:
- file_path = mock_filesystem.join(results_directory, file)
- mock_filesystem.files[file_path] = ''
+ file_path = host.filesystem.join(results_directory, file)
+ host.filesystem.files[file_path] = ''
class TestMacPort(WebKitPort):
port_name = "mac"
- def __init__(self):
- WebKitPort.__init__(self, filesystem=mock_filesystem, host=MockHost())
return TestConfig(
- TestMacPort(),
+ TestMacPort(host),
layout_tests_directory,
results_directory,
('mac', 'mac-leopard', 'win', 'linux'),
- mock_filesystem,
- MockSCM())
+ host.filesystem,
+ host.scm())