Presubmit: Add check to support b/xxx entry in bug reference.

NOTRY=True

Bug: webrtc:8197
Change-Id: I98c22bd5cb5ea22e7280d76c62c085816cb19100
Reviewed-on: https://webrtc-review.googlesource.com/3280
Commit-Queue: Charu Jain <charujain@google.com>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19972}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 70c4759..df891a6 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -480,7 +480,7 @@
     bug = bug.strip()
     if bug.lower() == 'none':
       continue
-    if ':' not in bug:
+    if 'b/' not in bug and ':' not in bug:
       try:
         if int(bug) > 100000:
           # Rough indicator for current chromium bugs.
@@ -491,7 +491,7 @@
                        (prefix_guess, bug))
       except ValueError:
         results.append(bogus_bug_msg % bug)
-    elif not re.match(r'\w+:\d+', bug):
+    elif not (re.match(r'\w+:\d+', bug) or re.match(r'b/\d+', bug)):
       results.append(bogus_bug_msg % bug)
   return [output_api.PresubmitError(r) for r in results]
 
diff --git a/presubmit_test.py b/presubmit_test.py
index c9ee80b..5c653d6 100755
--- a/presubmit_test.py
+++ b/presubmit_test.py
@@ -47,6 +47,18 @@
                                                   mock_output_api)
     self.assertEqual(0, len(errors))
 
+  def testCommitMessageBugEntrySupportInternalBugReference(self):
+    mock_input_api = MockInputApi()
+    mock_output_api = MockOutputApi()
+    mock_input_api.change.BUG = 'b/12345'
+    errors = PRESUBMIT.CheckCommitMessageBugEntry(mock_input_api,
+                                                  mock_output_api)
+    self.assertEqual(0, len(errors))
+    mock_input_api.change.BUG = 'b/12345, webrtc:1234'
+    errors = PRESUBMIT.CheckCommitMessageBugEntry(mock_input_api,
+                                                  mock_output_api)
+    self.assertEqual(0, len(errors))
+
 
 class CheckNewlineAtTheEndOfProtoFilesTest(unittest.TestCase):