| 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 12 matching lines...) Expand all Loading... |
| 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 from StringIO import StringIO | 29 from StringIO import StringIO |
| 30 | 30 |
| 31 from webkitpy.common.system.executive_mock import MockExecutive | 31 from webkitpy.common.system.executive_mock import MockExecutive |
| 32 from webkitpy.common.system.filesystem_mock import MockFileSystem | 32 from webkitpy.common.system.filesystem_mock import MockFileSystem |
| 33 from webkitpy.common.system.platforminfo_mock import MockPlatformInfo | 33 from webkitpy.common.system.platform_info_mock import MockPlatformInfo |
| 34 from webkitpy.common.system.user_mock import MockUser | 34 from webkitpy.common.system.user_mock import MockUser |
| 35 from webkitpy.common.system.workspace_mock import MockWorkspace | 35 from webkitpy.common.system.workspace_mock import MockWorkspace |
| 36 | 36 |
| 37 | 37 |
| 38 class MockSystemHost(object): | 38 class MockSystemHost(object): |
| 39 | 39 |
| 40 def __init__(self, log_executive=False, executive_throws_when_run=None, os_n
ame=None, | 40 def __init__(self, log_executive=False, executive_throws_when_run=None, os_n
ame=None, |
| 41 os_version=None, executive=None, filesystem=None, time_return_v
al=123): | 41 os_version=None, executive=None, filesystem=None, time_return_v
al=123): |
| 42 self.executable = 'python' | 42 self.executable = 'python' |
| 43 self.executive = executive or MockExecutive(should_log=log_executive, sh
ould_throw_when_run=executive_throws_when_run) | 43 self.executive = executive or MockExecutive(should_log=log_executive, sh
ould_throw_when_run=executive_throws_when_run) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 62 self.time_return_val = time_return_val | 62 self.time_return_val = time_return_val |
| 63 | 63 |
| 64 def time(self): | 64 def time(self): |
| 65 return self.time_return_val | 65 return self.time_return_val |
| 66 | 66 |
| 67 def print_(self, *args, **kwargs): | 67 def print_(self, *args, **kwargs): |
| 68 sep = kwargs.get('sep', ' ') | 68 sep = kwargs.get('sep', ' ') |
| 69 end = kwargs.get('end', '\n') | 69 end = kwargs.get('end', '\n') |
| 70 stream = kwargs.get('stream', self.stdout) | 70 stream = kwargs.get('stream', self.stdout) |
| 71 stream.write(sep.join([str(arg) for arg in args]) + end) | 71 stream.write(sep.join([str(arg) for arg in args]) + end) |
| OLD | NEW |