| 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 30 matching lines...) Expand all Loading... |
| 41 MockSystemHost.__init__(self, log_executive, executive_throws_when_run) | 41 MockSystemHost.__init__(self, log_executive, executive_throws_when_run) |
| 42 add_unit_tests_to_mock_filesystem(self.filesystem) | 42 add_unit_tests_to_mock_filesystem(self.filesystem) |
| 43 self.web = web or MockWeb() | 43 self.web = web or MockWeb() |
| 44 | 44 |
| 45 self._scm = scm | 45 self._scm = scm |
| 46 # FIXME: we should never initialize the SCM by default, since the real | 46 # FIXME: we should never initialize the SCM by default, since the real |
| 47 # object doesn't either. This has caused at least one bug (see bug 89498
). | 47 # object doesn't either. This has caused at least one bug (see bug 89498
). |
| 48 if initialize_scm_by_default: | 48 if initialize_scm_by_default: |
| 49 self.initialize_scm() | 49 self.initialize_scm() |
| 50 self.buildbot = MockBuildBot() | 50 self.buildbot = MockBuildBot() |
| 51 self._chromium_buildbot = MockBuildBot() | |
| 52 | 51 |
| 53 # Note: We're using a real PortFactory here. Tests which don't wish to
depend | 52 # Note: We're using a real PortFactory here. Tests which don't wish to
depend |
| 54 # on the list of known ports should override this with a MockPortFactory
. | 53 # on the list of known ports should override this with a MockPortFactory
. |
| 55 self.port_factory = PortFactory(self) | 54 self.port_factory = PortFactory(self) |
| 56 | 55 |
| 57 def initialize_scm(self, patch_directories=None): | 56 def initialize_scm(self, patch_directories=None): |
| 58 if not self._scm: | 57 if not self._scm: |
| 59 self._scm = MockSCM(filesystem=self.filesystem, executive=self.execu
tive) | 58 self._scm = MockSCM(filesystem=self.filesystem, executive=self.execu
tive) |
| 60 # Various pieces of code (wrongly) call filesystem.chdir(checkout_root). | 59 # Various pieces of code (wrongly) call filesystem.chdir(checkout_root). |
| 61 # Making the checkout_root exist in the mock filesystem makes that chdir
not raise. | 60 # Making the checkout_root exist in the mock filesystem makes that chdir
not raise. |
| 62 self.filesystem.maybe_make_directory(self._scm.checkout_root) | 61 self.filesystem.maybe_make_directory(self._scm.checkout_root) |
| 63 | 62 |
| 64 def scm(self): | 63 def scm(self): |
| 65 return self._scm | 64 return self._scm |
| 66 | 65 |
| 67 def scm_for_path(self, path): | 66 def scm_for_path(self, path): |
| 68 # FIXME: consider supporting more than one SCM so that we can do more co
mprehensive testing. | 67 # FIXME: consider supporting more than one SCM so that we can do more co
mprehensive testing. |
| 69 self.initialize_scm() | 68 self.initialize_scm() |
| 70 return self._scm | 69 return self._scm |
| 71 | 70 |
| 72 def checkout(self): | 71 def checkout(self): |
| 73 return self._checkout | 72 return self._checkout |
| 74 | |
| 75 def chromium_buildbot(self): | |
| 76 return self._chromium_buildbot | |
| OLD | NEW |