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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * Runs all of the test cases, one by one. | 8 * Runs all of the test cases, one by one. |
9 */ | 9 */ |
10 chrome.test.runTests([ | 10 chrome.test.runTests([ |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 // End to end test. Mounts a volume using fileSystemProvider.mount(), then | 62 // End to end test. Mounts a volume using fileSystemProvider.mount(), then |
63 // checks if the mounted volume is added to VolumeManager, by querying | 63 // checks if the mounted volume is added to VolumeManager, by querying |
64 // fileManagerPrivate.getVolumeMetadataList(). | 64 // fileManagerPrivate.getVolumeMetadataList(). |
65 function successfulMount() { | 65 function successfulMount() { |
66 var fileSystemId = 'caramel-candy'; | 66 var fileSystemId = 'caramel-candy'; |
67 chrome.fileSystemProvider.mount( | 67 chrome.fileSystemProvider.mount( |
68 { | 68 { |
69 fileSystemId: fileSystemId, | 69 fileSystemId: fileSystemId, |
70 displayName: 'caramel-candy.zip', | 70 displayName: 'caramel-candy.zip', |
71 source: 'FILE' | |
72 }, | 71 }, |
73 chrome.test.callbackPass(function() { | 72 chrome.test.callbackPass(function() { |
74 chrome.fileManagerPrivate.getVolumeMetadataList(function(volumeList) { | 73 chrome.fileManagerPrivate.getVolumeMetadataList(function(volumeList) { |
75 var volumeInfo; | 74 var volumeInfo; |
76 volumeList.forEach(function(inVolumeInfo) { | 75 volumeList.forEach(function(inVolumeInfo) { |
77 if (inVolumeInfo.extensionId == chrome.runtime.id && | 76 if (inVolumeInfo.extensionId == chrome.runtime.id && |
78 inVolumeInfo.fileSystemId == fileSystemId) { | 77 inVolumeInfo.fileSystemId == fileSystemId) { |
79 volumeInfo = inVolumeInfo; | 78 volumeInfo = inVolumeInfo; |
80 } | 79 } |
81 }); | 80 }); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 { | 129 { |
131 fileSystemId: 'over-the-limit-fs-id', | 130 fileSystemId: 'over-the-limit-fs-id', |
132 displayName: 'Over The Limit File System' | 131 displayName: 'Over The Limit File System' |
133 }, | 132 }, |
134 chrome.test.callbackFail('TOO_MANY_OPENED')); | 133 chrome.test.callbackFail('TOO_MANY_OPENED')); |
135 } | 134 } |
136 }; | 135 }; |
137 tryNextOne(); | 136 tryNextOne(); |
138 }, | 137 }, |
139 | 138 |
140 // Tests if fileManagerPrivate.addProvidedFileSystem() fails if the extension | |
141 // does not listen to onMountRequested() event. | |
142 function requestMountWithoutListener() { | |
143 chrome.fileManagerPrivate.getProvidingExtensions( | |
144 chrome.test.callbackPass(function(extensions) { | |
145 chrome.test.assertEq(extensions.length, 1); | |
146 chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId); | |
147 chrome.test.assertEq( | |
148 chrome.runtime.getManifest().name, extensions[0].name); | |
149 chrome.test.assertFalse(extensions[0].canConfigure); | |
150 chrome.test.assertFalse(extensions[0].canAdd); | |
151 })); | |
152 chrome.fileManagerPrivate.addProvidedFileSystem( | |
153 chrome.runtime.id, | |
154 chrome.test.callbackFail('Failed to request a new mount.')); | |
155 }, | |
156 | |
157 // Tests if fileManagerPrivate.addProvidedFileSystem() emits the | 139 // Tests if fileManagerPrivate.addProvidedFileSystem() emits the |
158 // onMountRequested() event. | 140 // onMountRequested() event. |
159 function requestMountSuccess() { | 141 function requestMountSuccess() { |
160 var onMountRequested = chrome.test.callbackPass( | 142 var onMountRequested = chrome.test.callbackPass( |
161 function(onSuccess, onError) { | 143 function(onSuccess, onError) { |
162 chrome.fileSystemProvider.onMountRequested.removeListener( | 144 chrome.fileSystemProvider.onMountRequested.removeListener( |
163 onMountRequested); | 145 onMountRequested); |
164 }); | 146 }); |
165 | 147 |
166 chrome.fileSystemProvider.onMountRequested.addListener( | 148 chrome.fileSystemProvider.onMountRequested.addListener( |
167 onMountRequested); | 149 onMountRequested); |
168 chrome.fileManagerPrivate.getProvidingExtensions( | 150 chrome.fileManagerPrivate.getProvidingExtensions( |
169 chrome.test.callbackPass(function(extensions) { | 151 chrome.test.callbackPass(function(extensions) { |
170 chrome.test.assertEq(extensions.length, 1); | 152 chrome.test.assertEq(extensions.length, 1); |
171 chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId); | 153 chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId); |
172 chrome.test.assertEq( | 154 chrome.test.assertEq( |
173 chrome.runtime.getManifest().name, extensions[0].name); | 155 chrome.runtime.getManifest().name, extensions[0].name); |
174 chrome.test.assertFalse(extensions[0].canConfigure); | 156 chrome.test.assertFalse(extensions[0].configurable); |
175 chrome.test.assertTrue(extensions[0].canAdd); | 157 chrome.test.assertTrue(extensions[0].multipleMounts); |
| 158 chrome.test.assertEq('network', extensions[0].source); |
176 })); | 159 })); |
177 | 160 |
178 chrome.fileManagerPrivate.addProvidedFileSystem( | 161 chrome.fileManagerPrivate.addProvidedFileSystem( |
179 chrome.runtime.id, | 162 chrome.runtime.id, |
180 chrome.test.callbackPass(function() {})); | 163 chrome.test.callbackPass(function() {})); |
181 } | 164 } |
182 ]); | 165 ]); |
OLD | NEW |