Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / chromeos / chromevox / testing / spoken_list_builder.js
1 // Copyright 2013 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  * @fileoverview The spoken list builder. Used in test cases.
7  */
8
9 goog.provide('cvox.SpokenListBuilder');
10 goog.require('cvox.QueueMode');
11
12
13 /**
14  * Builds a spoken list.
15  * @constructor
16  */
17 cvox.SpokenListBuilder = function() {
18   this.list_ = [];
19 };
20
21
22 /**
23  * Adds an expected flushed utterance to the builder.
24  * @param {string} expectedText The expected text.
25  * @return {cvox.SpokenListBuilder} this.
26  */
27 cvox.SpokenListBuilder.prototype.flush = function(expectedText) {
28   this.list_.push([expectedText, cvox.QueueMode.FLUSH]);
29   return this;  // for chaining
30 };
31
32
33 /**
34  * Adds an expected queued utterance to the builder.
35  * @param {string} expectedText The expected text.
36  * @return {cvox.SpokenListBuilder} this.
37  */
38 cvox.SpokenListBuilder.prototype.queue = function(expectedText) {
39   this.list_.push([expectedText, cvox.QueueMode.QUEUE]);
40   return this;  // for chaining
41 };
42
43
44 /**
45  * Adds an expected category-flush utterance to the builder.
46  * @param {string} expectedText The expected text.
47  * @return {cvox.SpokenListBuilder} this.
48  */
49 cvox.SpokenListBuilder.prototype.categoryFlush = function(expectedText) {
50   this.list_.push([expectedText, cvox.QueueMode.CATEGORY_FLUSH]);
51   return this;  // for chaining
52 };
53
54
55 /**
56  * Builds the list.
57  * @return {Array} The array of utterances.
58  */
59 cvox.SpokenListBuilder.prototype.build = function() {
60   return this.list_;
61 };