Backed out changeset 89ddc7709fa8 (bug 980136)

This commit is contained in:
Ryan VanderMeulen 2014-03-11 12:17:02 -04:00
parent f001afc7f0
commit 83c8495e90

View File

@ -22,7 +22,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=910412
<script class="testbody" type="text/javascript">
devicestorage_setup();
SimpleTest.requestCompleteLog();
// The root directory object.
var gRoot = null;
@ -159,43 +158,23 @@ function cbSuccess(e) {
ok(navigator.getDeviceStorage, "Should have getDeviceStorage.");
var gStorage = navigator.getDeviceStorage("pictures");
ok(gStorage, "Should have gotten a storage.");
var storage = navigator.getDeviceStorage("pictures");
ok(storage, "Should have gotten a storage.");
function createTestFile(path, callback) {
function addNamed() {
var req = gStorage.addNamed(createRandomBlob("image/png"), path);
// Create test files.
var req = storage.addNamed(createRandomBlob("image/png"), "sub1/sub2/test.png");
req.onsuccess = function() {
ok(true, path + " was created.");
callback();
};
req.onerror = function(e) {
ok(false, "Failed to create " + path + ": " + e.target.error.name);
devicestorage_cleanup();
};
}
// Bug 980136. Check if the file exists before we create.
var req = gStorage.get(path);
req.onsuccess = function() {
ok(true, path + " exists. Do not need to create.");
callback();
};
req.onerror = function(e) {
ok(true, path + " does not exists: " + e.target.error.name);
addNamed();
};
}
createTestFile("sub1/sub2/test.png", function() {
var promise = gStorage.getRoot();
req.onsuccess = function() {
var promise = storage.getRoot();
ok(promise, "Should have a non-null promise for getRoot.");
promise.then(getSuccess, cbError);
});
};
req.onerror = function() {
ok(false, "Failed to created test files.");
devicestorage_cleanup();
};
</script>
</pre>