| 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 collections | 5 import collections |
| 6 import contextlib | 6 import contextlib |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import shutil | 9 import shutil |
| 10 import subprocess | 10 import subprocess |
| 11 import sys | 11 import sys |
| 12 import tempfile | 12 import tempfile |
| 13 import time | 13 import time |
| 14 | 14 |
| 15 _SRC_DIR = os.path.abspath(os.path.join( | 15 _SRC_DIR = os.path.abspath(os.path.join( |
| 16 os.path.dirname(__file__), '..', '..', '..')) | 16 os.path.dirname(__file__), '..', '..', '..')) |
| 17 | 17 |
| 18 _CATAPULT_DIR = os.path.join(_SRC_DIR, 'third_party', 'catapult') | 18 _CATAPULT_DIR = os.path.join(_SRC_DIR, 'third_party', 'catapult') |
| 19 sys.path.append(os.path.join(_CATAPULT_DIR, 'devil')) | 19 sys.path.append(os.path.join(_CATAPULT_DIR, 'devil')) |
| 20 from devil.android import device_utils | 20 from devil.android import device_utils |
| 21 from devil.android import flag_changer | 21 from devil.android import flag_changer |
| 22 from devil.android import forwarder | 22 from devil.android import forwarder |
| 23 from devil.android.sdk import adb_wrapper |
| 23 from devil.android.sdk import intent | 24 from devil.android.sdk import intent |
| 24 | 25 |
| 25 sys.path.append(os.path.join(_SRC_DIR, 'build', 'android')) | 26 sys.path.append(os.path.join(_SRC_DIR, 'build', 'android')) |
| 26 from pylib import constants | 27 from pylib import constants |
| 27 from video_recorder import video_recorder | 28 from video_recorder import video_recorder |
| 28 | 29 |
| 29 sys.path.append(os.path.join(_SRC_DIR, 'tools', 'perf')) | 30 sys.path.append(os.path.join(_SRC_DIR, 'tools', 'perf')) |
| 30 from chrome_telemetry_build import chromium_config | 31 from chrome_telemetry_build import chromium_config |
| 31 | 32 |
| 32 sys.path.append(chromium_config.GetTelemetryDir()) | 33 sys.path.append(chromium_config.GetTelemetryDir()) |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 if wpr_archive_path == None: | 312 if wpr_archive_path == None: |
| 312 _VerifySilentWprHost(record, network_condition_name) | 313 _VerifySilentWprHost(record, network_condition_name) |
| 313 yield [] | 314 yield [] |
| 314 return | 315 return |
| 315 # Deploy certification authority to the device. | 316 # Deploy certification authority to the device. |
| 316 temp_certificate_dir = tempfile.mkdtemp() | 317 temp_certificate_dir = tempfile.mkdtemp() |
| 317 wpr_ca_cert_path = os.path.join(temp_certificate_dir, 'testca.pem') | 318 wpr_ca_cert_path = os.path.join(temp_certificate_dir, 'testca.pem') |
| 318 certutils.write_dummy_ca_cert(*certutils.generate_dummy_ca_cert(), | 319 certutils.write_dummy_ca_cert(*certutils.generate_dummy_ca_cert(), |
| 319 cert_path=wpr_ca_cert_path) | 320 cert_path=wpr_ca_cert_path) |
| 320 device_cert_util = adb_install_cert.AndroidCertInstaller( | 321 device_cert_util = adb_install_cert.AndroidCertInstaller( |
| 321 device.adb.GetDeviceSerial(), None, wpr_ca_cert_path) | 322 device.adb.GetDeviceSerial(), None, wpr_ca_cert_path, |
| 323 adb_wrapper.AdbWrapper.GetAdbPath()) |
| 322 device_cert_util.install_cert(overwrite_cert=True) | 324 device_cert_util.install_cert(overwrite_cert=True) |
| 323 try: | 325 try: |
| 324 # Set up WPR server | 326 # Set up WPR server |
| 325 with _WprHost( | 327 with _WprHost( |
| 326 wpr_archive_path, | 328 wpr_archive_path, |
| 327 record=record, | 329 record=record, |
| 328 network_condition_name=network_condition_name, | 330 network_condition_name=network_condition_name, |
| 329 disable_script_injection=disable_script_injection, | 331 disable_script_injection=disable_script_injection, |
| 330 wpr_ca_cert_path=wpr_ca_cert_path, | 332 wpr_ca_cert_path=wpr_ca_cert_path, |
| 331 out_log_path=out_log_path) as (http_port, https_port): | 333 out_log_path=out_log_path) as (http_port, https_port): |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 # speed index measurement. | 425 # speed index measurement. |
| 424 connection.ExecuteJavaScript(""" | 426 connection.ExecuteJavaScript(""" |
| 425 (function() { | 427 (function() { |
| 426 requestAnimationFrame(function() { | 428 requestAnimationFrame(function() { |
| 427 var screen = window.__speedindex_screen; | 429 var screen = window.__speedindex_screen; |
| 428 screen.style.background = 'rgb(255, 255, 255)'; | 430 screen.style.background = 'rgb(255, 255, 255)'; |
| 429 }); | 431 }); |
| 430 })(); | 432 })(); |
| 431 """) | 433 """) |
| 432 yield | 434 yield |
| OLD | NEW |