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 /** |
| 6 * @fileoverview A class that mediates window timer calls to support mockability |
| 7 * in tests. |
| 8 */ |
| 9 |
| 10 cr.define('bookmarks', function() { |
| 11 /** @constructor */ |
| 12 function TimerProxy() {} |
| 13 |
| 14 TimerProxy.prototype = { |
| 15 /** |
| 16 * @param {Function|string} fn |
| 17 * @param {number=} delay |
| 18 * @return {number} |
| 19 */ |
| 20 setTimeout: function(fn, delay) { |
| 21 return window.setTimeout(fn, delay); |
| 22 }, |
| 23 |
| 24 /** @param {number|undefined?} id */ |
| 25 clearTimeout: function(id) { |
| 26 window.clearTimeout(id); |
| 27 }, |
| 28 }; |
| 29 |
| 30 return { |
| 31 TimerProxy: TimerProxy, |
| 32 }; |
| 33 }); |
OLD | NEW |