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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/testing/fake_objects.js

Issue 484063003: Port braille related tests from ChromeVox upstream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Rename a fake class. Created 6 years, 3 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
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/testing/assert_additions.js ('k') | no next file » | 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 2014 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 * Fakes a Chrome event that supports one listener.
7 * @constructor
8 * @extends {ChromeEvent}
9 */
10 function FakeChromeEvent() {
11 /**
12 * @private
13 * @type {Function}
14 */
15 this.listener_ = null;
16 }
17
18 FakeChromeEvent.prototype = {
19 /**
20 * Fakes the corresponding call on a Chrome event. Sets the listener and
21 * fails the test if it is already set.
22 * @param {Function} listener The new listener.
23 */
24 addListener: function(listener) {
25 this.assertNoListener();
26 this.listener_ = listener;
27 },
28
29 /**
30 * Gets the listener of the event, failing the test if there's none.
31 * @return {Function} The event's listener.
32 */
33 getListener: function() {
34 assertNotEquals(null, this.listener_);
35 return this.listener_;
36 },
37
38 /**
39 * Asserts that this object doesn't have any listener added.
40 */
41 assertNoListener: function() {
42 assertEquals(null, this.listener_);
43 }
44 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/testing/assert_additions.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698