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.
8 * Runs all of the test cases, one by one.
10 chrome.test.runTests([
11 // Tests whether mounting succeeds, when a non-empty name is provided.
12 function goodDisplayName() {
13 var onTestSuccess = chrome.test.callbackPass(function() {});
14 chrome.fileSystemProvider.mount(
16 function(fileSystemId) {
17 chrome.test.assertEq('number', typeof(fileSystemId));
18 chrome.test.assertEq(1, fileSystemId);
27 // Verifies that mounting fails, when an empty string is provided as a name.
28 function emptyDisplayName() {
29 var onTestSuccess = chrome.test.callbackPass(function() {});
30 chrome.fileSystemProvider.mount(
32 function(fileSystemId) {
36 chrome.test.assertEq('SecurityError', error.name);
42 // End to end test. Mounts a volume using fileSystemProvider.mount(), then
43 // checks if the mounted volume is added to VolumeManager, by querying
44 // fileBrowserPrivate.getVolumeMetadataList().
45 function successfulMount() {
46 var onTestSuccess = chrome.test.callbackPass(function() {});
47 chrome.fileSystemProvider.mount(
49 function(fileSystemId) {
50 chrome.test.assertTrue(fileSystemId > 0);
51 chrome.fileBrowserPrivate.getVolumeMetadataList(function(volumeList) {
52 var found = volumeList.filter(function(volumeInfo) {
53 return volumeInfo.volumeId ==
54 'provided:' + chrome.runtime.id + '-' + fileSystemId + '-user';
56 chrome.test.assertEq(1, found.length);
65 // Checks is limit for mounted file systems per profile works correctly.
66 // Tries to create more than allowed number of file systems. All of the mount
67 // requests should succeed, except the last one which should fail with a
69 function stressMountTest() {
70 var onTestSuccess = chrome.test.callbackPass(function() {});
71 var ALREADY_MOUNTED_FILE_SYSTEMS = 2; // By previous tests.
72 var MAX_FILE_SYSTEMS = 16;
74 var tryNextOne = function() {
76 if (index < MAX_FILE_SYSTEMS - ALREADY_MOUNTED_FILE_SYSTEMS + 1) {
77 chrome.fileSystemProvider.mount(
78 index + 'th file system',
79 function(fileSystemId) {
80 chrome.test.assertTrue(fileSystemId > 0);
85 chrome.fileSystemProvider.mount(
89 chrome.test.assertEq('SecurityError', error.name);