Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/system/filesystem_mock.py

Issue 2066963002: Add file permissions to filesystem_mock (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected make_executable and is_executable locations Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698