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

Side by Side Diff: chrome/test/functional/webpagereplay.py

Issue 23523017: [telemetry] Make default flags passed to WebPageRelay overridable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Start and stop Web Page Replay. 6 """Start and stop Web Page Replay.
7 7
8 Of the public module names, the following one is key: 8 Of the public module names, the following one is key:
9 ReplayServer: a class to start/stop Web Page Replay. 9 ReplayServer: a class to start/stop Web Page Replay.
10 """ 10 """
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 self._CheckPath('archive directory', os.path.dirname(self.archive_path)) 113 self._CheckPath('archive directory', os.path.dirname(self.archive_path))
114 elif not os.path.exists(self.archive_path): 114 elif not os.path.exists(self.archive_path):
115 self._CheckPath('archive file', self.archive_path) 115 self._CheckPath('archive file', self.archive_path)
116 self._CheckPath('replay script', self.replay_py) 116 self._CheckPath('replay script', self.replay_py)
117 117
118 self.log_fh = None 118 self.log_fh = None
119 self.replay_process = None 119 self.replay_process = None
120 120
121 def _AddDefaultReplayOptions(self): 121 def _AddDefaultReplayOptions(self):
122 """Set WPR command-line options. Can be overridden if needed.""" 122 """Set WPR command-line options. Can be overridden if needed."""
123 self.replay_options += [ 123 self.replay_options = [
124 '--host', str(self._replay_host), 124 '--host', str(self._replay_host),
125 '--port', str(self._http_port), 125 '--port', str(self._http_port),
126 '--ssl_port', str(self._https_port), 126 '--ssl_port', str(self._https_port),
127 '--use_closest_match', 127 '--use_closest_match',
128 '--no-dns_forwarding', 128 '--no-dns_forwarding',
129 '--log_level', 'warning' 129 '--log_level', 'warning'
130 ] 130 ] + self.replay_options
131 131
132 def _CheckPath(self, label, path): 132 def _CheckPath(self, label, path):
133 if not os.path.exists(path): 133 if not os.path.exists(path):
134 raise ReplayNotFoundError(label, path) 134 raise ReplayNotFoundError(label, path)
135 135
136 def _OpenLogFile(self): 136 def _OpenLogFile(self):
137 log_dir = os.path.dirname(self.log_path) 137 log_dir = os.path.dirname(self.log_path)
138 if not os.path.exists(log_dir): 138 if not os.path.exists(log_dir):
139 os.makedirs(log_dir) 139 os.makedirs(log_dir)
140 return open(self.log_path, 'w') 140 return open(self.log_path, 'w')
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 self.log_fh.close() 209 self.log_fh.close()
210 210
211 def __enter__(self): 211 def __enter__(self):
212 """Add support for with-statement.""" 212 """Add support for with-statement."""
213 self.StartServer() 213 self.StartServer()
214 return self 214 return self
215 215
216 def __exit__(self, unused_exc_type, unused_exc_val, unused_exc_tb): 216 def __exit__(self, unused_exc_type, unused_exc_val, unused_exc_tb):
217 """Add support for with-statement.""" 217 """Add support for with-statement."""
218 self.StopServer() 218 self.StopServer()
OLDNEW
« 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