summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/filesystem/resources/directory-entry-to-uri.js
blob: b30e4023ca2f02b2c2c55d2042a093c1bd01533f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if (this.importScripts) {
    importScripts('fs-worker-common.js');
    importScripts('../../../resources/js-test.js');
    importScripts('fs-test-util.js');
}

description("Obtaining URL from DirectoryEntry.");

var fileSystem = null;
var testDirectoryName = 'testDirectory';
var testDirectoryURI = null;

function errorCallback(error) {
    testFailed("Error occured:" + error.name);
    finishJSTest();
}

function entryToURL(entry) {
    testDirectoryURL = entry.toURL();
    shouldBe("testDirectoryURL", "'filesystem:file:///temporary/testDirectory'");
    finishJSTest();
}

function createTestDirectory() {
    fileSystem.root.getDirectory(testDirectoryName, {create:true}, entryToURL, errorCallback);
}

function fileSystemCallback(fs) {
    fileSystem = fs;
    removeAllInDirectory(fileSystem.root, createTestDirectory, errorCallback);
}

var jsTestIsAsync = true;
webkitRequestFileSystem(TEMPORARY, 100, fileSystemCallback, errorCallback);