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

Side by Side Diff: experimental/telemetry_mini/telemetry_mini.py

Issue 3015453002: [telemetry_mini] Fix websocket method name (Closed)
Patch Set: Created 3 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
« 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 2017 The Chromium Authors. All rights reserved. 2 # Copyright 2017 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 # This is intended to be a very trimmed down, single-file, hackable, and easy 6 # This is intended to be a very trimmed down, single-file, hackable, and easy
7 # to understand version of Telemetry. It's able to run simple user stories on 7 # to understand version of Telemetry. It's able to run simple user stories on
8 # Android, grab traces, and extract metrics from them. May be useful to 8 # Android, grab traces, and extract metrics from them. May be useful to
9 # diagnose issues with Chrome, reproduce regressions or prototype new user 9 # diagnose issues with Chrome, reproduce regressions or prototype new user
10 # stories. 10 # stories.
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 def __enter__(self): 319 def __enter__(self):
320 self.Open() 320 self.Open()
321 return self 321 return self
322 322
323 def __exit__(self, *args, **kwargs): 323 def __exit__(self, *args, **kwargs):
324 self.Close() 324 self.Close()
325 325
326 @RetryOn(socket.error) 326 @RetryOn(socket.error)
327 def Open(self): 327 def Open(self):
328 assert self._socket is None 328 assert self._socket is None
329 # pylint: disable=no-member 329 self._socket = websocket.create_connection(self._url)
330 self._socket = websocket.CreateConnection(self._url)
331 330
332 def Close(self): 331 def Close(self):
333 if self._socket is not None: 332 if self._socket is not None:
334 self._socket.close() 333 self._socket.close()
335 self._socket = None 334 self._socket = None
336 335
337 def Send(self, method, **kwargs): 336 def Send(self, method, **kwargs):
338 logging.info( 337 logging.info(
339 '%s: %s(%s)', self._url, method, 338 '%s: %s(%s)', self._url, method,
340 ', '.join('%s=%r' % (k, v) for k, v in sorted(kwargs.iteritems()))) 339 ', '.join('%s=%r' % (k, v) for k, v in sorted(kwargs.iteritems())))
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 status = '[ OK ]' 643 status = '[ OK ]'
645 start = time.time() 644 start = time.time()
646 try: 645 try:
647 story_cls(browser).Run(trace_file) 646 story_cls(browser).Run(trace_file)
648 except Exception: # pylint: disable=broad-except 647 except Exception: # pylint: disable=broad-except
649 logging.exception('Exception raised while running story') 648 logging.exception('Exception raised while running story')
650 status = '[ FAILED ]' 649 status = '[ FAILED ]'
651 finally: 650 finally:
652 elapsed = '(%.1f secs)' % (time.time() - start) 651 elapsed = '(%.1f secs)' % (time.time() - start)
653 print status, story_cls.NAME, elapsed 652 print status, story_cls.NAME, elapsed
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