1 // Copyright 2013 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.
6 function goodDisplayName() {
7 chrome.fileSystemProvider.mount(
9 function(fileSystemId) {
10 chrome.test.assertEq('number', typeof(fileSystemId));
11 chrome.test.assertTrue(fileSystemId == 1);
12 chrome.test.succeed();
20 function emptyDisplayName() {
21 chrome.fileSystemProvider.mount(
23 function(fileSystemId) {
27 chrome.test.assertEq('SecurityError', error.name);
28 chrome.test.succeed();
33 function successfulMount() {
34 chrome.fileSystemProvider.mount(
36 function(fileSystemId) {
37 chrome.test.assertTrue(fileSystemId > 0);
38 chrome.fileBrowserPrivate.getVolumeMetadataList(function(volumeList) {
39 var found = volumeList.filter(function(volumeInfo) {
40 return volumeInfo.volumeId ==
41 'provided:' + chrome.runtime.id + '-' + fileSystemId + '-user';
43 chrome.test.assertEq(1, found.length);
44 chrome.test.succeed();
52 function stressMountTest() {
53 // Try to create more than allowed number of file systems. All of the mount
54 // requests should succeed, except the last one which should fail with a
56 var ALREADY_MOUNTED_FILE_SYSTEMS = 2; // By previous tests.
57 var MAX_FILE_SYSTEMS = 16;
59 var tryNextOne = function() {
61 if (index < MAX_FILE_SYSTEMS - ALREADY_MOUNTED_FILE_SYSTEMS + 1) {
62 chrome.fileSystemProvider.mount(
63 index + 'th file system',
64 function(fileSystemId) {
65 chrome.test.assertTrue(fileSystemId > 0);
70 chrome.fileSystemProvider.mount(
74 chrome.test.assertEq('SecurityError', error.name);
75 chrome.test.succeed();