Internal change

PiperOrigin-RevId: 348469825
Change-Id: I6e6e981149428f870950d33ac63eaba25be7d4e7
diff --git a/tools/automate-git.py b/tools/automate-git.py
index 3e8f962..284e950 100644
--- a/tools/automate-git.py
+++ b/tools/automate-git.py
@@ -318,6 +318,19 @@
     fp.write(content)
 
 
+def apply_google_patch(name):
+  # Root location of Google-specific patches.
+  google_patch_path = os.path.abspath(
+      os.path.join(os.path.dirname(__file__), '..', 'patch'))
+  patch_file = os.path.join(google_patch_path, 'patches', name)
+  if os.path.exists(patch_file + ".patch"):
+    # Attempt to apply the patch file.
+    patch_tool = os.path.join(cef_dir, 'tools', 'patcher.py')
+    run('%s %s --patch-file "%s" --patch-dir "%s"' %
+        (python_exe, patch_tool, patch_file,
+         chromium_src_dir), chromium_src_dir, depot_tools_dir)
+
+
 def add_google_patches():
   """ Hooks the build to also apply Google private patches to CEF. """
   # Root location of Google-specific patches.
@@ -1483,6 +1496,7 @@
 
   # Patch the Chromium runhooks scripts if necessary.
   apply_runhooks_patch()
+  apply_google_patch('mac_toolchain_creds')
 
   # Runs hooks for files that have been modified in the local working copy.
   run("gclient runhooks --jobs 16", chromium_dir, depot_tools_dir)