Chromium Code Reviews| Index: third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock.py |
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock.py |
| index 44c7d8043d507f9dad2c683232b2e28ea01e5dd7..70d80af18ab339f6a8cdad1134b5da4fd63bfd88 100644 |
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock.py |
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock.py |
| @@ -39,7 +39,7 @@ class MockFileSystem(object): |
| sep = '/' |
| pardir = '..' |
| - def __init__(self, files=None, dirs=None, cwd='/'): |
| + def __init__(self, files=None, dirs=None, cwd='/', permissions=None): |
| """Initializes a "mock" filesystem that can be used to completely |
| stub out a filesystem. |
| @@ -49,6 +49,7 @@ class MockFileSystem(object): |
| not exist. |
| """ |
| self.files = files or {} |
| + self.permissions = permissions or {} |
| self.written_files = {} |
| self.last_tmpdir = None |
| self.current_tmpno = 0 |
| @@ -56,11 +57,13 @@ class MockFileSystem(object): |
| self.dirs = set(dirs or []) |
| self.dirs.add(cwd) |
| for f in self.files: |
| + while f not in self.permissions: |
|
qyearsley
2016/06/15 18:35:38
while -> if
|
| + self.permissions[f] = False |
| + for f in self.files: |
| d = self.dirname(f) |
| while not d in self.dirs: |
| self.dirs.add(d) |
| d = self.dirname(d) |
| - |
| def clear_written_files(self): |
| # This function can be used to track what is written between steps in a test. |
| self.written_files = {} |
| @@ -75,6 +78,13 @@ class MockFileSystem(object): |
| return path.rsplit(self.sep, 1) |
| return ('', path) |
| + def chmod(self, file_path, mode): |
|
qyearsley
2016/06/15 18:35:38
If we're changing the public API of the FileSystem
|
| + self.make_executable(file_path) |
| + mode = mode |
| + |
| + def make_executable(self, file_path): |
| + self.permissions[file_path] = True |
| + |
| def abspath(self, path): |
| if os.path.isabs(path): |
| return self.normpath(path) |