summaryrefslogtreecommitdiffstats
path: root/PRESUBMIT_test_mocks.py
diff options
context:
space:
mode:
authorglider <glider@chromium.org>2015-02-18 09:39:43 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-18 17:40:14 +0000
commite61efad3b33f83c9bc990cadaae63ba347173ac4 (patch)
tree86313885f98ffa05f69715b3e671a8386a04bc94 /PRESUBMIT_test_mocks.py
parent91534e853deaad9f44aa30f842e23566da0a7cb6 (diff)
downloadchromium_src-e61efad3b33f83c9bc990cadaae63ba347173ac4.zip
chromium_src-e61efad3b33f83c9bc990cadaae63ba347173ac4.tar.gz
chromium_src-e61efad3b33f83c9bc990cadaae63ba347173ac4.tar.bz2
Reland https://codereview.chromium.org/929043002/: Add a presubmit check that warns about declaring Singleton<T> in header files
Add a presubmit check that warns about declaring Singleton<T> in header files (except for base/memory/singleton.h) This check is copied from presubmit_canned_checks.py in depot_tools/ with an added exception for base/memory/singleton.h. The corresponding code will be removed from presubmit_canned_checks.py afterwards. BUG=349861 Review URL: https://codereview.chromium.org/933253002 Cr-Commit-Position: refs/heads/master@{#316852}
Diffstat (limited to 'PRESUBMIT_test_mocks.py')
-rw-r--r--PRESUBMIT_test_mocks.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/PRESUBMIT_test_mocks.py b/PRESUBMIT_test_mocks.py
index 7d286b9..5caa156 100644
--- a/PRESUBMIT_test_mocks.py
+++ b/PRESUBMIT_test_mocks.py
@@ -29,10 +29,15 @@ class MockInputApi(object):
def AffectedFiles(self, file_filter=None):
return self.files
+ def AffectedSourceFiles(self, file_filter=None):
+ return self.files
+
def PresubmitLocalPath(self):
return os.path.dirname(__file__)
def ReadFile(self, filename, mode='rU'):
+ if hasattr(filename, 'AbsoluteLocalPath'):
+ filename = filename.AbsoluteLocalPath()
for file_ in self.files:
if file_.LocalPath() == filename:
return '\n'.join(file_.NewContents())
@@ -96,6 +101,11 @@ class MockFile(object):
return self._local_path
+class MockAffectedFile(MockFile):
+ def AbsoluteLocalPath(self):
+ return self._local_path
+
+
class MockChange(object):
"""Mock class for Change class.