OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * Tests the focus behavior of the search box. | 8 * Tests the focus behavior of the search box. |
9 */ | 9 */ |
10 testcase.searchBoxFocus = function() { | 10 testcase.searchBoxFocus = function() { |
11 var appId; | 11 var appId; |
12 StepsRunner.run([ | 12 StepsRunner.run([ |
13 // Set up File Manager. | 13 // Set up File Manager. |
14 function() { | 14 function() { |
15 setupAndWaitUntilReady(null, RootPath.DRIVE, this.next); | 15 setupAndWaitUntilReady(null, RootPath.DRIVE, this.next); |
16 }, | 16 }, |
17 // Check that the file list has the focus on launch. | 17 // Check that the file list has the focus on launch. |
18 function(results) { | 18 function(results) { |
19 appId = results.windowId; | 19 appId = results.windowId; |
20 remoteCall.waitForElement(appId, ['#file-list:focus']).then(this.next); | 20 remoteCall.waitForElement(appId, ['#file-list:focus']).then(this.next); |
21 }, | 21 }, |
22 // Press the Ctrl-F key. | 22 // Press the Ctrl-F key. |
23 function(element) { | 23 function(element) { |
24 remoteCall.callRemoteTestUtil( | 24 remoteCall.callRemoteTestUtil( |
25 'fakeKeyDown', appId, | 25 'fakeKeyDown', appId, |
26 ['body', 'U+0046', true, false, false], | 26 ['body', 'f', 'U+0046', true, false, false], |
27 this.next); | 27 this.next); |
28 }, | 28 }, |
29 // Check that the search box has the focus. | 29 // Check that the search box has the focus. |
30 function(result) { | 30 function(result) { |
31 chrome.test.assertTrue(result); | 31 chrome.test.assertTrue(result); |
32 remoteCall.waitForElement(appId, ['#search-box input:focus']). | 32 remoteCall.waitForElement(appId, ['#search-box input:focus']). |
33 then(this.next); }, | 33 then(this.next); }, |
34 // Press the Esc key. | 34 // Press the Esc key. |
35 function(element) { | 35 function(element) { |
36 remoteCall.callRemoteTestUtil( | 36 remoteCall.callRemoteTestUtil( |
37 'fakeKeyDown', appId, | 37 'fakeKeyDown', appId, |
38 ['#search-box input', 'U+001B', false, false, false], | 38 ['#search-box input', 'Escape', 'U+001B', false, false, false], |
39 this.next); | 39 this.next); |
40 }, | 40 }, |
41 // Check that the file list has the focus. | 41 // Check that the file list has the focus. |
42 function(result) { | 42 function(result) { |
43 chrome.test.assertTrue(result); | 43 chrome.test.assertTrue(result); |
44 remoteCall.checkNextTabFocus(appId, 'file-list').then(this.next); | 44 remoteCall.checkNextTabFocus(appId, 'file-list').then(this.next); |
45 }, | 45 }, |
46 // Check for errors. | 46 // Check for errors. |
47 function(result) { | 47 function(result) { |
48 chrome.test.assertTrue(result); | 48 chrome.test.assertTrue(result); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 promise = promise.then(function() { | 263 promise = promise.then(function() { |
264 return remoteCall.checkNextTabFocus(appId, className); | 264 return remoteCall.checkNextTabFocus(appId, className); |
265 }).then(function(result) { | 265 }).then(function(result) { |
266 chrome.test.assertTrue(result); | 266 chrome.test.assertTrue(result); |
267 }); | 267 }); |
268 }); | 268 }); |
269 | 269 |
270 promise = promise.then(function() { | 270 promise = promise.then(function() { |
271 // Closes the window by pressing Enter. | 271 // Closes the window by pressing Enter. |
272 return remoteCall.callRemoteTestUtil( | 272 return remoteCall.callRemoteTestUtil( |
273 'fakeKeyDown', appId, ['#file-list', 'Enter', false, false, false]); | 273 'fakeKeyDown', appId, ['#file-list', 'Enter', 'Enter', false, false, |
| 274 false]); |
274 }); | 275 }); |
275 | 276 |
276 return promise; | 277 return promise; |
277 }; | 278 }; |
278 | 279 |
279 return setupPromise.then(function() { | 280 return setupPromise.then(function() { |
280 return openAndWaitForClosingDialog( | 281 return openAndWaitForClosingDialog( |
281 dialogParams, volumeName, expectedSet, selectAndCheckAndClose); | 282 dialogParams, volumeName, expectedSet, selectAndCheckAndClose); |
282 }); | 283 }); |
283 } | 284 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 { | 337 { |
337 type: 'saveFile', | 338 type: 'saveFile', |
338 suggestedName: 'hoge.txt' // Prevent showing a override prompt | 339 suggestedName: 'hoge.txt' // Prevent showing a override prompt |
339 }, | 340 }, |
340 'drive', BASIC_DRIVE_ENTRY_SET, null, | 341 'drive', BASIC_DRIVE_ENTRY_SET, null, |
341 ['#ok-button:not([disabled])'], | 342 ['#ok-button:not([disabled])'], |
342 ['ok-button', 'cancel-button', 'search-button', 'view-button', | 343 ['ok-button', 'cancel-button', 'search-button', 'view-button', |
343 'sort-button', 'gear-button', 'directory-tree', 'file-list', | 344 'sort-button', 'gear-button', 'directory-tree', 'file-list', |
344 'new-folder-button', 'filename-input-textbox'])); | 345 'new-folder-button', 'filename-input-textbox'])); |
345 }; | 346 }; |
OLD | NEW |