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

Unified Diff: tools/cygprofile/profile_android_startup.py

Issue 1089163004: Make startup of of WPR components resilient to not starting up previous steps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor detection of failed WPR startup. Created 5 years, 8 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/cygprofile/profile_android_startup.py
diff --git a/tools/cygprofile/profile_android_startup.py b/tools/cygprofile/profile_android_startup.py
index fae608f1e0f47c54de923d7eb3f5280ed3eccad6..b8c585270a9e4a8fd2d1112551ee2450ef5f8b41 100644
--- a/tools/cygprofile/profile_android_startup.py
+++ b/tools/cygprofile/profile_android_startup.py
@@ -135,12 +135,14 @@ class WprManager(object):
"""Start the WPR server on the host and the forwarder on the device."""
print 'Starting WPR on host...'
_DownloadFromCloudStorage(self._WPR_BUCKET, self._wpr_archive_hash)
- self._wpr_server = webpagereplay.ReplayServer(self._wpr_archive,
- '127.0.0.1', 0, 0, None,
- ['--should_generate_certs',
- '--https_root_ca_cert_path=' + self._wpr_ca_cert_path,
- '--use_closest_match'])
- ports = self._wpr_server.StartServer()[:-1]
+ args = ['--user_closest_match']
+ if self._is_test_ca_installed:
+ args.extend(['--should_generate_certs',
+ '--https_root_ca_cert_path=' + self._wpr_ca_cert_path])
+ wpr_server = webpagereplay.ReplayServer(self._wpr_archive,
+ '127.0.0.1', 0, 0, None, args)
+ ports = wpr_server.StartServer()[:-1]
+ self._wpr_server = wpr_server
self._host_http_port = ports[0]
self._host_https_port = ports[1]
@@ -149,11 +151,15 @@ class WprManager(object):
print 'Stopping WPR on host...'
if self._wpr_server:
self._wpr_server.StopServer()
+ self._wpr_server = None
def _StartForwarder(self):
"""Sets up forwarding of device ports to the host, and configures chrome
to use those ports.
"""
+ if not self._wpr_server:
+ logging.warning('No host WPR server to forward to.')
+ return
print 'Starting device forwarder...'
forwarder.Forwarder.Map([(0, self._host_http_port),
(0, self._host_https_port)],
« 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