Check parameter types in FilterSourceFile() mock

Parameters |white_list| and |black_list| in FilterSourceFile()
should be iterables, and it's fairly easy to wrongly pass a string
instead.

This checking caught _CheckCrbugLinksHaveHttps in unit tests.

Bug: 869103
Change-Id: I1cd6d62c3fa2b1500d9d7b6b35794f40e35378af
Reviewed-on: https://chromium-review.googlesource.com/1155379
Commit-Queue: Wei-Yin Chen (陳威尹) <[email protected]>
Reviewed-by: Dirk Pranke <[email protected]>
Cr-Commit-Position: refs/heads/master@{#579288}
diff --git a/PRESUBMIT_test_mocks.py b/PRESUBMIT_test_mocks.py
index 3b491d9..ed6a750 100644
--- a/PRESUBMIT_test_mocks.py
+++ b/PRESUBMIT_test_mocks.py
@@ -94,12 +94,16 @@
     local_path = file.LocalPath()
     found_in_white_list = not white_list
     if white_list:
+      if type(white_list) is str:
+        raise TypeError('white_list should be an iterable of strings')
       for pattern in white_list:
         compiled_pattern = re.compile(pattern)
         if compiled_pattern.search(local_path):
           found_in_white_list = True
           break
     if black_list:
+      if type(black_list) is str:
+        raise TypeError('black_list should be an iterable of strings')
       for pattern in black_list:
         compiled_pattern = re.compile(pattern)
         if compiled_pattern.search(local_path):