| 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 logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import socket | 10 import socket |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 def GetDictKey(argument): | 159 def GetDictKey(argument): |
| 160 return argument.split('=', 1)[0] | 160 return argument.split('=', 1)[0] |
| 161 if self._flags.browser_args and len(self._flags.browser_args) > 0: | 161 if self._flags.browser_args and len(self._flags.browser_args) > 0: |
| 162 # Build a dict of flags mapped to the whole argument. | 162 # Build a dict of flags mapped to the whole argument. |
| 163 original_args = {} | 163 original_args = {} |
| 164 for arg in self._chrome_args: | 164 for arg in self._chrome_args: |
| 165 original_args[GetDictKey(arg)] = arg | 165 original_args[GetDictKey(arg)] = arg |
| 166 # Override flags given in code with any command line arguments. | 166 # Override flags given in code with any command line arguments. |
| 167 for override_arg in shlex.split(self._flags.browser_args): | 167 for override_arg in shlex.split(self._flags.browser_args): |
| 168 arg_key = GetDictKey(override_arg) | 168 arg_key = GetDictKey(override_arg) |
| 169 if arg_key in original_args: | 169 if (arg_key in original_args |
| 170 and original_args[arg_key] in self._chrome_args): |
| 170 self._chrome_args.remove(original_args[arg_key]) | 171 self._chrome_args.remove(original_args[arg_key]) |
| 171 self._logger.info('Removed Chrome flag. %s', original_args[arg_key]) | 172 self._logger.info('Removed Chrome flag. %s', original_args[arg_key]) |
| 172 self._chrome_args.add(override_arg) | 173 self._chrome_args.add(override_arg) |
| 173 self._logger.info('Added Chrome flag. %s', override_arg) | 174 self._logger.info('Added Chrome flag. %s', override_arg) |
| 174 # Always add the flag that allows histograms to be queried in javascript. | 175 # Always add the flag that allows histograms to be queried in javascript. |
| 175 self._chrome_args.add('--enable-stats-collection-bindings') | 176 self._chrome_args.add('--enable-stats-collection-bindings') |
| 176 | 177 |
| 177 def _StartDriver(self): | 178 def _StartDriver(self): |
| 178 """Parses the flags to pass to Chromium, then starts the ChromeDriver. | 179 """Parses the flags to pass to Chromium, then starts the ChromeDriver. |
| 179 | 180 |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 for test_suite in test_suite_iter: | 670 for test_suite in test_suite_iter: |
| 670 for test_case in test_suite: | 671 for test_case in test_suite: |
| 671 for test in test_case: | 672 for test in test_case: |
| 672 # Drop the file name in the form <filename>.<classname>.<methodname> | 673 # Drop the file name in the form <filename>.<classname>.<methodname> |
| 673 test_id = test.id()[test.id().find('.') + 1:] | 674 test_id = test.id()[test.id().find('.') + 1:] |
| 674 if re.match(test_filter_re, test_id): | 675 if re.match(test_filter_re, test_id): |
| 675 tests.addTest(test) | 676 tests.addTest(test) |
| 676 testRunner = unittest.runner.TextTestRunner(verbosity=2, | 677 testRunner = unittest.runner.TextTestRunner(verbosity=2, |
| 677 failfast=flags.failfast, buffer=(not flags.disable_buffer)) | 678 failfast=flags.failfast, buffer=(not flags.disable_buffer)) |
| 678 testRunner.run(tests) | 679 testRunner.run(tests) |
| OLD | NEW |