| 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;
|
| +};
|
|
|