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

Unified Diff: chrome/browser/resources/chromeos/chromevox/host/chrome/braille.js

Issue 1302763002: Add tests for braille commands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@js2gtesterr
Patch Set: Document gn template args, rename extra_gen_files to gen_include_files Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/chromevox/host/chrome/braille.js
diff --git a/chrome/browser/resources/chromeos/chromevox/host/chrome/braille.js b/chrome/browser/resources/chromeos/chromevox/host/chrome/braille.js
index 7683ae8adc8410aee78487a0d28bed983dc83f47..35a1d684cfa51e51bff6f2efea330021215704e1 100644
--- a/chrome/browser/resources/chromeos/chromevox/host/chrome/braille.js
+++ b/chrome/browser/resources/chromeos/chromevox/host/chrome/braille.js
@@ -10,7 +10,7 @@
goog.provide('cvox.ChromeBraille');
-goog.require('cvox.AbstractBraille');
+goog.require('cvox.BrailleInterface');
goog.require('cvox.BrailleKeyEvent');
goog.require('cvox.ChromeVoxUserCommands');
goog.require('cvox.HostFactory');
@@ -18,15 +18,9 @@ goog.require('cvox.HostFactory');
/**
* @constructor
- * @extends {cvox.AbstractBraille}
+ * @implements {cvox.BrailleInterface}
*/
cvox.ChromeBraille = function() {
- goog.base(this);
- /**
- * @type {function(!cvox.BrailleKeyEvent, cvox.NavBraille)}
- * @private
- */
- this.commandListener_ = this.defaultCommandListener_;
/**
* @type {cvox.NavBraille}
* @private
@@ -57,11 +51,10 @@ cvox.ChromeBraille = function() {
if (msg['contentId'] == this.lastContentId_) {
content = this.lastContent_;
}
- this.commandListener_(msg['args'], content);
+ this.onKeyEvent_(msg['args'], content);
}
}, this));
};
-goog.inherits(cvox.ChromeBraille, cvox.AbstractBraille);
/** @override */
@@ -86,12 +79,6 @@ cvox.ChromeBraille.prototype.updateLastContentId_ = function() {
};
-/** @override */
-cvox.ChromeBraille.prototype.setCommandListener = function(func) {
- this.commandListener_ = func;
-};
-
-
/**
* Dispatches braille input commands.
* @param {!cvox.BrailleKeyEvent} brailleEvt The braille key event.
@@ -99,7 +86,7 @@ cvox.ChromeBraille.prototype.setCommandListener = function(func) {
* if available.
* @private
*/
-cvox.ChromeBraille.prototype.defaultCommandListener_ = function(brailleEvt,
+cvox.ChromeBraille.prototype.onKeyEvent_ = function(brailleEvt,
content) {
var command = cvox.ChromeVoxUserCommands.commands[brailleEvt.command];
if (command) {
@@ -110,5 +97,14 @@ cvox.ChromeBraille.prototype.defaultCommandListener_ = function(brailleEvt,
};
+/**
+ * Overrides the key event handler
+ * @param {function(!cvox.BrailleKeyEvent, cvox.NavBraille):void} listener
+ */
+cvox.ChromeBraille.prototype.setKeyEventHandlerForTest = function(listener) {
+ this.onKeyEvent_ = listener;
+};
+
+
/** Export platform constructor. */
cvox.HostFactory.brailleConstructor = cvox.ChromeBraille;

Powered by Google App Engine
This is Rietveld 408576698