| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Apptest runner specific to the particular Dart apptest framework in | 5 """Apptest runner specific to the particular Dart apptest framework in |
| 6 /mojo/dart/apptests, built on top of the general apptest runner.""" | 6 /mojo/dart/apptests, built on top of the general apptest runner.""" |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 | 9 |
| 10 _logging = logging.getLogger() | 10 _logging = logging.getLogger() |
| 11 | 11 |
| 12 from pylib.apptest import run_apptest | 12 from devtoolslib.apptest import run_apptest |
| 13 | 13 |
| 14 | 14 |
| 15 def _dart_apptest_output_test(output): | 15 def _dart_apptest_output_test(output): |
| 16 # Fail on output with dart unittests' "FAIL:"/"ERROR:" or a lack of "PASS:". | 16 # Fail on output with dart unittests' "FAIL:"/"ERROR:" or a lack of "PASS:". |
| 17 # The latter condition ensures failure on broken command lines or output. | 17 # The latter condition ensures failure on broken command lines or output. |
| 18 # Check output instead of exit codes because mojo_shell always exits with 0. | 18 # Check output instead of exit codes because mojo_shell always exits with 0. |
| 19 if (not output or | 19 if (not output or |
| 20 '\nFAIL: ' in output or | 20 '\nFAIL: ' in output or |
| 21 '\nERROR: ' in output or | 21 '\nERROR: ' in output or |
| 22 '\nPASS: ' not in output): | 22 '\nPASS: ' not in output): |
| 23 return False | 23 return False |
| 24 return True | 24 return True |
| 25 | 25 |
| 26 | 26 |
| 27 # TODO(erg): Support android, launched services and fixture isolation. | 27 # TODO(erg): Support android, launched services and fixture isolation. |
| 28 def run_dart_apptest(shell, shell_args, apptest_url, apptest_args): | 28 def run_dart_apptest(shell, shell_args, apptest_url, apptest_args): |
| 29 """Runs a dart apptest. | 29 """Runs a dart apptest. |
| 30 | 30 |
| 31 Args: | 31 Args: |
| 32 shell_args: The arguments for mojo_shell. | 32 shell_args: The arguments for mojo_shell. |
| 33 apptest_url: Url of the apptest app to run. | 33 apptest_url: Url of the apptest app to run. |
| 34 apptest_args: Parameters to be passed to the apptest app. | 34 apptest_args: Parameters to be passed to the apptest app. |
| 35 | 35 |
| 36 Returns: | 36 Returns: |
| 37 True iff the test succeeded, False otherwise. | 37 True iff the test succeeded, False otherwise. |
| 38 """ | 38 """ |
| 39 return run_apptest(shell, shell_args, apptest_url, apptest_args, | 39 return run_apptest(shell, shell_args, apptest_url, apptest_args, |
| 40 _dart_apptest_output_test) | 40 _dart_apptest_output_test) |
| OLD | NEW |