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

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

Issue 1532503003: Add FakeChromeEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years 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
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/cr_settings_browsertest.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /**
6 * @fileoverview Fake implementations of ChromeEvent.
7 */
8
9 /**
10 * @constructor
11 * @extends {ChromeEvent}
12 */
13 function FakeChromeEvent() {
14 /** @type {!Set<!Function>} */
15 this.listeners_ = new Set();
16 }
17
18 FakeChromeEvent.prototype = {
19 /** @param {Function} listener */
20 addListener: function(listener) {
21 assertFalse(this.listeners_.has(listener));
22 this.listeners_.add(listener);
23 },
24
25 /** @param {Function} listener */
26 removeListener: function(listener) {
27 assertTrue(this.listeners_.has(listener));
28 this.listeners_.delete(listener);
29 },
30
31 /** @param {...} args */
32 callListeners: function(...args) {
michaelpg 2015/12/17 23:26:20 var_args
stevenjb 2015/12/18 01:34:46 Done.
33 this.listeners_.forEach(function(l) {
34 l.apply(null, args);
35 });
36 }
37 };
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/cr_settings_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698