Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: LayoutTests/storage/indexeddb/blob-basics-metadata.html

Issue 433983002: LayoutTests for writing empty Blob/File/FileList to IndexedDB. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed feedback. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698