Chromium Code Reviews| Index: tools/telemetry/telemetry/tab.py |
| diff --git a/tools/telemetry/telemetry/tab.py b/tools/telemetry/telemetry/tab.py |
| index 527a2e00fb94aea172a4d30a64c7a9106a2856e4..1e3825708e17243817da2742f284571dcee8f1ba 100644 |
| --- a/tools/telemetry/telemetry/tab.py |
| +++ b/tools/telemetry/telemetry/tab.py |
| @@ -5,6 +5,7 @@ from telemetry import inspector_console |
| from telemetry import inspector_page |
| from telemetry import inspector_runtime |
| from telemetry import util |
| +from telemetry import snapshot |
| DEFAULT_TAB_TIMEOUT = 60 |
| @@ -75,3 +76,23 @@ class Tab(object): |
| rs = self._runtime.Evaluate('document.readyState') |
| return rs == 'complete' or rs == 'interactive' |
| util.WaitFor(IsReadyStateInteractiveOrBetter, timeout) |
| + |
|
nduca
2012/11/09 21:19:00
This should be a feature on inspector_page.py ---
|
| + def SnapshotContent(self, timeout=DEFAULT_TAB_TIMEOUT): |
|
nduca
2012/11/09 21:19:00
So, what if someone calls this and the gpuBenchmar
nduca
2012/11/09 21:19:00
"content"? That would imply we're taking a picture
|
| + self._runtime.Evaluate(""" |
|
nduca
2012/11/09 21:19:00
This function should have """Help text""" that exp
|
| + window.chrome.gpuBenchmarking.snapshotComplete = false; |
| + window.chrome.gpuBenchmarking.windowSnapshot(function(snapshot) { |
| + window.chrome.gpuBenchmarking.snapshotData = snapshot; |
| + window.chrome.gpuBenchmarking.snapshotComplete = true; |
| + }); |
| + """) |
| + |
| + def IsSnapshotComplete(): |
| + return self._runtime.Evaluate( |
| + 'window.chrome.gpuBenchmarking.snapshotComplete') |
| + |
| + util.WaitFor(IsSnapshotComplete, timeout) |
| + |
| + snap = self._runtime.Evaluate('window.chrome.gpuBenchmarking.snapshotData') |
| + if snap: |
| + return snapshot.Snapshot(snap['data']) |
| + return None |