OLD | NEW |
---|---|
(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): | |
10 self._websocket = inspector_websocket | |
11 self._websocket.RegisterDomain('ServiceWorker', self._OnNotification) | |
kouhei (in TOK)
2017/09/25 02:29:25
Should we just enable ServiceWorker here?
yukiy
2017/09/25 04:57:13
Done.
| |
12 | |
13 def _OnNotification(self, msg): | |
14 # TODO: track service worker events | |
15 # (https://chromedevtools.github.io/devtools-protocol/tot/ServiceWorker/) | |
16 pass | |
17 | |
18 def Enable(self, timeout): | |
19 # This method must be called before calling any other methods in | |
20 # InspectorServiceWorker. | |
21 res = self._websocket.SyncRequest( | |
22 {'method': 'ServiceWorker.enable'}, timeout) | |
23 if 'error' in res: | |
24 raise exceptions.StoryActionError(res['error']['message']) | |
25 | |
26 def StopAllWorkers(self, timeout): | |
27 res = self._websocket.SyncRequest( | |
28 {'method': 'ServiceWorker.stopAllWorkers'}, timeout) | |
29 if 'error' in res: | |
30 raise exceptions.StoryActionError(res['error']['message']) | |
OLD | NEW |