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

Side by Side 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, 2 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
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 /**
7 * @fileoverview Testing stub for messages.
8 */
9
10 goog.provide('cvox.TestMsgs');
11
12 goog.require('cvox.Msgs');
13 goog.require('cvox.TestMessages');
14
15
16 /**
17 * @constructor
18 * @extends {cvox.Msgs}
19 */
20 cvox.TestMsgs = function() {
21 cvox.Msgs.call(this);
22 };
23 goog.inherits(cvox.TestMsgs, cvox.Msgs);
24
25
26 /**
27 * @override
28 */
29 cvox.TestMsgs.prototype.getLocale = function() {
30 return 'testing';
31 };
32
33
34 /**
35 * @override
36 */
37 cvox.TestMsgs.prototype.getMsg = function(messageId, opt_subs) {
38 if (!messageId) {
39 throw Error('Message id required');
40 }
41 var message = cvox.TestMessages[('chromevox_' + messageId).toUpperCase()];
42 if (message == undefined) {
43 throw Error('missing-msg: ' + messageId);
44 }
45
46 var messageString = message.message;
47 if (opt_subs) {
48 // Unshift a null to make opt_subs and message.placeholders line up.
49 for (var i = 0; i < opt_subs.length; i++) {
50 messageString = messageString.replace('$' + (i + 1), opt_subs[i]);
51 }
52 }
53 return messageString;
54 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698