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

Side by Side Diff: telemetry/telemetry/internal/util/webpagereplay.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 # Copyright 2012 The Chromium Authors. All rights reserved. 1 # Copyright 2012 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 """Start and stop Web Page Replay.""" 5 """Start and stop Web Page Replay."""
6 6
7 from telemetry.internal.util import atexit_with_log 7 from telemetry.internal.util import atexit_with_log
8 import logging 8 import logging
9 import os 9 import os
10 import re 10 import re
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 if self.replay_process.poll() is not None: 142 if self.replay_process.poll() is not None:
143 # The process terminated. 143 # The process terminated.
144 return False 144 return False
145 145
146 def HasIncompleteStartedPorts(): 146 def HasIncompleteStartedPorts():
147 return ('http' not in self._started_ports or 147 return ('http' not in self._started_ports or
148 'https' not in self._started_ports or 148 'https' not in self._started_ports or
149 (self._use_dns_server and 'dns' not in self._started_ports)) 149 (self._use_dns_server and 'dns' not in self._started_ports))
150 if HasIncompleteStartedPorts(): 150 if HasIncompleteStartedPorts():
151 self._started_ports = self._ParseLogFilePorts(self._LogLines()) 151 self._started_ports = self._ParseLogFilePorts(self._LogLines())
152 logging.info('WPR ports: %s' % self._started_ports)
152 if HasIncompleteStartedPorts(): 153 if HasIncompleteStartedPorts():
153 return False 154 return False
154 try: 155 try:
155 # HTTPS may require SNI (which urllib does not speak), so only check 156 # HTTPS may require SNI (which urllib does not speak), so only check
156 # that HTTP responds. 157 # that HTTP responds.
157 return 200 == self._UrlOpen('web-page-replay-generate-200').getcode() 158 return 200 == self._UrlOpen('web-page-replay-generate-200').getcode()
158 except IOError: 159 except IOError:
159 return False 160 return False
160 161
161 @staticmethod 162 @staticmethod
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 On posix system, running this function before starting replay fixes a 320 On posix system, running this function before starting replay fixes a
320 bug that shows up when Telemetry is run as a background command from a 321 bug that shows up when Telemetry is run as a background command from a
321 script. https://crbug.com/254572. 322 script. https://crbug.com/254572.
322 323
323 Background: Signal masks on Linux are inherited from parent 324 Background: Signal masks on Linux are inherited from parent
324 processes. If anything invoking us accidentally masks SIGINT 325 processes. If anything invoking us accidentally masks SIGINT
325 (e.g. by putting a process in the background from a shell script), 326 (e.g. by putting a process in the background from a shell script),
326 sending a SIGINT to the child will fail to terminate it. 327 sending a SIGINT to the child will fail to terminate it.
327 """ 328 """
328 signal.signal(signal.SIGINT, signal.SIG_DFL) 329 signal.signal(signal.SIGINT, signal.SIG_DFL)
OLDNEW
« no previous file with comments | « telemetry/telemetry/internal/story_runner_unittest.py ('k') | telemetry/telemetry/page/cache_temperature.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698