Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 Confirm basic Blob/File/FileList functionality. | |
| 2 | |
| 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ". | |
| 4 | |
| 5 | |
| 6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self. msIndexedDB || self.OIndexedDB; | |
| 7 | |
| 8 dbname = "blob-basics-metadata.html" | |
| 9 indexedDB.deleteDatabase(dbname) | |
| 10 indexedDB.open(dbname) | |
| 11 store = db.createObjectStore('storeName') | |
| 12 store.put('value', 'key') | |
| 13 | |
| 14 testBlob(): | |
| 15 PASS FileReader != null is true | |
| 16 test_content = 'This is a test. This is only a test.' | |
| 17 blob = new Blob([test_content]) | |
| 18 | |
| 19 validateResult(blob): | |
| 20 transaction = db.transaction('storeName', 'readwrite') | |
| 21 store = transaction.objectStore('storeName') | |
| 22 store.put(blob, 'blobkey') | |
| 23 transaction = db.transaction('storeName', 'readwrite') | |
| 24 store = transaction.objectStore('storeName') | |
| 25 request = store.get('blobkey') | |
| 26 PASS event.target.result.size == test_content.length is true | |
| 27 | |
| 28 testFile(): | |
| 29 file = fileInput.files[0] | |
| 30 | |
| 31 validateResult(file): | |
| 32 transaction = db.transaction('storeName', 'readwrite') | |
| 33 store = transaction.objectStore('storeName') | |
| 34 store.put(file, 'filekey') | |
| 35 transaction = db.transaction('storeName', 'readwrite') | |
| 36 store = transaction.objectStore('storeName') | |
| 37 request = store.get('filekey') | |
| 38 PASS event.target.result.name == fileInput.files[0].name is true | |
| 39 | |
| 40 testFileList(): | |
| 41 filelist = fileInput.files | |
| 42 | |
| 43 validateResult(filelist): | |
| 44 transaction = db.transaction('storeName', 'readwrite') | |
| 45 store = transaction.objectStore('storeName') | |
| 46 store.put(filelist, 'filelistkey') | |
| 47 transaction = db.transaction('storeName', 'readwrite') | |
| 48 store = transaction.objectStore('storeName') | |
| 49 request = store.get('filelistkey') | |
| 50 PASS event.target.result[1].name == fileInput.files[1].name is true | |
| 51 | |
| 52 testCursor(): | |
| 53 transaction = db.transaction('storeName', 'readonly') | |
| 54 store = transaction.objectStore('storeName') | |
| 55 request = store.openCursor() | |
| 56 PASS cursor.value.size == test_content.length is true | |
| 57 cursor.continue(); | |
| 58 PASS cursor.value.name == fileInput.files[0].name is true | |
| 59 cursor.continue(); | |
| 60 PASS cursor.value[1].name == fileInput.files[1].name is true | |
| 61 cursor.continue(); | |
| 62 PASS cursor.value == 'value' is true | |
| 63 cursor.continue(); | |
| 64 WARN: shouldBe() expects string arguments | |
|
jsbell
2014/05/29 00:40:06
this is due to shouldBeNull(cursor) w/o quotes
ericu
2014/06/02 22:18:47
Done.
| |
| 65 PASS null is null | |
| 66 PASS successfullyParsed is true | |
| 67 | |
| 68 TEST COMPLETE | |
| 69 | |
| OLD | NEW |