Enabling and fixing CheckNewlineAtTheEndOfProtoFiles
This check has been skipped during the migration from src/webrtc to
src. It was also reporting false positives. Now it should be fixed.
NOTRY=True
Bug: chromium:611808
Change-Id: Id8567dd92099e75ac35351f053829deebf28a9d1
Reviewed-on: https://webrtc-review.googlesource.com/1580
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@google.com>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19887}
diff --git a/presubmit_test_mocks.py b/presubmit_test_mocks.py
index 2f86449..f7ead25 100644
--- a/presubmit_test_mocks.py
+++ b/presubmit_test_mocks.py
@@ -6,6 +6,9 @@
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
+# This file is inspired to [1].
+# [1] - https://cs.chromium.org/chromium/src/PRESUBMIT_test_mocks.py
+
class MockInputApi(object):
"""Mock class for the InputApi class.
@@ -16,6 +19,11 @@
def __init__(self):
self.change = MockChange([])
+ self.files = []
+
+ def AffectedSourceFiles(self, file_filter=None):
+ # pylint: disable=unused-argument
+ return self.files
class MockOutputApi(object):
@@ -39,6 +47,7 @@
MockOutputApi.PresubmitResult.__init__(self, message, items, long_text)
self.type = 'error'
+
class MockChange(object):
"""Mock class for Change class.
@@ -48,3 +57,17 @@
def __init__(self, changed_files):
self._changed_files = changed_files
+
+
+class MockFile(object):
+ """Mock class for the File class.
+
+ This class can be used to form the mock list of changed files in
+ MockInputApi for presubmit unittests.
+ """
+
+ def __init__(self, local_path):
+ self._local_path = local_path
+
+ def LocalPath(self):
+ return self._local_path