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

Side by Side Diff: tools/telemetry/telemetry/web_contents.py

Issue 12278015: [Telemetry] Reorganize everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add shebangs. Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 DEFAULT_WEB_CONTENTS_TIMEOUT = 60
6
7 # TODO(achuith, dtu, nduca): Add unit tests specifically for WebContents,
8 # independent of Tab.
9 class WebContents(object):
10 """Represents web contents in the browser"""
11 def __init__(self, inspector_backend):
12 self._inspector_backend = inspector_backend
13
14 def __del__(self):
15 self.Disconnect()
16
17 def Disconnect(self):
18 self._inspector_backend.Disconnect()
19
20 def WaitForDocumentReadyStateToBeComplete(self,
21 timeout=DEFAULT_WEB_CONTENTS_TIMEOUT):
22 self._inspector_backend.WaitForDocumentReadyStateToBeComplete(timeout)
23
24 def WaitForDocumentReadyStateToBeInteractiveOrBetter(self,
25 timeout=DEFAULT_WEB_CONTENTS_TIMEOUT):
26 self._inspector_backend.WaitForDocumentReadyStateToBeInteractiveOrBetter(
27 timeout)
28
29 def ExecuteJavaScript(self, expr, timeout=DEFAULT_WEB_CONTENTS_TIMEOUT):
30 """Executes expr in JavaScript. Does not return the result.
31
32 If the expression failed to evaluate, EvaluateException will be raised.
33 """
34 self._inspector_backend.ExecuteJavaScript(expr, timeout)
35
36 def EvaluateJavaScript(self, expr, timeout=DEFAULT_WEB_CONTENTS_TIMEOUT):
37 """Evalutes expr in JavaScript and returns the JSONized result.
38
39 Consider using ExecuteJavaScript for cases where the result of the
40 expression is not needed.
41
42 If evaluation throws in JavaScript, a Python EvaluateException will
43 be raised.
44
45 If the result of the evaluation cannot be JSONized, then an
46 EvaluationException will be raised.
47 """
48 return self._inspector_backend.EvaluateJavaScript(expr, timeout)
49
50 @property
51 def message_output_stream(self):
52 return self._inspector_backend.message_output_stream
53
54 @message_output_stream.setter
55 def message_output_stream(self, stream):
56 self._inspector_backend.message_output_stream = stream
57
58 @property
59 def timeline_model(self):
60 return self._inspector_backend.timeline_model
61
62 def StartTimelineRecording(self):
63 self._inspector_backend.StartTimelineRecording()
64
65 def StopTimelineRecording(self):
66 self._inspector_backend.StopTimelineRecording()
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/wait_action_unittest.py ('k') | tools/telemetry/telemetry/websocket.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698