OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
pasko
2016/12/12 18:07:09
toplevel note: please start including alexilin@ as
Benoit L
2016/12/14 17:39:39
Acknowledged.
| |
2 # | 2 # |
3 # Copyright 2015 The Chromium Authors. All rights reserved. | 3 # Copyright 2015 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Loops Custom Tabs tests and outputs the results into a CSV file.""" | 7 """Loops Custom Tabs tests and outputs the results into a CSV file.""" |
8 | 8 |
9 import collections | 9 import collections |
10 import contextlib | 10 import contextlib |
11 import logging | 11 import logging |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 once: (bool) Run only once. | 174 once: (bool) Run only once. |
175 should_stop: (threading.Event or None) When the event is set, stop looping. | 175 should_stop: (threading.Event or None) When the event is set, stop looping. |
176 """ | 176 """ |
177 with SetupWpr(device, wpr_archive_path, wpr_record, network_condition, | 177 with SetupWpr(device, wpr_archive_path, wpr_record, network_condition, |
178 wpr_log_path) as wpr_attributes: | 178 wpr_log_path) as wpr_attributes: |
179 to_stdout = output_filename == '-' | 179 to_stdout = output_filename == '-' |
180 out = sys.stdout if to_stdout else open(output_filename, 'a') | 180 out = sys.stdout if to_stdout else open(output_filename, 'a') |
181 try: | 181 try: |
182 while should_stop is None or not should_stop.is_set(): | 182 while should_stop is None or not should_stop.is_set(): |
183 config = configs[random.randint(0, len(configs) - 1)] | 183 config = configs[random.randint(0, len(configs) - 1)] |
184 chrome_args = _CHROME_ARGS + wpr_attributes.chrome_args | 184 chrome_args = CHROME_ARGS + wpr_attributes.chrome_args |
185 if config['speculation_mode'] == 'no_state_prefetch': | 185 if config['speculation_mode'] == 'no_state_prefetch': |
186 chrome_args.append('--prerender=prefetch') | 186 chrome_args.append('--prerender=prefetch') |
187 result = RunOnce(device, config['url'], config['warmup'], | 187 result = RunOnce(device, config['url'], config['warmup'], |
188 config['speculation_mode'], | 188 config['speculation_mode'], |
189 config['delay_to_may_launch_url'], | 189 config['delay_to_may_launch_url'], |
190 config['delay_to_launch_url'], config['cold'], | 190 config['delay_to_launch_url'], config['cold'], |
191 chrome_args, reset_chrome_state=True) | 191 chrome_args, reset_chrome_state=True) |
192 if result is not None: | 192 if result is not None: |
193 out.write(result + '\n') | 193 out.write(result + '\n') |
194 out.flush() | 194 out.flush() |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 'delay_to_launch_url': options.delay_to_launch_url, | 313 'delay_to_launch_url': options.delay_to_launch_url, |
314 'cold': options.cold, | 314 'cold': options.cold, |
315 } | 315 } |
316 LoopOnDevice(device, [config], options.output_file, options.wpr_archive, | 316 LoopOnDevice(device, [config], options.output_file, options.wpr_archive, |
317 options.record, options.network_condition, options.wpr_log, | 317 options.record, options.network_condition, options.wpr_log, |
318 once=options.once) | 318 once=options.once) |
319 | 319 |
320 | 320 |
321 if __name__ == '__main__': | 321 if __name__ == '__main__': |
322 main() | 322 main() |
OLD | NEW |