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 6import os 7import subprocess 8 9from argparse import Namespace 10from typing import Optional 11 12from common import DIR_SRC_ROOT 13from 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 19class 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) 32