| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 import argparse | 5 import argparse |
| 6 import json | 6 import json |
| 7 import os | 7 import os |
| 8 import re | 8 import re |
| 9 import socket | 9 import socket |
| 10 import shlex | 10 import shlex |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 'be considered valid') | 35 'be considered valid') |
| 36 parser.add_argument('--android', help='If given, attempts to run the test on ' | 36 parser.add_argument('--android', help='If given, attempts to run the test on ' |
| 37 'Android via adb. Ignores usage of --chrome_exec', action='store_true') | 37 'Android via adb. Ignores usage of --chrome_exec', action='store_true') |
| 38 parser.add_argument('--android_package', nargs=1, | 38 parser.add_argument('--android_package', nargs=1, |
| 39 default='com.android.chrome', help='Set the android package for Chrome') | 39 default='com.android.chrome', help='Set the android package for Chrome') |
| 40 parser.add_argument('--chrome_exec', nargs=1, type=str, help='The path to ' | 40 parser.add_argument('--chrome_exec', nargs=1, type=str, help='The path to ' |
| 41 'the Chrome or Chromium executable') | 41 'the Chrome or Chromium executable') |
| 42 parser.add_argument('chrome_driver', nargs=1, type=str, help='The path to ' | 42 parser.add_argument('chrome_driver', nargs=1, type=str, help='The path to ' |
| 43 'the ChromeDriver executable. If not given, the default system chrome ' | 43 'the ChromeDriver executable. If not given, the default system chrome ' |
| 44 'will be used.') | 44 'will be used.') |
| 45 parser.add_argument('-b', '--buffer', help='The standard output and standard ' |
| 46 'error streams are buffered during the test run. Output during a passing ' |
| 47 'test is discarded. Output is echoed normally on test fail or error and is ' |
| 48 'added to the failure messages.', action='store_true') |
| 49 parser.add_argument('-c', '--catch', help='Control-C during the test run ' |
| 50 'waits for the current test to end and then reports all the results so ' |
| 51 'far. A second Control-C raises the normal KeyboardInterrupt exception.', |
| 52 action='store_true') |
| 53 parser.add_argument('-f', '--failfast', help='Stop the test run on the first ' |
| 54 'error or failure.', action='store_true') |
| 45 # TODO(robertogden): Log sys.argv here. | 55 # TODO(robertogden): Log sys.argv here. |
| 46 return parser.parse_args(sys.argv[1:]) | 56 return parser.parse_args(sys.argv[1:]) |
| 47 | 57 |
| 48 def HandleException(test_name=None): | 58 def HandleException(test_name=None): |
| 49 """Writes the exception being handled and a stack trace to stderr. | 59 """Writes the exception being handled and a stack trace to stderr. |
| 50 | 60 |
| 51 Args: | 61 Args: |
| 52 test_name: The string name of the test that led to this exception. | 62 test_name: The string name of the test that led to this exception. |
| 53 """ | 63 """ |
| 54 sys.stderr.write("**************************************\n") | 64 sys.stderr.write("**************************************\n") |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 @property | 388 @property |
| 379 def request_type(self): | 389 def request_type(self): |
| 380 return self._request_type | 390 return self._request_type |
| 381 | 391 |
| 382 def ResponseHasViaHeader(self): | 392 def ResponseHasViaHeader(self): |
| 383 return 'via' in self._response_headers and (self._response_headers['via'] == | 393 return 'via' in self._response_headers and (self._response_headers['via'] == |
| 384 self._flags.via_header_value) | 394 self._flags.via_header_value) |
| 385 | 395 |
| 386 def WasXHR(self): | 396 def WasXHR(self): |
| 387 return self.request_type == 'XHR' | 397 return self.request_type == 'XHR' |
| OLD | NEW |