run_blink_test.py (993B)
1 # Copyright 2022 The Chromium Authors 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 """Implements commands for running blink web tests.""" 5 6 import os 7 import subprocess 8 9 from argparse import Namespace 10 from typing import Optional 11 12 from common import DIR_SRC_ROOT 13 from test_runner import TestRunner 14 15 _BLINK_TEST_SCRIPT = os.path.join(DIR_SRC_ROOT, 'third_party', 'blink', 16 'tools', 'run_web_tests.py') 17 18 19 class BlinkTestRunner(TestRunner): 20 """Test runner for running blink web tests.""" 21 22 def __init__(self, out_dir: str, test_args: Namespace, 23 target_id: Optional[str]) -> None: 24 super().__init__(out_dir, test_args, ['content_shell'], target_id) 25 26 def run_test(self): 27 test_cmd = [_BLINK_TEST_SCRIPT, '-t', os.path.basename(self._out_dir)] 28 29 if self._test_args: 30 test_cmd.extend(self._test_args) 31 return subprocess.run(test_cmd, check=True)