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

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

Issue 3018603002: Add tab.StopAllServiceWorkers() (Closed)
Patch Set: edit comment Created 3 years, 2 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
OLDNEW
(Empty)
1 # Copyright 2017 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 from telemetry.core import exceptions
6
7
8 class InspectorServiceWorker(object):
9 def __init__(self, inspector_websocket, timeout):
10 self._websocket = inspector_websocket
11 self._websocket.RegisterDomain('ServiceWorker', self._OnNotification)
12 # ServiceWorker.enable RPC must be called before calling any other methods
13 # in ServiceWorker domain.
14 res = self._websocket.SyncRequest(
15 {'method': 'ServiceWorker.enable'}, timeout)
16 if 'error' in res:
17 raise exceptions.StoryActionError(res['error']['message'])
18
19 def _OnNotification(self, msg):
20 # TODO: track service worker events
21 # (https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker/)
22 pass
23
24 def StopAllWorkers(self, timeout):
25 res = self._websocket.SyncRequest(
26 {'method': 'ServiceWorker.stopAllWorkers'}, timeout)
27 if 'error' in res:
28 raise exceptions.StoryActionError(res['error']['message'])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698