| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 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 |
| 12 import optparse | 12 import optparse |
| 13 import os | 13 import os |
| 14 import random | 14 import random |
| 15 import re | 15 import re |
| 16 import sys | 16 import sys |
| 17 import time | 17 import time |
| 18 | 18 |
| 19 _SRC_PATH = os.path.abspath(os.path.join( | 19 _SRC_PATH = os.path.abspath(os.path.join( |
| 20 os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir)) | 20 os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir)) |
| 21 | 21 |
| 22 sys.path.append(os.path.join(_SRC_PATH, 'third_party', 'catapult', 'devil')) | 22 sys.path.append(os.path.join(_SRC_PATH, 'third_party', 'catapult', 'devil')) |
| 23 from devil.android import device_errors | 23 from devil.android import device_errors |
| 24 from devil.android import device_utils | 24 from devil.android import device_utils |
| 25 from devil.android import flag_changer |
| 25 from devil.android.perf import cache_control | 26 from devil.android.perf import cache_control |
| 26 from devil.android.sdk import intent | 27 from devil.android.sdk import intent |
| 27 | 28 |
| 28 sys.path.append(os.path.join(_SRC_PATH, 'build', 'android')) | 29 sys.path.append(os.path.join(_SRC_PATH, 'build', 'android')) |
| 29 import devil_chromium | 30 import devil_chromium |
| 30 | 31 |
| 31 sys.path.append(os.path.join(_SRC_PATH, 'tools', 'android', 'loading')) | 32 sys.path.append(os.path.join(_SRC_PATH, 'tools', 'android', 'loading')) |
| 32 import chrome_setup | 33 import chrome_setup |
| 33 import device_setup | 34 import device_setup |
| 34 | 35 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 63 <first_contentful_paint> | 64 <first_contentful_paint> |
| 64 or None on error. | 65 or None on error. |
| 65 """ | 66 """ |
| 66 if not device.HasRoot(): | 67 if not device.HasRoot(): |
| 67 device.EnableRoot() | 68 device.EnableRoot() |
| 68 | 69 |
| 69 timeout_s = 20 | 70 timeout_s = 20 |
| 70 logcat_timeout = int(timeout_s + delay_to_may_launch_url / 1000. | 71 logcat_timeout = int(timeout_s + delay_to_may_launch_url / 1000. |
| 71 + delay_to_launch_url / 1000.) + 3; | 72 + delay_to_launch_url / 1000.) + 3; |
| 72 | 73 |
| 73 with device_setup.FlagReplacer(device, _COMMAND_LINE_FILE, chrome_args): | 74 with flag_changer.CustomCommandLineFlags( |
| 75 device, _COMMAND_LINE_FILE, chrome_args): |
| 74 launch_intent = intent.Intent( | 76 launch_intent = intent.Intent( |
| 75 action='android.intent.action.MAIN', | 77 action='android.intent.action.MAIN', |
| 76 package=_TEST_APP_PACKAGE_NAME, | 78 package=_TEST_APP_PACKAGE_NAME, |
| 77 activity='org.chromium.customtabs.test.MainActivity', | 79 activity='org.chromium.customtabs.test.MainActivity', |
| 78 extras={'url': str(url), 'warmup': warmup, | 80 extras={'url': str(url), 'warmup': warmup, |
| 79 'speculation_mode': str(speculation_mode), | 81 'speculation_mode': str(speculation_mode), |
| 80 'delay_to_may_launch_url': delay_to_may_launch_url, | 82 'delay_to_may_launch_url': delay_to_may_launch_url, |
| 81 'delay_to_launch_url': delay_to_launch_url, | 83 'delay_to_launch_url': delay_to_launch_url, |
| 82 'timeout': timeout_s}) | 84 'timeout': timeout_s}) |
| 83 result_line_re = re.compile(r'CUSTOMTABSBENCH.*: (.*)') | 85 result_line_re = re.compile(r'CUSTOMTABSBENCH.*: (.*)') |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 'delay_to_launch_url': options.delay_to_launch_url, | 296 'delay_to_launch_url': options.delay_to_launch_url, |
| 295 'cold': options.cold, | 297 'cold': options.cold, |
| 296 } | 298 } |
| 297 LoopOnDevice(device, [config], options.output_file, options.wpr_archive, | 299 LoopOnDevice(device, [config], options.output_file, options.wpr_archive, |
| 298 options.record, options.network_condition, options.wpr_log, | 300 options.record, options.network_condition, options.wpr_log, |
| 299 once=options.once) | 301 once=options.once) |
| 300 | 302 |
| 301 | 303 |
| 302 if __name__ == '__main__': | 304 if __name__ == '__main__': |
| 303 main() | 305 main() |
| OLD | NEW |