Index: chrome/test/data/extensions/api_test/file_system_provider/mount/test.js |
diff --git a/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js b/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js |
index bb8fcef5db3861bc8b36fd2c7d02f1d08496b574..1912d390c2ea6b1a71a8147ab6596313ad907314 100644 |
--- a/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js |
+++ b/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js |
@@ -16,6 +16,7 @@ chrome.test.runTests([ |
} |
); |
}, |
+ |
function emptyDisplayName() { |
chrome.fileSystemProvider.mount( |
'', |
@@ -28,4 +29,52 @@ chrome.test.runTests([ |
} |
); |
}, |
+ |
+ function successfulMount() { |
+ chrome.fileSystemProvider.mount( |
+ 'caramel-candy.zip', |
+ function(fileSystemId) { |
+ chrome.test.assertTrue(fileSystemId != ''); |
+ chrome.fileBrowserPrivate.getVolumeMetadataList(function(volumeList) { |
+ var found = volumeList.filter(function(volumeInfo) { |
+ return volumeInfo.volumeId == 'provided:' + fileSystemId; |
+ }); |
+ chrome.test.assertEq(1, found.length); |
+ chrome.test.succeed(); |
+ }); |
+ }, |
+ function(error) { |
+ chrome.test.fail(); |
+ }); |
+ }, |
+ |
+ function stressMountTest() { |
+ // Try to create more than allowed number of file systems. All of the mount |
+ // requests should succeed, except the last one which should fail with a |
+ // security error. |
+ var ALREADY_MOUNTED_FILE_SYSTEMS = 2; // By previous tests. |
+ var MAX_FILE_SYSTEMS = 16; |
+ var index = 0; |
+ var tryNextOne = function() { |
+ index++; |
+ if (index < MAX_FILE_SYSTEMS - ALREADY_MOUNTED_FILE_SYSTEMS + 1) { |
+ chrome.fileSystemProvider.mount( |
+ index + 'th file system', |
+ function(fileSystemId) { |
+ chrome.test.assertTrue(fileSystemId != ''); |
+ tryNextOne(); |
+ }, |
+ chrome.test.fail); |
+ } else { |
+ chrome.fileSystemProvider.mount( |
+ 'over the limit fs', |
+ chrome.test.fail, |
+ function(error) { |
+ chrome.test.assertEq('SecurityError', error.name); |
+ chrome.test.succeed(); |
+ }); |
+ } |
+ }; |
+ tryNextOne(); |
+ } |
]); |