OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 cr.define('settings_people_page_change_picture', function() { | 5 cr.define('settings_people_page_change_picture', function() { |
6 /** | 6 /** |
7 * @constructor | 7 * @constructor |
8 * @implements {settings.ChangePictureBrowserProxy} | 8 * @implements {settings.ChangePictureBrowserProxy} |
9 * @extends {settings.TestBrowserProxy} | 9 * @extends {settings.TestBrowserProxy} |
10 */ | 10 */ |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 return browserProxy.whenCalled('selectDefaultImage').then( | 194 return browserProxy.whenCalled('selectDefaultImage').then( |
195 function(args) { | 195 function(args) { |
196 expectEquals('chrome://foo/1.png', args[0]); | 196 expectEquals('chrome://foo/1.png', args[0]); |
197 | 197 |
198 Polymer.dom.flush(); | 198 Polymer.dom.flush(); |
199 expectEquals(ChangePictureSelectionTypes.DEFAULT, | 199 expectEquals(ChangePictureSelectionTypes.DEFAULT, |
200 changePicture.selectedItem_.dataset.type); | 200 changePicture.selectedItem_.dataset.type); |
201 expectEquals(firstDefaultImage, changePicture.selectedItem_); | 201 expectEquals(firstDefaultImage, changePicture.selectedItem_); |
202 expectFalse(settingsCamera.cameraActive); | 202 expectFalse(settingsCamera.cameraActive); |
203 expectTrue(discardControlBar.hidden); | 203 expectTrue(discardControlBar.hidden); |
| 204 |
| 205 // Now verify that arrow keys actually select the new image. |
| 206 browserProxy.resetResolver('selectDefaultImage'); |
| 207 MockInteractions.pressAndReleaseKeyOn( |
| 208 changePicture.selectedItem_, 39 /* right */); |
| 209 return browserProxy.whenCalled('selectDefaultImage'); |
| 210 }).then(function(args) { |
| 211 expectEquals('chrome://foo/2.png', args[0]); |
204 }); | 212 }); |
205 }); | 213 }); |
206 | 214 |
207 test('ChangePictureRestoreImageAfterDiscard', function() { | 215 test('ChangePictureRestoreImageAfterDiscard', function() { |
208 var firstDefaultImage = changePicture.$$('img[data-type="default"]'); | 216 var firstDefaultImage = changePicture.$$('img[data-type="default"]'); |
209 assertTrue(!!firstDefaultImage); | 217 assertTrue(!!firstDefaultImage); |
210 var discardOldImage = changePicture.$.discardOldImage; | 218 var discardOldImage = changePicture.$.discardOldImage; |
211 assertTrue(!!discardOldImage); | 219 assertTrue(!!discardOldImage); |
212 | 220 |
213 MockInteractions.tap(firstDefaultImage); | 221 MockInteractions.tap(firstDefaultImage); |
(...skipping 16 matching lines...) Expand all Loading... |
230 }); | 238 }); |
231 }); | 239 }); |
232 } | 240 } |
233 | 241 |
234 return { | 242 return { |
235 registerTests: function() { | 243 registerTests: function() { |
236 registerChangePictureTests(); | 244 registerChangePictureTests(); |
237 }, | 245 }, |
238 }; | 246 }; |
239 }); | 247 }); |
OLD | NEW |