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 to open and cancel the file dialog. | 8 * Tests to open and cancel the file dialog. |
9 * | 9 * |
10 * @param {string} volumeName Volume name passed to the selectVolume remote | 10 * @param {string} volumeName Volume name passed to the selectVolume remote |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 {type: 'openFile'}, | 46 {type: 'openFile'}, |
47 volumeName, | 47 volumeName, |
48 expectedSet, | 48 expectedSet, |
49 function(windowId) { | 49 function(windowId) { |
50 return remoteCall.callRemoteTestUtil( | 50 return remoteCall.callRemoteTestUtil( |
51 'selectFile', windowId, ['hello.txt'] | 51 'selectFile', windowId, ['hello.txt'] |
52 ).then(function() { | 52 ).then(function() { |
53 return remoteCall.callRemoteTestUtil( | 53 return remoteCall.callRemoteTestUtil( |
54 'fakeKeyDown', | 54 'fakeKeyDown', |
55 windowId, | 55 windowId, |
56 ['#file-list', 'U+001B', false, false, false]); | 56 ['#file-list', 'Escape', 'U+001B', false, false, false]); |
57 }); | 57 }); |
58 }); | 58 }); |
59 }).then(function(result) { | 59 }).then(function(result) { |
60 // Undefined means the dialog is canceled. | 60 // Undefined means the dialog is canceled. |
61 chrome.test.assertEq(undefined, result); | 61 chrome.test.assertEq(undefined, result); |
62 }); | 62 }); |
63 | 63 |
64 var closeByOkButtonPromise = closeByEscKeyPromise.then(function() { | 64 var closeByOkButtonPromise = closeByEscKeyPromise.then(function() { |
65 return openAndWaitForClosingDialog( | 65 return openAndWaitForClosingDialog( |
66 {type: 'openFile'}, | 66 {type: 'openFile'}, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 testPromise(remoteCall.waitForWindow('dialog#').then(function(windowId) { | 100 testPromise(remoteCall.waitForWindow('dialog#').then(function(windowId) { |
101 return remoteCall.callRemoteTestUtil('unload', windowId, []). | 101 return remoteCall.callRemoteTestUtil('unload', windowId, []). |
102 then(function() { | 102 then(function() { |
103 return remoteCall.callRemoteTestUtil('getErrorCount', windowId, []); | 103 return remoteCall.callRemoteTestUtil('getErrorCount', windowId, []); |
104 }). | 104 }). |
105 then(function(num) { | 105 then(function(num) { |
106 chrome.test.assertEq(0, num); | 106 chrome.test.assertEq(0, num); |
107 }); | 107 }); |
108 })); | 108 })); |
109 }; | 109 }; |
OLD | NEW |