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

Side by Side Diff: ui/file_manager/integration_tests/gallery/thumbnail_mode.js

Issue 2046143002: Send 'key' from fake keyboard events generated by file_manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix additional tests I missed Created 4 years, 6 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 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 /** 5 /**
6 * Additional test image entry. 6 * Additional test image entry.
7 */ 7 */
8 ENTRIES.image4 = new TestEntryInfo( 8 ENTRIES.image4 = new TestEntryInfo(
9 EntryType.FILE, 'image3.jpg', 'image4.jpg', 9 EntryType.FILE, 'image3.jpg', 'image4.jpg',
10 'image/jpeg', SharedOption.NONE, 'Jan 18, 2038, 1:02 AM', 10 'image/jpeg', SharedOption.NONE, 'Jan 18, 2038, 1:02 AM',
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 break; 83 break;
84 case 'enter-key': 84 case 'enter-key':
85 // Press enter key on delete button. 85 // Press enter key on delete button.
86 return gallery.waitForElement( 86 return gallery.waitForElement(
87 appId, 'button.delete').then(function() { 87 appId, 'button.delete').then(function() {
88 return gallery.callRemoteTestUtil( 88 return gallery.callRemoteTestUtil(
89 'focus', appId, ['button.delete']); 89 'focus', appId, ['button.delete']);
90 }).then(function() { 90 }).then(function() {
91 return gallery.callRemoteTestUtil( 91 return gallery.callRemoteTestUtil(
92 'fakeKeyDown', appId, 92 'fakeKeyDown', appId,
93 ['button.delete', 'Enter', false, false, false]); 93 ['button.delete', 'Enter', 'Enter', false, false, false]);
94 }).then(function() { 94 }).then(function() {
95 // When user has pressed enter key on button, click event is 95 // When user has pressed enter key on button, click event is
96 // dispatched after keydown event. 96 // dispatched after keydown event.
97 return gallery.callRemoteTestUtil( 97 return gallery.callRemoteTestUtil(
98 'fakeEvent', appId, ['button.delete', 'click']); 98 'fakeEvent', appId, ['button.delete', 'click']);
99 }); 99 });
100 break; 100 break;
101 case 'delete-key': 101 case 'delete-key':
102 // Press delete key. 102 // Press delete key.
103 return gallery.callRemoteTestUtil( 103 return gallery.callRemoteTestUtil(
104 'fakeKeyDown', appId, 104 'fakeKeyDown', appId,
105 ['body', 'U+007F' /* Delete */, false, false, false]); 105 ['body', 'Delete', 'U+007F' /* Delete */, false, false, false]);
106 break; 106 break;
107 } 107 }
108 }).then(function(result) { 108 }).then(function(result) {
109 chrome.test.assertTrue(!!result); 109 chrome.test.assertTrue(!!result);
110 // Wait and click delete button of confirmation dialog. 110 // Wait and click delete button of confirmation dialog.
111 return gallery.waitAndClickElement(appId, '.cr-dialog-ok'); 111 return gallery.waitAndClickElement(appId, '.cr-dialog-ok');
112 }).then(function(result) { 112 }).then(function(result) {
113 chrome.test.assertTrue(!!result); 113 chrome.test.assertTrue(!!result);
114 // Wait until error banner is shown. 114 // Wait until error banner is shown.
115 return gallery.waitForElement(appId, '.gallery[error] .error-banner'); 115 return gallery.waitForElement(appId, '.gallery[error] .error-banner');
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Confirm that image3 is selected first: [1] 2 3 185 // Confirm that image3 is selected first: [1] 2 3
186 return gallery.callRemoteTestUtil('queryAllElements', appId, 186 return gallery.callRemoteTestUtil('queryAllElements', appId,
187 ['.thumbnail-view > ul > li.selected']); 187 ['.thumbnail-view > ul > li.selected']);
188 }).then(function(results) { 188 }).then(function(results) {
189 chrome.test.assertEq(1, results.length); 189 chrome.test.assertEq(1, results.length);
190 chrome.test.assertEq('image3.jpg', 190 chrome.test.assertEq('image3.jpg',
191 results[0].attributes['title']); 191 results[0].attributes['title']);
192 192
193 // Press Right key with shift. 193 // Press Right key with shift.
194 return gallery.fakeKeyDown( 194 return gallery.fakeKeyDown(
195 appId, '.thumbnail-view', 'Right', false, true /* Shift */, false); 195 appId, '.thumbnail-view', 'ArrowRight', 'Right', false,
196 true /* Shift */, false);
196 }).then(function() { 197 }).then(function() {
197 // Confirm 2 images are selected: [1][2] 3 198 // Confirm 2 images are selected: [1][2] 3
198 return gallery.callRemoteTestUtil('queryAllElements', appId, 199 return gallery.callRemoteTestUtil('queryAllElements', appId,
199 ['.thumbnail-view > ul > li.selected']); 200 ['.thumbnail-view > ul > li.selected']);
200 }).then(function(results) { 201 }).then(function(results) {
201 chrome.test.assertEq(2, results.length); 202 chrome.test.assertEq(2, results.length);
202 chrome.test.assertEq('image3.jpg', results[0].attributes['title']); 203 chrome.test.assertEq('image3.jpg', results[0].attributes['title']);
203 chrome.test.assertEq('image4.jpg', results[1].attributes['title']); 204 chrome.test.assertEq('image4.jpg', results[1].attributes['title']);
204 205
205 // Press Right key with shift. 206 // Press Right key with shift.
206 return gallery.fakeKeyDown( 207 return gallery.fakeKeyDown(
207 appId, '.thumbnail-view', 'Right', false, true /* Shift */, false); 208 appId, '.thumbnail-view', 'ArrowRight', 'Right', false,
209 true /* Shift */, false);
208 }).then(function() { 210 }).then(function() {
209 // Confirm 3 images are selected: [1][2][3] 211 // Confirm 3 images are selected: [1][2][3]
210 return gallery.callRemoteTestUtil('queryAllElements', appId, 212 return gallery.callRemoteTestUtil('queryAllElements', appId,
211 ['.thumbnail-view > ul > li.selected']); 213 ['.thumbnail-view > ul > li.selected']);
212 }).then(function(results) { 214 }).then(function(results) {
213 chrome.test.assertEq(3, results.length); 215 chrome.test.assertEq(3, results.length);
214 chrome.test.assertEq('image3.jpg', results[0].attributes['title']); 216 chrome.test.assertEq('image3.jpg', results[0].attributes['title']);
215 chrome.test.assertEq('image4.jpg', results[1].attributes['title']); 217 chrome.test.assertEq('image4.jpg', results[1].attributes['title']);
216 chrome.test.assertEq('My Desktop Background.png', 218 chrome.test.assertEq('My Desktop Background.png',
217 results[2].attributes['title']); 219 results[2].attributes['title']);
218 220
219 // Press Left key with shift. 221 // Press Left key with shift.
220 return gallery.fakeKeyDown( 222 return gallery.fakeKeyDown(
221 appId, '.thumbnail-view', 'Left', false, true /* Shift */, false); 223 appId, '.thumbnail-view', 'ArrowLeft', 'Left', false,
224 true /* Shift */, false);
222 }).then(function() { 225 }).then(function() {
223 // Confirm 2 images are selected: [1][2] 3 226 // Confirm 2 images are selected: [1][2] 3
224 return gallery.callRemoteTestUtil('queryAllElements', appId, 227 return gallery.callRemoteTestUtil('queryAllElements', appId,
225 ['.thumbnail-view > ul > li.selected']); 228 ['.thumbnail-view > ul > li.selected']);
226 }).then(function(results) { 229 }).then(function(results) {
227 chrome.test.assertEq(2, results.length); 230 chrome.test.assertEq(2, results.length);
228 chrome.test.assertEq('image3.jpg', results[0].attributes['title']); 231 chrome.test.assertEq('image3.jpg', results[0].attributes['title']);
229 chrome.test.assertEq('image4.jpg', results[1].attributes['title']); 232 chrome.test.assertEq('image4.jpg', results[1].attributes['title']);
230 233
231 // Press Right key without shift. 234 // Press Right key without shift.
232 return gallery.fakeKeyDown( 235 return gallery.fakeKeyDown(
233 appId, '.thumbnail-view', 'Right', false, false, false); 236 appId, '.thumbnail-view', 'ArrowRight', 'Right', false,
237 false, false);
234 }).then(function() { 238 }).then(function() {
235 // Confirm only the last image is selected: 1 2 [3] 239 // Confirm only the last image is selected: 1 2 [3]
236 return gallery.callRemoteTestUtil('queryAllElements', appId, 240 return gallery.callRemoteTestUtil('queryAllElements', appId,
237 ['.thumbnail-view > ul > li.selected']); 241 ['.thumbnail-view > ul > li.selected']);
238 }).then(function(results) { 242 }).then(function(results) {
239 chrome.test.assertEq(1, results.length); 243 chrome.test.assertEq(1, results.length);
240 chrome.test.assertEq('My Desktop Background.png', 244 chrome.test.assertEq('My Desktop Background.png',
241 results[0].attributes['title']); 245 results[0].attributes['title']);
242 }); 246 });
243 } 247 }
(...skipping 24 matching lines...) Expand all
268 return gallery.waitForSlideImage(appId, 640, 480, 'image4'); 272 return gallery.waitForSlideImage(appId, 640, 480, 'image4');
269 }).then(function() { 273 }).then(function() {
270 // Press thumbnail mode button. 274 // Press thumbnail mode button.
271 return gallery.waitAndClickElement(appId, 'button.mode'); 275 return gallery.waitAndClickElement(appId, 'button.mode');
272 }).then(function() { 276 }).then(function() {
273 // Confirm mode has been changed to thumbnail mode. 277 // Confirm mode has been changed to thumbnail mode.
274 return gallery.waitForElement(appId, '.gallery[mode="thumbnail"]'); 278 return gallery.waitForElement(appId, '.gallery[mode="thumbnail"]');
275 }).then(function() { 279 }).then(function() {
276 // Press Ctrl+A to select all images. 280 // Press Ctrl+A to select all images.
277 return gallery.fakeKeyDown(appId, '.thumbnail-view', 281 return gallery.fakeKeyDown(appId, '.thumbnail-view',
278 'U+0041' /* A */, true /* Ctrl*/, false /* Shift */, false /* Alt */); 282 'a', 'U+0041' /* A */, true /* Ctrl*/, false /* Shift */,
283 false /* Alt */);
279 }).then(function() { 284 }).then(function() {
280 // Confirm that 2 images are selected. 285 // Confirm that 2 images are selected.
281 return gallery.callRemoteTestUtil('queryAllElements', appId, 286 return gallery.callRemoteTestUtil('queryAllElements', appId,
282 ['.thumbnail-view > ul > li.selected']); 287 ['.thumbnail-view > ul > li.selected']);
283 }).then(function(results) { 288 }).then(function(results) {
284 chrome.test.assertEq(2, results.length); 289 chrome.test.assertEq(2, results.length);
285 }); 290 });
286 } 291 }
287 292
288 /** 293 /**
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 return selectMultipleImagesWithShiftKey('local', 'downloads'); 364 return selectMultipleImagesWithShiftKey('local', 'downloads');
360 }; 365 };
361 366
362 /** 367 /**
363 * Selects all images in thumbnail mode after deleted an image in slide mode. 368 * Selects all images in thumbnail mode after deleted an image in slide mode.
364 * @return {!Promise} Promise to be fulfilled with on success. 369 * @return {!Promise} Promise to be fulfilled with on success.
365 */ 370 */
366 testcase.selectAllImagesAfterImageDeletionOnDownloads = function() { 371 testcase.selectAllImagesAfterImageDeletionOnDownloads = function() {
367 return selectAllImagesAfterImageDeletionOnDownloads('local', 'downloads'); 372 return selectAllImagesAfterImageDeletionOnDownloads('local', 'downloads');
368 }; 373 };
OLDNEW
« no previous file with comments | « ui/file_manager/integration_tests/gallery/photo_editor.js ('k') | ui/file_manager/integration_tests/remote_call.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698