Chromium Code Reviews| Index: tools/chrome_proxy/webdriver/common.py |
| diff --git a/tools/chrome_proxy/webdriver/common.py b/tools/chrome_proxy/webdriver/common.py |
| index 794918fcddcedfbfa3a24e996a32d86efd568b8e..0690de24e640348de6e1101e2001177c38e06717 100644 |
| --- a/tools/chrome_proxy/webdriver/common.py |
| +++ b/tools/chrome_proxy/webdriver/common.py |
| @@ -77,11 +77,24 @@ class TestDriver: |
| def _OverrideChromeArgs(self): |
| """ |
| - Overrides any given flags in the code with those given on the command line. |
| + Overrides any given arguments in the code with those given on the command |
|
RyanSturm
2016/11/30 20:46:36
I'm a little confused about how this is used. Can
Robert Ogden
2016/12/01 01:23:04
CL description improved, but yes you were correct.
RyanSturm
2016/12/01 01:32:11
SGTM.
|
| + line. Arguments that need to be overridden may contain different values for |
| + a flag given in the code. In that case, check by the flag whether to |
| + override the argument. |
| """ |
| + def GetDictKey(argument): |
| + return argument.split('=', 1)[0] |
| if self._flags.browser_args and len(self._flags.browser_args) > 0: |
| - for arg in shlex.split(self._flags.browser_args): |
| - self._chrome_args.add(arg) |
| + # Build a dict of flags mapped to the whole argument. |
| + originalArgs = {} |
|
RyanSturm
2016/11/30 20:46:36
s/originalArgs/original_args/
AFAIK naming for py
Robert Ogden
2016/12/01 01:23:04
Done.
|
| + for arg in self._chrome_args: |
| + originalArgs[GetDictKey(arg)] = arg |
| + # Override by flag. |
| + for overrideArg in shlex.split(self._flags.browser_args): |
|
RyanSturm
2016/11/30 20:46:36
s/overrideArg/override_arg/
Robert Ogden
2016/12/01 01:23:04
Done.
|
| + argKey = GetDictKey(overrideArg) |
|
RyanSturm
2016/11/30 20:46:36
s/argKey/arg_key/
Robert Ogden
2016/12/01 01:23:04
Done.
|
| + if argKey in originalArgs: |
| + self._chrome_args.remove(originalArgs[argKey]) |
| + self._chrome_args.add(overrideArg) |
| def _StartDriver(self): |
| """ |