Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: chrome/test/data/extensions/api_test/file_system_provider/mount/test.js

Issue 192573002: [fsp] Introduce file_system_provider::Service class for the FileSystemProvider API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplified. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
+ }
]);

Powered by Google App Engine
This is Rietveld 408576698