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..00eb93503463ec29a9f50ca2eb4bf1ccf13857e8 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: |
+ self.permissions[f] = False |
+ for f in self.files: |
qyearsley
2016/06/15 21:54:25
Depending on how is_executable is implemented, thi
|
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,11 @@ class MockFileSystem(object): |
return path.rsplit(self.sep, 1) |
return ('', path) |
+ def chmod(self, file_path, mode): |
qyearsley
2016/06/15 21:54:25
In the MockFileSystem class, we still want to have
|
+ # To be used to fix http://crbug.com/574461 |
qyearsley
2016/06/15 21:54:25
This kind of thing might be more useful to put in
|
+ self.permissions[file_path] = True |
+ mode = mode |
qyearsley
2016/06/15 21:54:25
Note, this statement does nothing.
|
+ |
def abspath(self, path): |
if os.path.isabs(path): |
return self.normpath(path) |