run_blink_test.py 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. # Copyright 2022 The Chromium Authors. All rights reserved.
  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. import os
  6. import subprocess
  7. from argparse import Namespace
  8. from typing import Optional
  9. from common import DIR_SRC_ROOT, resolve_packages
  10. from test_runner import TestRunner
  11. _BLINK_TEST_SCRIPT = os.path.join(DIR_SRC_ROOT, 'third_party', 'blink',
  12. 'tools', 'run_web_tests.py')
  13. class BlinkTestRunner(TestRunner):
  14. """Test runner for running blink web tests."""
  15. def __init__(self, out_dir: str, test_args: Namespace,
  16. target_id: Optional[str]) -> None:
  17. super().__init__(out_dir, test_args, ['content_shell'], target_id)
  18. def run_test(self):
  19. resolve_packages(self.packages, self._target_id)
  20. test_cmd = [_BLINK_TEST_SCRIPT]
  21. test_cmd.append('--platform=fuchsia')
  22. if self._test_args:
  23. test_cmd.extend(self._test_args)
  24. return subprocess.run(test_cmd, check=True)