| OLD | NEW | 
|---|
| 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  Loading... | 
| 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   /** | 
| 35    * Browser to app launcher start page. | 46    * Browser to app launcher start page. | 
| 36    */ | 47    */ | 
| 37   browsePreload: 'chrome://app-list/', | 48   browsePreload: 'chrome://app-list/', | 
| 38 | 49 | 
| 39   /** | 50   /** | 
| 40    * Placeholder for mock speech recognizer. | 51    * Placeholder for mock speech recognizer. | 
| 41    */ | 52    */ | 
| 42   speechRecognizer: null, | 53   speechRecognizer: null, | 
| 43 | 54 | 
| 44   /** | 55   /** | 
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 116     window.AudioContext = mockAudioContext; | 127     window.AudioContext = mockAudioContext; | 
| 117     navigator.webkitGetUserMedia = this.mockGetUserMedia_.bind(this); | 128     navigator.webkitGetUserMedia = this.mockGetUserMedia_.bind(this); | 
| 118     this.audioTrackMocks = [mock(MediaStreamTrack), mock(MediaStreamTrack)]; | 129     this.audioTrackMocks = [mock(MediaStreamTrack), mock(MediaStreamTrack)]; | 
| 119   } | 130   } | 
| 120 }; | 131 }; | 
| 121 | 132 | 
| 122 TEST_F('AppListStartPageWebUITest', 'Basic', function() { | 133 TEST_F('AppListStartPageWebUITest', 'Basic', function() { | 
| 123   assertEquals(this.browsePreload, document.location.href); | 134   assertEquals(this.browsePreload, document.location.href); | 
| 124 }); | 135 }); | 
| 125 | 136 | 
|  | 137 TEST_F('AppListStartPageWebUITest', 'LoadDoodle', function() { | 
|  | 138   var doodle = $('doodle'); | 
|  | 139   assertEquals('', doodle.src); | 
|  | 140   appList.startPage.onAppListDoodleUpdated(this.doodleData_, | 
|  | 141                                            'http://example.com/'); | 
|  | 142   assertEquals('http://example.com/doodle.png', doodle.src); | 
|  | 143 }); | 
|  | 144 | 
| 126 TEST_F('AppListStartPageWebUITest', 'SpeechRecognitionState', function() { | 145 TEST_F('AppListStartPageWebUITest', 'SpeechRecognitionState', function() { | 
| 127   this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | 146   this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | 
| 128   appList.startPage.onAppListShown(); | 147   appList.startPage.onAppListShown(); | 
| 129   this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); | 148   this.mockHandler.expects(once()).setSpeechRecognitionState('RECOGNIZING'); | 
| 130   appList.startPage.toggleSpeechRecognition(); | 149   appList.startPage.toggleSpeechRecognition(); | 
| 131   Mock4JS.verifyAllMocks(); | 150   Mock4JS.verifyAllMocks(); | 
| 132   Mock4JS.clearMocksToVerify(); | 151   Mock4JS.clearMocksToVerify(); | 
| 133 | 152 | 
| 134   this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | 153   this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | 
| 135   for (var i = 0; i < this.audioTrackMocks.length; ++i) { | 154   for (var i = 0; i < this.audioTrackMocks.length; ++i) { | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 170   Mock4JS.verifyAllMocks(); | 189   Mock4JS.verifyAllMocks(); | 
| 171   Mock4JS.clearMocksToVerify(); | 190   Mock4JS.clearMocksToVerify(); | 
| 172 | 191 | 
| 173   this.mockHandler.expects(once()).speechResult('test,true'); | 192   this.mockHandler.expects(once()).speechResult('test,true'); | 
| 174   this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | 193   this.mockHandler.expects(once()).setSpeechRecognitionState('READY'); | 
| 175   for (var i = 0; i < this.audioTrackMocks.length; ++i) { | 194   for (var i = 0; i < this.audioTrackMocks.length; ++i) { | 
| 176     this.audioTrackMocks[i].expects(once()).stop(); | 195     this.audioTrackMocks[i].expects(once()).stop(); | 
| 177   } | 196   } | 
| 178   this.sendSpeechResult('test', true); | 197   this.sendSpeechResult('test', true); | 
| 179 }); | 198 }); | 
| OLD | NEW | 
|---|