1 // Copyright (c) 2012 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 // First get the file system.
10 chrome.syncFileSystem.requestFileSystem(testStep.shift());
12 // Add a couple of test files.
15 fileSystem.root.getFile('Test1.txt', {create: true}, testStep.shift(),
19 fileSystem.root.getFile('Test2.txt', {create: true}, testStep.shift(),
22 // Check the directory for contents.
24 var dirReader = fileSystem.root.createReader();
25 dirReader.readEntries(testStep.shift(), errorHandler);
28 chrome.test.assertEq(2, entries.length);
30 fileList.push(entries[0].fullPath);
31 fileList.push(entries[1].fullPath);
34 chrome.test.assertEq("/Test1.txt", fileList[0]);
35 chrome.test.assertEq("/Test2.txt", fileList[1]);
38 // Then try to delete the file system.
40 chrome.syncFileSystem.deleteFileSystem(fileSystem, testStep.shift());
43 chrome.test.assertTrue(result);
46 // Assert that the file system no longer exists.
48 fileSystem.root.getDirectory('/', {}, testFail, testStep.shift());
51 chrome.test.assertEq(FileError.NOT_FOUND_ERR, e.code);
52 chrome.test.succeed();
57 chrome.test.fail("Failure callback should have been called instead as " +
58 "file system should no longer exist.");
61 function errorHandler(e) {
62 chrome.test.fail("e=" + e.code);
65 chrome.test.runTests([