Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Unified Diff: tools/android/loading/device_setup.py

Issue 1690653002: sandwich: Adds web page replay support for HTTPS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@d00
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/loading/device_setup.py
diff --git a/tools/android/loading/device_setup.py b/tools/android/loading/device_setup.py
index 498695775fade2fdfb3ed60a6f9176e037c2f28a..5782b58a1bed6c6c01782ef3ce9ae4626de80cea 100644
--- a/tools/android/loading/device_setup.py
+++ b/tools/android/loading/device_setup.py
@@ -29,6 +29,10 @@ from chrome_telemetry_build import chromium_config
sys.path.append(chromium_config.GetTelemetryDir())
from telemetry.internal.util import webpagereplay
+sys.path.append(os.path.join(_SRC_DIR, 'third_party', 'webpagereplay'))
+import adb_install_cert
+import certutils
+
import devtools_monitor
DEVTOOLS_PORT = 9222
@@ -135,6 +139,20 @@ def WprHost(device, wpr_archive_path, record=False):
os.remove(wpr_archive_path)
else:
assert os.path.exists(wpr_archive_path)
+
+ # Deploy certification authority to the device.
+ temp_certificate_dir = tempfile.mkdtemp()
+ wpr_ca_cert_path = os.path.join(temp_certificate_dir, 'testca.pem')
+ certutils.write_dummy_ca_cert(*certutils.generate_dummy_ca_cert(),
+ cert_path=wpr_ca_cert_path)
+
+ device_cert_util = adb_install_cert.AndroidCertInstaller(
+ device.adb.GetDeviceSerial(), None, wpr_ca_cert_path)
+ device_cert_util.install_cert(overwrite_cert=True)
+ wpr_server_args.extend(['--should_generate_certs',
+ '--https_root_ca_cert_path=' + wpr_ca_cert_path])
+
+ # Set up WPR server and device forwarder.
wpr_server = webpagereplay.ReplayServer(wpr_archive_path,
'127.0.0.1', 0, 0, None, wpr_server_args)
ports = wpr_server.StartServer()[:-1]
@@ -155,6 +173,10 @@ def WprHost(device, wpr_archive_path, record=False):
forwarder.Forwarder.UnmapDevicePort(device_https_port, device)
wpr_server.StopServer()
+ # Remove certification authority from the device.
+ device_cert_util.remove_cert()
+ shutil.rmtree(temp_certificate_dir)
+
@contextlib.contextmanager
def DeviceConnection(device,
package=DEFAULT_CHROME_PACKAGE,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698