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

Unified Diff: chrome/browser/resources/chromeos/chromevox/testing/test_msgs.js

Issue 593133002: Refactor: remove a Chromevox abstract class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/chromevox/testing/test_msgs.js
diff --git a/chrome/browser/resources/chromeos/chromevox/testing/test_msgs.js b/chrome/browser/resources/chromeos/chromevox/testing/test_msgs.js
new file mode 100644
index 0000000000000000000000000000000000000000..d76c16dc1c49deff24b2765082ca7f4f4203ed32
--- /dev/null
+++ b/chrome/browser/resources/chromeos/chromevox/testing/test_msgs.js
@@ -0,0 +1,54 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+/**
+ * @fileoverview Testing stub for messages.
+ */
+
+goog.provide('cvox.TestMsgs');
+
+goog.require('cvox.Msgs');
+goog.require('cvox.TestMessages');
+
+
+/**
+ * @constructor
+ * @extends {cvox.Msgs}
+ */
+cvox.TestMsgs = function() {
+ cvox.Msgs.call(this);
+};
+goog.inherits(cvox.TestMsgs, cvox.Msgs);
+
+
+/**
+ * @override
+ */
+cvox.TestMsgs.prototype.getLocale = function() {
+ return 'testing';
+};
+
+
+/**
+ * @override
+ */
+cvox.TestMsgs.prototype.getMsg = function(messageId, opt_subs) {
+ if (!messageId) {
+ throw Error('Message id required');
+ }
+ var message = cvox.TestMessages[('chromevox_' + messageId).toUpperCase()];
+ if (message == undefined) {
+ throw Error('missing-msg: ' + messageId);
+ }
+
+ var messageString = message.message;
+ if (opt_subs) {
+ // Unshift a null to make opt_subs and message.placeholders line up.
+ for (var i = 0; i < opt_subs.length; i++) {
+ messageString = messageString.replace('$' + (i + 1), opt_subs[i]);
+ }
+ }
+ return messageString;
+};

Powered by Google App Engine
This is Rietveld 408576698