Index: chrome/test/data/extensions/api_test/extfs/test.js |
diff --git a/chrome/test/data/extensions/api_test/extfs/test.js b/chrome/test/data/extensions/api_test/extfs/test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..12ccd3583675eb6fb49d43e697235be60572ce45 |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/extfs/test.js |
@@ -0,0 +1,52 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+chrome.test.runTests([ |
+ function main() { |
+ // First, add a mount point named 'extfs'. This should be done before calling |
+ // chrome.fileBrowserPrivate.requestFileSystem() |
+ chrome.extfs.addMountPoint( |
+ 'extfs', |
+ function() { |
+ // This will be called via ExtfsProxy::GetFileInfo() |
+ chrome.extfs.onGetFileInfo.addListener( |
+ function(path, callback) { |
+ console.log('@@@ onGetFileInfo: ' + path); |
+ var entry = { |
+ isDirectory: true, |
+ name: '/', |
+ }; |
+ console.log(entry); |
+ callback(entry); |
+ }); |
+ |
+ // Request the access to the file system tree. |
+ chrome.fileBrowserPrivate.requestFileSystem(function(filesystem) { |
+ console.log('@@@ Got filesystem'); |
+ var root = filesystem.root; |
+ // 'extfs' is mounted as 'extfs' in the root directory. |
+ // Get an entry for it. |
+ root.getDirectory( |
+ 'extfs', |
+ {create: false}, |
+ function(entry) { |
+ console.log('@@@ Got dir entry for extfs: ' + entry); |
+ // Try read the directory. This will crash at this moment, as |
+ // ExtfsProxy::ReadDirectory() is not implemented. |
+ var reader = entry.createReader(); |
+ reader.readEntries(function(results) { |
+ for (var i = 0; i < results.length; i++) { |
+ console.log('@@@ entry: ' + results[i]); |
+ } |
+ chrome.test.succeed(); |
+ |
+ }); |
+ }, |
+ function(error) { |
+ console.log('@@@ Failed to get directory entry: ' + error.code); |
+ }); |
+ }); |
+ }); |
+ } |
+]); |