| OLD | NEW |
| 1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 from webkitpy.layout_tests.builder_list import BuilderList | 36 from webkitpy.layout_tests.builder_list import BuilderList |
| 37 from webkitpy.layout_tests.port.factory import PortFactory | 37 from webkitpy.layout_tests.port.factory import PortFactory |
| 38 from webkitpy.layout_tests.port.test import add_unit_tests_to_mock_filesystem | 38 from webkitpy.layout_tests.port.test import add_unit_tests_to_mock_filesystem |
| 39 | 39 |
| 40 | 40 |
| 41 class MockHost(MockSystemHost): | 41 class MockHost(MockSystemHost): |
| 42 | 42 |
| 43 def __init__(self, | 43 def __init__(self, |
| 44 log_executive=False, | 44 log_executive=False, |
| 45 web=None, | 45 web=None, |
| 46 scm=None, | 46 git=None, |
| 47 os_name=None, | 47 os_name=None, |
| 48 os_version=None, | 48 os_version=None, |
| 49 time_return_val=123): | 49 time_return_val=123): |
| 50 super(MockHost, self).__init__( | 50 super(MockHost, self).__init__( |
| 51 log_executive=log_executive, | 51 log_executive=log_executive, |
| 52 os_name=os_name, | 52 os_name=os_name, |
| 53 os_version=os_version, | 53 os_version=os_version, |
| 54 time_return_val=time_return_val) | 54 time_return_val=time_return_val) |
| 55 | 55 |
| 56 add_unit_tests_to_mock_filesystem(self.filesystem) | 56 add_unit_tests_to_mock_filesystem(self.filesystem) |
| 57 self.web = web or MockWeb() | 57 self.web = web or MockWeb() |
| 58 self._scm = scm | 58 self._git = git |
| 59 | 59 |
| 60 self.buildbot = MockBuildBot() | 60 self.buildbot = MockBuildBot() |
| 61 | 61 |
| 62 # Note: We're using a real PortFactory here. Tests which don't wish to
depend | 62 # Note: We're using a real PortFactory here. Tests which don't wish to
depend |
| 63 # on the list of known ports should override this with a MockPortFactory
. | 63 # on the list of known ports should override this with a MockPortFactory
. |
| 64 self.port_factory = PortFactory(self) | 64 self.port_factory = PortFactory(self) |
| 65 | 65 |
| 66 self.builders = BuilderList(BUILDERS) | 66 self.builders = BuilderList(BUILDERS) |
| 67 | 67 |
| 68 def scm(self, path=None): | 68 def git(self, path=None): |
| 69 if path: | 69 if path: |
| 70 return MockGit(cwd=path, filesystem=self.filesystem, executive=self.
executive) | 70 return MockGit(cwd=path, filesystem=self.filesystem, executive=self.
executive) |
| 71 if not self._scm: | 71 if not self._git: |
| 72 self._scm = MockGit(filesystem=self.filesystem, executive=self.execu
tive) | 72 self._git = MockGit(filesystem=self.filesystem, executive=self.execu
tive) |
| 73 # Various pieces of code (wrongly) call filesystem.chdir(checkout_root). | 73 # Various pieces of code (wrongly) call filesystem.chdir(checkout_root). |
| 74 # Making the checkout_root exist in the mock filesystem makes that chdir
not raise. | 74 # Making the checkout_root exist in the mock filesystem makes that chdir
not raise. |
| 75 self.filesystem.maybe_make_directory(self._scm.checkout_root) | 75 self.filesystem.maybe_make_directory(self._git.checkout_root) |
| 76 return self._scm | 76 return self._git |
| OLD | NEW |