OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 chrome.test.runTests([ |
| 6 function main() { |
| 7 // First, add a mount point named 'extfs'. This should be done before callin
g |
| 8 // chrome.fileBrowserPrivate.requestFileSystem() |
| 9 chrome.extfs.addMountPoint( |
| 10 'extfs', |
| 11 function() { |
| 12 // This will be called via ExtfsProxy::GetFileInfo() |
| 13 chrome.extfs.onGetFileInfo.addListener( |
| 14 function(path, callback) { |
| 15 console.log('@@@ onGetFileInfo: ' + path); |
| 16 var entry = { |
| 17 isDirectory: true, |
| 18 name: '/', |
| 19 }; |
| 20 console.log(entry); |
| 21 callback(entry); |
| 22 }); |
| 23 |
| 24 // Request the access to the file system tree. |
| 25 chrome.fileBrowserPrivate.requestFileSystem(function(filesystem) { |
| 26 console.log('@@@ Got filesystem'); |
| 27 var root = filesystem.root; |
| 28 // 'extfs' is mounted as 'extfs' in the root directory. |
| 29 // Get an entry for it. |
| 30 root.getDirectory( |
| 31 'extfs', |
| 32 {create: false}, |
| 33 function(entry) { |
| 34 console.log('@@@ Got dir entry for extfs: ' + entry); |
| 35 // Try read the directory. This will crash at this moment, as |
| 36 // ExtfsProxy::ReadDirectory() is not implemented. |
| 37 var reader = entry.createReader(); |
| 38 reader.readEntries(function(results) { |
| 39 for (var i = 0; i < results.length; i++) { |
| 40 console.log('@@@ entry: ' + results[i]); |
| 41 } |
| 42 chrome.test.succeed(); |
| 43 |
| 44 }); |
| 45 }, |
| 46 function(error) { |
| 47 console.log('@@@ Failed to get directory entry: ' + error.code); |
| 48 }); |
| 49 }); |
| 50 }); |
| 51 } |
| 52 ]); |
OLD | NEW |