Add a presubmit check for AUTHORS.

Make sure CL authors are in AUTHORS. The presubmit check is the same as
Chromium's, but with a different list of known robot accounts.

Change-Id: I0d126e3fbb0cdf98f857d1e74f6889a04514304f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/70091
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index cf9a196..f87de6d 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -34,6 +34,11 @@
     'cppguide.html#Names_and_Order_of_Includes')
 
 
+# Bypass the AUTHORS check for these accounts.
+_KNOWN_ROBOTS = set() | set(
+    '%s@skia-public.iam.gserviceaccount.com' % s for s in ('pdfium-autoroll',))
+
+
 def _CheckUnwantedDependencies(input_api, output_api):
   """Runs checkdeps on #include statements added in this
   change. Breaking - rules is an error, breaking ! rules is a
@@ -323,6 +328,11 @@
   results.extend(_CheckTestDuplicates(input_api, output_api))
   results.extend(_CheckPNGFormat(input_api, output_api))
 
+  author = input_api.change.author_email
+  if author and author not in _KNOWN_ROBOTS:
+    results.extend(
+        input_api.canned_checks.CheckAuthorizedAuthor(input_api, output_api))
+
   for f in input_api.AffectedFiles():
     path, name = input_api.os_path.split(f.LocalPath())
     if name == 'PRESUBMIT.py':