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 * @type {Object} | 8 * @type {Object} |
9 * @const | 9 * @const |
10 */ | 10 */ |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 }); | 159 }); |
160 }, | 160 }, |
161 | 161 |
162 // Thumbnails should be returned when available for private API request. | 162 // Thumbnails should be returned when available for private API request. |
163 function getEntryPropertiesWithThumbnailSuccess() { | 163 function getEntryPropertiesWithThumbnailSuccess() { |
164 var onSuccess = chrome.test.callbackPass(); | 164 var onSuccess = chrome.test.callbackPass(); |
165 test_util.fileSystem.root.getFile( | 165 test_util.fileSystem.root.getFile( |
166 TESTING_WITH_VALID_THUMBNAIL_FILE.name, | 166 TESTING_WITH_VALID_THUMBNAIL_FILE.name, |
167 {create: false}, | 167 {create: false}, |
168 function(fileEntry) { | 168 function(fileEntry) { |
169 chrome.fileBrowserPrivate.getEntryProperties( | 169 chrome.fileManagerPrivate.getEntryProperties( |
170 [fileEntry.toURL()], | 170 [fileEntry.toURL()], |
171 function(fileProperties) { | 171 function(fileProperties) { |
172 chrome.test.assertEq(1, fileProperties.length); | 172 chrome.test.assertEq(1, fileProperties.length); |
173 chrome.test.assertEq( | 173 chrome.test.assertEq( |
174 TESTING_WITH_VALID_THUMBNAIL_FILE.thumbnail, | 174 TESTING_WITH_VALID_THUMBNAIL_FILE.thumbnail, |
175 fileProperties[0].thumbnailUrl); | 175 fileProperties[0].thumbnailUrl); |
176 chrome.test.assertEq( | 176 chrome.test.assertEq( |
177 TESTING_WITH_VALID_THUMBNAIL_FILE.fileSize, | 177 TESTING_WITH_VALID_THUMBNAIL_FILE.fileSize, |
178 fileProperties[0].size); | 178 fileProperties[0].size); |
179 chrome.test.assertEq( | 179 chrome.test.assertEq( |
180 TESTING_WITH_VALID_THUMBNAIL_FILE.modificationTime, | 180 TESTING_WITH_VALID_THUMBNAIL_FILE.modificationTime, |
181 new Date(fileProperties[0].lastModifiedTime)); | 181 new Date(fileProperties[0].lastModifiedTime)); |
182 onSuccess(); | 182 onSuccess(); |
183 }); | 183 }); |
184 }, | 184 }, |
185 function(error) { | 185 function(error) { |
186 chrome.test.fail(error.name); | 186 chrome.test.fail(error.name); |
187 }); | 187 }); |
188 }, | 188 }, |
189 | 189 |
190 // Confirm that extensions are not able to pass an invalid thumbnail url, | 190 // Confirm that extensions are not able to pass an invalid thumbnail url, |
191 // including evil urls. | 191 // including evil urls. |
192 function getEntryPropertiesWithInvalidThumbnail() { | 192 function getEntryPropertiesWithInvalidThumbnail() { |
193 var onSuccess = chrome.test.callbackPass(); | 193 var onSuccess = chrome.test.callbackPass(); |
194 test_util.fileSystem.root.getFile( | 194 test_util.fileSystem.root.getFile( |
195 TESTING_WITH_INVALID_THUMBNAIL_FILE.name, | 195 TESTING_WITH_INVALID_THUMBNAIL_FILE.name, |
196 {create: false}, | 196 {create: false}, |
197 function(fileEntry) { | 197 function(fileEntry) { |
198 chrome.fileBrowserPrivate.getEntryProperties( | 198 chrome.fileManagerPrivate.getEntryProperties( |
199 [fileEntry.toURL()], | 199 [fileEntry.toURL()], |
200 function(fileProperties) { | 200 function(fileProperties) { |
201 chrome.test.assertEq(1, fileProperties.length); | 201 chrome.test.assertEq(1, fileProperties.length); |
202 // The results for an entry is an empty dictionary in case of | 202 // The results for an entry is an empty dictionary in case of |
203 // an error. | 203 // an error. |
204 chrome.test.assertEq( | 204 chrome.test.assertEq( |
205 0, Object.keys(fileProperties[0]).length); | 205 0, Object.keys(fileProperties[0]).length); |
206 onSuccess(); | 206 onSuccess(); |
207 }); | 207 }); |
208 }, | 208 }, |
209 function(error) { | 209 function(error) { |
210 chrome.test.fail(error.name); | 210 chrome.test.fail(error.name); |
211 }); | 211 }); |
212 } | 212 } |
213 ]); | 213 ]); |
214 } | 214 } |
215 | 215 |
216 // Setup and run all of the test cases. | 216 // Setup and run all of the test cases. |
217 setUp(runTests); | 217 setUp(runTests); |
OLD | NEW |