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

Side by Side Diff: telemetry/telemetry/internal/browser/tab.py

Issue 3018603002: Add tab.StopAllServiceWorkers() (Closed)
Patch Set: add comments 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 # Copyright 2012 The Chromium Authors. All rights reserved. 1 # Copyright 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 4
5 from telemetry.internal.actions import action_runner 5 from telemetry.internal.actions import action_runner
6 from telemetry.internal.browser import web_contents 6 from telemetry.internal.browser import web_contents
7 from telemetry.internal.image_processing import video 7 from telemetry.internal.image_processing import video
8 from telemetry.core import exceptions 8 from telemetry.core import exceptions
9 9
10 DEFAULT_TAB_TIMEOUT = 60 10 DEFAULT_TAB_TIMEOUT = 60
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 if (window.chrome && chrome.benchmarking && 267 if (window.chrome && chrome.benchmarking &&
268 chrome.benchmarking.clearCache) { 268 chrome.benchmarking.clearCache) {
269 chrome.benchmarking.clearCache(); 269 chrome.benchmarking.clearCache();
270 chrome.benchmarking.clearPredictorCache(); 270 chrome.benchmarking.clearPredictorCache();
271 chrome.benchmarking.clearHostResolverCache(); 271 chrome.benchmarking.clearHostResolverCache();
272 } 272 }
273 """) 273 """)
274 if force: 274 if force:
275 self.Navigate('about:blank') 275 self.Navigate('about:blank')
276 276
277 def ClearDataForOrigin(self, url, timeout=DEFAULT_TAB_TIMEOUT): 277 def ClearDataForOrigin(self, url, timeout=DEFAULT_TAB_TIMEOUT):
nednguyen 2017/09/22 11:11:31 I will make a CL to refactor this to inspector_bac
278 """Clears storage data for the origin of url. 278 """Clears storage data for the origin of url.
279 279
280 With assigning 'all' to params.storageTypes, Storage.clearDataForOrigin 280 With assigning 'all' to params.storageTypes, Storage.clearDataForOrigin
281 clears all storage of app cache, cookies, file systems, indexed db, 281 clears all storage of app cache, cookies, file systems, indexed db,
282 local storage, shader cache, web sql, service workers and cache storage. 282 local storage, shader cache, web sql, service workers and cache storage.
283 See StorageHandler::ClearDataForOrigin() for more details. 283 See StorageHandler::ClearDataForOrigin() for more details.
284 284
285 Raises: 285 Raises:
286 exceptions.StoryActionError 286 exceptions.StoryActionError
287 """ 287 """
288 res = self._inspector_backend._websocket.SyncRequest({ 288 res = self._inspector_backend._websocket.SyncRequest({
289 'method': 'Storage.clearDataForOrigin', 289 'method': 'Storage.clearDataForOrigin',
290 'params': { 290 'params': {
291 'origin': url, 291 'origin': url,
292 'storageTypes': 'all' 292 'storageTypes': 'all'
293 } 293 }
294 }, timeout) 294 }, timeout)
295 if 'error' in res: 295 if 'error' in res:
296 raise exceptions.StoryActionError(res['error']['message']) 296 raise exceptions.StoryActionError(res['error']['message'])
297
298 def EnableServiceWorker(self, timeout=DEFAULT_TAB_TIMEOUT):
nednguyen 2017/09/22 11:07:34 Can you move these to inspector_backend? Then thes
yukiy 2017/09/25 01:23:13 Done.
299 """Enables devtools for ServiceWorker domain.
300
301 Raises:
302 exceptions.StoryActionError
303 """
304 res = self._inspector_backend._websocket.SyncRequest({
305 'method': 'ServiceWorker.enable'
306 }, timeout)
307 if 'error' in res:
308 raise exceptions.StoryActionError(res['error']['message'])
309
310 def StopServiceWorker(self, timeout=DEFAULT_TAB_TIMEOUT):
311 """Stops all service workers.
312
313 Raises:
314 exceptions.StoryActionError
315 """
316 res = self._inspector_backend._websocket.SyncRequest({
317 'method': 'ServiceWorker.stopAllWorkers'
318 }, timeout)
319 if 'error' in res:
320 raise exceptions.StoryActionError(res['error']['message'])
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