// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+'use strict';
+
+/**
+ * Runs all of the test cases, one by one.
+ */
chrome.test.runTests([
+ // Tests whether mounting succeeds, when a non-empty name is provided.
function goodDisplayName() {
+ var onTestSuccess = chrome.test.callbackPass(function() {});
chrome.fileSystemProvider.mount(
'test file system',
function(fileSystemId) {
chrome.test.assertEq('number', typeof(fileSystemId));
- chrome.test.assertTrue(fileSystemId == 1);
- chrome.test.succeed();
+ chrome.test.assertEq(1, fileSystemId);
+ onTestSuccess();
},
function(error) {
chrome.test.fail();
);
},
+ // Verifies that mounting fails, when an empty string is provided as a name.
function emptyDisplayName() {
+ var onTestSuccess = chrome.test.callbackPass(function() {});
chrome.fileSystemProvider.mount(
'',
function(fileSystemId) {
},
function(error) {
chrome.test.assertEq('SecurityError', error.name);
- chrome.test.succeed();
+ onTestSuccess();
}
);
},
+ // End to end test. Mounts a volume using fileSystemProvider.mount(), then
+ // checks if the mounted volume is added to VolumeManager, by querying
+ // fileBrowserPrivate.getVolumeMetadataList().
function successfulMount() {
+ var onTestSuccess = chrome.test.callbackPass(function() {});
chrome.fileSystemProvider.mount(
'caramel-candy.zip',
function(fileSystemId) {
'provided:' + chrome.runtime.id + '-' + fileSystemId + '-user';
});
chrome.test.assertEq(1, found.length);
- chrome.test.succeed();
+ onTestSuccess();
});
},
function(error) {
});
},
+ // Checks is limit for mounted file systems per profile works correctly.
+ // Tries 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.
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 onTestSuccess = chrome.test.callbackPass(function() {});
var ALREADY_MOUNTED_FILE_SYSTEMS = 2; // By previous tests.
var MAX_FILE_SYSTEMS = 16;
var index = 0;
chrome.test.fail,
function(error) {
chrome.test.assertEq('SecurityError', error.name);
- chrome.test.succeed();
+ onTestSuccess();
});
}
};