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

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

Issue 11360172: Added Tab.SnapshotContent and MapsGL example to telemetry (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merged with master Created 8 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 from telemetry import inspector_console 4 from telemetry import inspector_console
5 from telemetry import inspector_page 5 from telemetry import inspector_page
6 from telemetry import inspector_runtime 6 from telemetry import inspector_runtime
7 from telemetry import inspector_timeline 7 from telemetry import inspector_timeline
8 from telemetry import util 8 from telemetry import util
9 9
10 DEFAULT_TAB_TIMEOUT = 60 10 DEFAULT_TAB_TIMEOUT = 60
11 11
12 class Tab(object): 12 class Tab(object):
13 """Represents a tab in the browser 13 """Represents a tab in the browser
14 14
15 The important parts of the Tab object are in the runtime and page objects. 15 The important parts of the Tab object are in the runtime and page objects.
16 E.g.: 16 E.g.:
17 # Navigates the tab to a given url. 17 # Navigates the tab to a given url.
18 tab.page.Navigate('http://www.google.com/') 18 tab.page.Navigate('http://www.google.com/')
19 19
20 # Evaluates 1+1 in the tab's javascript context. 20 # Evaluates 1+1 in the tab's javascript context.
21 tab.runtime.Evaluate('1+1') 21 tab.runtime.Evaluate('1+1')
22 """ 22 """
23 def __init__(self, browser, inspector_backend): 23 def __init__(self, browser, inspector_backend):
24 self._browser = browser 24 self._browser = browser
25 self._inspector_backend = inspector_backend 25 self._inspector_backend = inspector_backend
26 self._page = inspector_page.InspectorPage(self._inspector_backend) 26 self._page = inspector_page.InspectorPage(self._inspector_backend, self)
27 self._runtime = inspector_runtime.InspectorRuntime(self._inspector_backend) 27 self._runtime = inspector_runtime.InspectorRuntime(
28 self._console = inspector_console.InspectorConsole(self._inspector_backend) 28 self._inspector_backend, self)
29 self._console = inspector_console.InspectorConsole(
30 self._inspector_backend, self)
29 self._timeline = inspector_timeline.InspectorTimeline( 31 self._timeline = inspector_timeline.InspectorTimeline(
30 self._inspector_backend) 32 self._inspector_backend, self)
31 33
32 def __del__(self): 34 def __del__(self):
33 self.Close() 35 self.Close()
34 36
35 def Close(self): 37 def Close(self):
36 self._console = None 38 self._console = None
37 self._runtime = None 39 self._runtime = None
38 self._page = None 40 self._page = None
39 self._timeline = None 41 self._timeline = None
40 if self._inspector_backend: 42 if self._inspector_backend:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 util.WaitFor( 79 util.WaitFor(
78 lambda: self._runtime.Evaluate('document.readyState') == 'complete', 80 lambda: self._runtime.Evaluate('document.readyState') == 'complete',
79 timeout) 81 timeout)
80 82
81 def WaitForDocumentReadyStateToBeInteractiveOrBetter( 83 def WaitForDocumentReadyStateToBeInteractiveOrBetter(
82 self, timeout=DEFAULT_TAB_TIMEOUT): 84 self, timeout=DEFAULT_TAB_TIMEOUT):
83 def IsReadyStateInteractiveOrBetter(): 85 def IsReadyStateInteractiveOrBetter():
84 rs = self._runtime.Evaluate('document.readyState') 86 rs = self._runtime.Evaluate('document.readyState')
85 return rs == 'complete' or rs == 'interactive' 87 return rs == 'complete' or rs == 'interactive'
86 util.WaitFor(IsReadyStateInteractiveOrBetter, timeout) 88 util.WaitFor(IsReadyStateInteractiveOrBetter, timeout)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/png_bitmap_unittest.py ('k') | tools/telemetry/telemetry/tab_test_case.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698