Switch to new repository
diff --git a/scripts/run_tests.py b/scripts/run_tests.py
index da9fcd8..6fe2c64 100755
--- a/scripts/run_tests.py
+++ b/scripts/run_tests.py
@@ -1,9 +1,13 @@
 #!/usr/bin/env python
 #
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+"""
+Run Karma unit tests on a pre-built chrome or one specified via --chrome-binary.
+"""
+
 import os
 import re
 import subprocess
@@ -11,21 +15,14 @@
 
 import devtools_paths
 
-is_cygwin = sys.platform == 'cygwin'
-chrome_binary = None
 
-if len(sys.argv) >= 2:
-    chrome_binary = re.sub(r'^\-\-chrome-binary=(.*)', '\\1', sys.argv[1])
-    is_executable = os.path.exists(chrome_binary) and os.path.isfile(chrome_binary) and os.access(chrome_binary, os.X_OK)
-    if not is_executable:
-        print('Unable to find a Chrome binary at \'%s\'' % chrome_binary)
-        sys.exit(1)
+def check_chrome_binary(chrome_binary):
+    return os.path.exists(chrome_binary) and os.path.isfile(chrome_binary) and os.access(chrome_binary, os.X_OK)
 
 
 def popen(arguments, cwd=None, env=None):
     return subprocess.Popen(arguments, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env)
 
-
 def to_platform_path_exact(filepath):
     if not is_cygwin:
         return filepath
@@ -34,16 +31,6 @@
     return output.strip().replace('\\', '\\\\')
 
 
-scripts_path = os.path.dirname(os.path.abspath(__file__))
-devtools_path = os.path.dirname(scripts_path)
-
-print('Running tests with Karma...')
-if (chrome_binary is not None):
-    print('Using custom Chrome Binary (%s)\n' % chrome_binary)
-else:
-    print('Using system Chrome')
-
-
 def run_tests():
     karma_errors_found = False
 
@@ -66,6 +53,29 @@
     return karma_errors_found
 
 
+is_cygwin = sys.platform == "cygwin"
+chrome_binary = None
+DOWNLOADED_CHROME_BINARY = os.path.abspath(
+    os.path.join(os.path.dirname(__file__), '..', 'third_party', 'chrome', 'chrome-linux', 'chrome'))
+
+if check_chrome_binary(DOWNLOADED_CHROME_BINARY):
+    chrome_binary = DOWNLOADED_CHROME_BINARY
+
+if len(sys.argv) >= 2:
+    chrome_binary = re.sub(r"^\-\-chrome-binary=(.*)", "\\1", sys.argv[1])
+    if not check_chrome_binary(chrome_binary):
+        print("Unable to find a Chrome binary at \"%s\"" % chrome_binary)
+        sys.exit(1)
+
+scripts_path = os.path.dirname(os.path.abspath(__file__))
+devtools_path = os.path.dirname(scripts_path)
+
+print("Running tests with Karma...")
+if (chrome_binary is not None):
+    print("Using custom Chrome Binary (%s)\n" % chrome_binary)
+else:
+    print("Using system Chrome")
+
 errors_found = run_tests()
 
 if errors_found: