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

Side by Side Diff: chrome/browser/ui/webui/app_list/start_page_browsertest.js

Issue 887853003: Make app list start page doodle clickable and have alt text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@doodle_static
Patch Set: address comments Created 5 years, 10 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * TestFixture for kiosk app settings WebUI testing. 6 * TestFixture for kiosk app settings WebUI testing.
7 * @extends {testing.Test} 7 * @extends {testing.Test}
8 * @constructor 8 * @constructor
9 */ 9 */
10 function AppListStartPageWebUITest() {} 10 function AppListStartPageWebUITest() {}
(...skipping 14 matching lines...) Expand all
25 createScriptProcessor: function(bufSize, in_channels, out_channels) { 25 createScriptProcessor: function(bufSize, in_channels, out_channels) {
26 return {connect: function(destination) {}, 26 return {connect: function(destination) {},
27 disconnect: function() {}}; 27 disconnect: function() {}};
28 } 28 }
29 }; 29 };
30 30
31 AppListStartPageWebUITest.prototype = { 31 AppListStartPageWebUITest.prototype = {
32 __proto__: testing.Test.prototype, 32 __proto__: testing.Test.prototype,
33 33
34 /** 34 /**
35 * Sample doodle data.
36 */
37 doodleData_: {
38 'ddljson': {
39 'transparent_large_image': {
40 'url': 'doodle.png'
41 }
42 }
43 },
44
45 /**
46 * Browser to app launcher start page. 35 * Browser to app launcher start page.
47 */ 36 */
48 browsePreload: 'chrome://app-list/', 37 browsePreload: 'chrome://app-list/',
49 38
50 /** 39 /**
51 * Placeholder for mock speech recognizer. 40 * Placeholder for mock speech recognizer.
52 */ 41 */
53 speechRecognizer: null, 42 speechRecognizer: null,
54 43
55 /** 44 /**
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 navigator.webkitGetUserMedia = this.mockGetUserMedia_.bind(this); 117 navigator.webkitGetUserMedia = this.mockGetUserMedia_.bind(this);
129 this.audioTrackMocks = [mock(MediaStreamTrack), mock(MediaStreamTrack)]; 118 this.audioTrackMocks = [mock(MediaStreamTrack), mock(MediaStreamTrack)];
130 } 119 }
131 }; 120 };
132 121
133 TEST_F('AppListStartPageWebUITest', 'Basic', function() { 122 TEST_F('AppListStartPageWebUITest', 'Basic', function() {
134 assertEquals(this.browsePreload, document.location.href); 123 assertEquals(this.browsePreload, document.location.href);
135 }); 124 });
136 125
137 TEST_F('AppListStartPageWebUITest', 'LoadDoodle', function() { 126 TEST_F('AppListStartPageWebUITest', 'LoadDoodle', function() {
138 var doodle = $('doodle'); 127 var doodleData = {
139 assertEquals('', doodle.src); 128 'ddljson': {
140 appList.startPage.onAppListDoodleUpdated(this.doodleData_, 129 'transparent_large_image': {
130 'url': 'doodle.png'
131 },
132 'alt_text': 'Doodle alt text',
133 'target_url': '/target.html'
134 }
135 };
136
137 assertEquals(null, $('doodle'));
138
139 // Load the doodle with a target url and alt text.
140 appList.startPage.onAppListDoodleUpdated(doodleData,
141 'http://example.com/x/');
142 assertNotEquals(null, $('doodle'));
143 assertEquals('http://example.com/x/doodle.png', $('doodle_image').src);
144 assertEquals(doodleData.ddljson.alt_text, $('doodle_image').title);
145 assertEquals('http://example.com/target.html', $('doodle_link').href);
146
147 // Reload the doodle without a target url and alt text.
148 doodleData.ddljson.alt_text = undefined;
149 doodleData.ddljson.target_url = undefined;
150 appList.startPage.onAppListDoodleUpdated(doodleData,
151 'http://example.com/x/');
152 assertNotEquals(null, $('doodle'));
153 assertEquals('http://example.com/x/doodle.png', $('doodle_image').src);
154 assertEquals('', $('doodle_image').title);
155 assertEquals(null, $('doodle_link'));
156
157
158 appList.startPage.onAppListDoodleUpdated({},
141 'http://example.com/'); 159 'http://example.com/');
142 assertEquals('http://example.com/doodle.png', doodle.src); 160 assertEquals(null, $('doodle'));
143 }); 161 });
144 162
145 TEST_F('AppListStartPageWebUITest', 'SpeechRecognitionState', function() { 163 TEST_F('AppListStartPageWebUITest', 'SpeechRecognitionState', function() {
146 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); 164 this.mockHandler.expects(once()).setSpeechRecognitionState('READY');
147 appList.startPage.onAppListShown(); 165 appList.startPage.onAppListShown();
148 this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); 166 this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING');
149 appList.startPage.toggleSpeechRecognition(); 167 appList.startPage.toggleSpeechRecognition();
150 Mock4JS.verifyAllMocks(); 168 Mock4JS.verifyAllMocks();
151 Mock4JS.clearMocksToVerify(); 169 Mock4JS.clearMocksToVerify();
152 170
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 Mock4JS.verifyAllMocks(); 207 Mock4JS.verifyAllMocks();
190 Mock4JS.clearMocksToVerify(); 208 Mock4JS.clearMocksToVerify();
191 209
192 this.mockHandler.expects(once()).speechResult('test,true'); 210 this.mockHandler.expects(once()).speechResult('test,true');
193 this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); 211 this.mockHandler.expects(once()).setSpeechRecognitionState('READY');
194 for (var i = 0; i < this.audioTrackMocks.length; ++i) { 212 for (var i = 0; i < this.audioTrackMocks.length; ++i) {
195 this.audioTrackMocks[i].expects(once()).stop(); 213 this.audioTrackMocks[i].expects(once()).stop();
196 } 214 }
197 this.sendSpeechResult('test', true); 215 this.sendSpeechResult('test', true);
198 }); 216 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698