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

Side by Side Diff: chrome/test/data/extensions/api_test/service_worker/sync/sw.js

Issue 1445603003: Extension SW - add test for ServiceWorkerRegistration.sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix after r360068 Created 5 years, 1 month 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 2015 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 var port = null;
6 this.onsync = function(e) {
7 if (port) {
8 e.waitUntil(new Promise(function(resolve) {
9 // Add a small delay to respond so we can exercise and test the
10 // offline->online transition.
11 // NOTE: the following 5ms delay is not a requirement for this test. It is
Devlin 2015/11/17 19:21:17 I still don't really like the 5ms delay here. If
lazyboy 2015/11/17 21:41:28 Changed to 0ms. Done.
12 // here to just demonstrate that the test passes with a bit of asynchrony.
13 setTimeout(function() {
14 port.postMessage('SYNC: ' + e.tag);
15 resolve();
16 }, 5);
17 }));
18 }
19 };
20
21 this.onmessage = function(e) {
22 port = e.ports[0];
23 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698