Index: LayoutTests/storage/indexeddb/blob-basics-metadata.html |
diff --git a/LayoutTests/storage/indexeddb/blob-basics-metadata.html b/LayoutTests/storage/indexeddb/blob-basics-metadata.html |
index e93cea69a9ea9db98e0e4e5e86388cf0e8253f01..ecbe3f44df8727c515bad29663877c248fa3014f 100644 |
--- a/LayoutTests/storage/indexeddb/blob-basics-metadata.html |
+++ b/LayoutTests/storage/indexeddb/blob-basics-metadata.html |
@@ -1,9 +1,6 @@ |
-<html> |
-<head> |
+<!DOCTYPE html> |
<script src="../../resources/js-test.js"></script> |
<script src="resources/shared.js"></script> |
-</head> |
-<body> |
<input type="file" id="fileInput" multiple></input> |
<script> |
@@ -32,8 +29,7 @@ function prepareDatabase() |
var blobValidation = ".size == test_content.length"; |
function testBlob() |
{ |
- debug(""); |
- debug("testBlob():"); |
+ preamble(); |
shouldBeTrue("FileReader != null"); |
evalAndLog("test_content = 'This is a test. This is only a test.'"); |
@@ -44,8 +40,7 @@ function testBlob() |
var fileValidation = ".name == fileInput.files[0].name"; |
function testFile() |
{ |
- debug(""); |
- debug("testFile():"); |
+ preamble(); |
evalAndLog("file = fileInput.files[0]"); |
validateResult("file", fileValidation, testFileList); |
} |
@@ -53,8 +48,7 @@ function testFile() |
var fileListValidation = "[1].name == fileInput.files[1].name"; |
function testFileList() |
{ |
- debug(""); |
- debug("testFileList():"); |
+ preamble(); |
evalAndLog("filelist = fileInput.files"); |
validateResult("filelist", |
fileListValidation, testCursor); |
@@ -62,8 +56,7 @@ function testFileList() |
function testCursor() |
{ |
- debug(""); |
- debug("testCursor():"); |
+ preamble(); |
evalAndLog("transaction = db.transaction('storeName', 'readonly')"); |
transaction.onerror = unexpectedErrorCallback; |
transaction.onabort = unexpectedAbortCallback; |
@@ -100,31 +93,32 @@ function testCursor() |
} |
} |
-function validateResult(variable, validation, onComplete) |
+function validateResult(variable, validation, onSuccess) |
{ |
var keyName = variable + "key"; |
debug(""); |
debug("validateResult(" + variable + "):"); |
+ shouldBeTrue(variable + validation); |
evalAndLog("transaction = db.transaction('storeName', 'readwrite')"); |
evalAndLog("store = transaction.objectStore('storeName')"); |
evalAndLog("store.put(" + variable + ", '" + keyName + "')"); |
transaction.onerror = unexpectedErrorCallback; |
transaction.onabort = unexpectedAbortCallback; |
- var readTransactionOnComplete = function (e) { |
+ var onGetSuccess = function (e) { |
shouldBeTrue("event.target.result" + validation); |
- onComplete(); |
+ onSuccess(); |
} |
transaction.oncomplete = function () { |
- doRead(keyName, readTransactionOnComplete); |
+ doRead(keyName, onGetSuccess); |
} |
} |
-function doRead(keyName, onComplete) |
+function doRead(keyName, onSuccess) |
{ |
evalAndLog("transaction = db.transaction('storeName', 'readwrite')"); |
evalAndLog("store = transaction.objectStore('storeName')"); |
evalAndLog("request = store.get('" + keyName + "')"); |
- request.onsuccess = onComplete; |
+ request.onsuccess = onSuccess; |
transaction.onerror = unexpectedErrorCallback; |
transaction.onabort = unexpectedAbortCallback; |
} |
@@ -137,5 +131,3 @@ if (window.eventSender) { |
} |
</script> |
-</body> |
-</html> |