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

Unified Diff: LayoutTests/storage/indexeddb/empty-blob-file-expected.txt

Issue 433983002: LayoutTests for writing empty Blob/File/FileList to IndexedDB. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added Filesystem test. 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/empty-blob-file-expected.txt
diff --git a/LayoutTests/storage/indexeddb/empty-blob-file-expected.txt b/LayoutTests/storage/indexeddb/empty-blob-file-expected.txt
new file mode 100644
index 0000000000000000000000000000000000000000..ef817e20242c181acc40c532959ec7480a246a88
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/empty-blob-file-expected.txt
@@ -0,0 +1,79 @@
+Confirm that IndexedDB can store an empty Blob/File/FileList
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+dbname = "empty-blob-file.html"
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+store = db.createObjectStore('storeName')
+store.put('value', 'key')
+
+testEmptyBlob():
+PASS FileReader != null is true
+blob = new Blob([])
+
+validateResult(blob):
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(blob, 'blobkey')
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+request = store.get('blobkey')
+PASS event.target.result.size == 0 is true
+
+testEmptyDataBlob():
+PASS FileReader != null is true
+blob = new Blob(['', '', ''])
+
+validateResult(blob):
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(blob, 'blobkey')
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+request = store.get('blobkey')
+PASS event.target.result.size == 0 is true
+
+testEmptyNestedBlob():
+PASS FileReader != null is true
+blob = new Blob(['', new Blob([]), ''])
+
+validateResult(blob):
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(blob, 'blobkey')
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+request = store.get('blobkey')
+PASS event.target.result.size == 0 is true
+
+testEmptyFile():
+file = emptyFileInput.files[0]
+
+validateResult(file):
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(file, 'filekey')
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+request = store.get('filekey')
+PASS event.target.result.size == 0 is true
+
+testEmptyFileList():
+fileList = emptyFileListInput.files
+
+validateResult(fileList):
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(fileList, 'fileListkey')
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+request = store.get('fileListkey')
+PASS event.target.result.length == 0 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Powered by Google App Engine
This is Rietveld 408576698