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

Side by Side Diff: telemetry/telemetry/internal/backends/chrome_inspector/inspector_page.py

Issue 2887023002: Pass False for fromSurface argument to Page.captureScreenshot. (Closed)
Patch Set: Add TODO about supporting headless mode. Created 3 years, 7 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 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 import time 4 import time
5 5
6 from telemetry.util import image_util 6 from telemetry.util import image_util
7 7
8 8
9 class InspectorPage(object): 9 class InspectorPage(object):
10 """Class that controls a page connected by an inspector_websocket. 10 """Class that controls a page connected by an inspector_websocket.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 res = self._inspector_websocket.SyncRequest(request, timeout) 132 res = self._inspector_websocket.SyncRequest(request, timeout)
133 cookies = res['result']['cookies'] 133 cookies = res['result']['cookies']
134 for cookie in cookies: 134 for cookie in cookies:
135 if cookie['name'] == name: 135 if cookie['name'] == name:
136 return cookie['value'] 136 return cookie['value']
137 return None 137 return None
138 138
139 def CaptureScreenshot(self, timeout=60): 139 def CaptureScreenshot(self, timeout=60):
140 request = { 140 request = {
141 'method': 'Page.captureScreenshot' 141 'method': 'Page.captureScreenshot',
142 # TODO(rmistry): when Chrome is running in headless mode, this
143 # will need to pass True. Telemetry needs to understand
144 # whether the browser is in headless mode, and pass that
145 # knowledge down to this method.
146 'fromSurface': False
142 } 147 }
143 # "Google API are missing..." infobar might cause a viewport resize 148 # "Google API are missing..." infobar might cause a viewport resize
144 # which invalidates screenshot request. See crbug.com/459820. 149 # which invalidates screenshot request. See crbug.com/459820.
145 for _ in range(2): 150 for _ in range(2):
146 res = self._inspector_websocket.SyncRequest(request, timeout) 151 res = self._inspector_websocket.SyncRequest(request, timeout)
147 if res and ('result' in res) and ('data' in res['result']): 152 if res and ('result' in res) and ('data' in res['result']):
148 return image_util.FromBase64Png(res['result']['data']) 153 return image_util.FromBase64Png(res['result']['data'])
149 return None 154 return None
150 155
151 def CollectGarbage(self, timeout=60): 156 def CollectGarbage(self, timeout=60):
152 request = { 157 request = {
153 'method': 'HeapProfiler.collectGarbage' 158 'method': 'HeapProfiler.collectGarbage'
154 } 159 }
155 res = self._inspector_websocket.SyncRequest(request, timeout) 160 res = self._inspector_websocket.SyncRequest(request, timeout)
156 assert 'result' in res 161 assert 'result' in res
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