| 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 import re | 9 import re |
| 10 | 10 |
| 11 _logging = logging.getLogger() | 11 _logging = logging.getLogger() |
| 12 | 12 |
| 13 from devtoolslib.apptest import run_apptest | 13 from devtoolslib.apptest import run_apptest |
| 14 | 14 |
| 15 SUCCESS_PATTERN = re.compile('^.+ .+: All tests passed!', re.MULTILINE) | 15 SUCCESS_PATTERN = re.compile('^.+ .+: All tests passed!', re.MULTILINE) |
| 16 | 16 |
| 17 |
| 17 def _dart_apptest_output_test(output): | 18 def _dart_apptest_output_test(output): |
| 18 return SUCCESS_PATTERN.search(output) != None | 19 return SUCCESS_PATTERN.search(output) is not None |
| 19 | 20 |
| 20 | 21 |
| 21 # TODO(erg): Support android, launched services and fixture isolation. | 22 # TODO(erg): Support android, launched services and fixture isolation. |
| 22 def run_dart_apptest(shell, shell_args, apptest_url, apptest_args): | 23 def run_dart_apptest(shell, shell_args, apptest_url, apptest_args, timeout): |
| 23 """Runs a dart apptest. | 24 """Runs a dart apptest. |
| 24 | 25 |
| 25 Args: | 26 Args: |
| 26 shell_args: The arguments for mojo_shell. | 27 shell_args: The arguments for mojo_shell. |
| 27 apptest_url: Url of the apptest app to run. | 28 apptest_url: Url of the apptest app to run. |
| 28 apptest_args: Parameters to be passed to the apptest app. | 29 apptest_args: Parameters to be passed to the apptest app. |
| 29 | 30 |
| 30 Returns: | 31 Returns: |
| 31 True iff the test succeeded, False otherwise. | 32 True iff the test succeeded, False otherwise. |
| 32 """ | 33 """ |
| 33 return run_apptest(shell, shell_args, apptest_url, apptest_args, | 34 return run_apptest(shell, shell_args, apptest_url, apptest_args, timeout, |
| 34 _dart_apptest_output_test) | 35 _dart_apptest_output_test) |
| OLD | NEW |