summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py')
-rw-r--r--chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
index 82738bfdc82..0a6497acaeb 100644
--- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
+++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
@@ -37,12 +37,12 @@ from webkitpy.layout_tests.port.test import add_unit_tests_to_mock_filesystem
class MockHost(MockSystemHost):
- def __init__(self, log_executive=False, executive_throws_when_run=None, initialize_scm_by_default=True, web=None):
+ def __init__(self, log_executive=False, executive_throws_when_run=None, initialize_scm_by_default=True, web=None, scm=None):
MockSystemHost.__init__(self, log_executive, executive_throws_when_run)
add_unit_tests_to_mock_filesystem(self.filesystem)
self.web = web or MockWeb()
- self._scm = None
+ self._scm = scm
# FIXME: we should never initialize the SCM by default, since the real
# object doesn't either. This has caused at least one bug (see bug 89498).
if initialize_scm_by_default:
@@ -55,7 +55,8 @@ class MockHost(MockSystemHost):
self.port_factory = PortFactory(self)
def initialize_scm(self, patch_directories=None):
- self._scm = MockSCM(filesystem=self.filesystem, executive=self.executive)
+ if not self._scm:
+ self._scm = MockSCM(filesystem=self.filesystem, executive=self.executive)
# Various pieces of code (wrongly) call filesystem.chdir(checkout_root).
# Making the checkout_root exist in the mock filesystem makes that chdir not raise.
self.filesystem.maybe_make_directory(self._scm.checkout_root)
@@ -63,6 +64,11 @@ class MockHost(MockSystemHost):
def scm(self):
return self._scm
+ def scm_for_path(self, path):
+ # FIXME: consider supporting more than one SCM so that we can do more comprehensive testing.
+ self.initialize_scm()
+ return self._scm
+
def checkout(self):
return self._checkout