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

Side by Side Diff: chrome/test/data/webui/mock_timer.js

Issue 1150173003: Fix some JS style nits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 6 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 /** 5 /**
6 * Overrides timeout and interval callbacks to mock timing behavior. 6 * Overrides timeout and interval callbacks to mock timing behavior.
7 * @constructor 7 * @constructor
8 */ 8 */
9 function MockTimer() { 9 function MockTimer() {
10 /** 10 /**
11 * Default versions of the timing functions. 11 * Default versions of the timing functions.
12 * @type {Object.<string, !Function>} 12 * @type {Object<string, !Function>}
13 * @private 13 * @private
14 */ 14 */
15 this.originals_ = []; 15 this.originals_ = [];
16 16
17 /** 17 /**
18 * Key to assign on the next creation of a scheduled timer. Each call to 18 * Key to assign on the next creation of a scheduled timer. Each call to
19 * setTimeout or setInterval returns a unique key that can be used for 19 * setTimeout or setInterval returns a unique key that can be used for
20 * clearing the timer. 20 * clearing the timer.
21 * @type {number} 21 * @type {number}
22 * @private 22 * @private
23 */ 23 */
24 this.nextTimerKey_ = 1; 24 this.nextTimerKey_ = 1;
25 25
26 /** 26 /**
27 * Details for active timers. 27 * Details for active timers.
28 * @type {Array.<{callback: Function, 28 * @type {Array<{callback: Function,
29 * delay: number, 29 * delay: number,
30 * key: number, 30 * key: number,
31 * repeats: boolean}>} 31 * repeats: boolean}>}
32 * @private 32 * @private
33 */ 33 */
34 this.timers_ = []; 34 this.timers_ = [];
35 35
36 /** 36 /**
37 * List of scheduled tasks. 37 * List of scheduled tasks.
38 * @type {Array.<{when: number, key: number}>} 38 * @type {Array<{when: number, key: number}>}
39 * @private 39 * @private
40 */ 40 */
41 this.schedule_ = []; 41 this.schedule_ = [];
42 42
43 /** 43 /**
44 * Virtual elapsed time in milliseconds. 44 * Virtual elapsed time in milliseconds.
45 * @type {number} 45 * @type {number}
46 * @private 46 * @private
47 */ 47 */
48 this.now_ = 0; 48 this.now_ = 0;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 details.callback.apply(window); 200 details.callback.apply(window);
201 if (details.repeats) 201 if (details.repeats)
202 this.scheduleTask_(details); 202 this.scheduleTask_(details);
203 else 203 else
204 this.clearTimeout_(details.key); 204 this.clearTimeout_(details.key);
205 } 205 }
206 this.now_ = this.until_; 206 this.now_ = this.until_;
207 }, 207 },
208 208
209 }; 209 };
OLDNEW
« no previous file with comments | « chrome/test/data/webui/mock_controller.js ('k') | chrome/test/data/webui/net_internals/events_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698