OLD | NEW |
---|---|
1 if (this.importScripts) { | 1 if (this.importScripts) { |
2 importScripts('../../../resources/js-test.js'); | 2 importScripts('../../../resources/js-test.js'); |
3 importScripts('shared.js'); | 3 importScripts('shared.js'); |
4 } | 4 } |
5 | 5 |
6 description("Test IndexedDB keyPath with intrinsic properties"); | 6 description("Test IndexedDB keyPath with intrinsic properties"); |
7 | 7 |
8 indexedDBTest(prepareDatabase, testKeyPaths); | 8 indexedDBTest(prepareDatabase, testKeyPaths); |
9 function prepareDatabase() | 9 function prepareDatabase() |
10 { | 10 { |
(...skipping 12 matching lines...) Expand all Loading... | |
23 | 23 |
24 transaction = evalAndLog("transaction = db.transaction('store', 'readwrite') "); | 24 transaction = evalAndLog("transaction = db.transaction('store', 'readwrite') "); |
25 transaction.onabort = unexpectedAbortCallback; | 25 transaction.onabort = unexpectedAbortCallback; |
26 store = evalAndLog("store = transaction.objectStore('store')"); | 26 store = evalAndLog("store = transaction.objectStore('store')"); |
27 | 27 |
28 for (var i = 0; i < 5; i += 1) { | 28 for (var i = 0; i < 5; i += 1) { |
29 var datum = { | 29 var datum = { |
30 id: 'id#' + i, | 30 id: 'id#' + i, |
31 string: Array(i * 2 + 1).join('x'), | 31 string: Array(i * 2 + 1).join('x'), |
32 array: Array(i * 3 + 1).join('x').split(/(?:)/), | 32 array: Array(i * 3 + 1).join('x').split(/(?:)/), |
33 blob: new Blob([Array(i * 4 + 1).join('x')], {type: "type " + i}) | 33 blob: JSON.parse(stringifyDOMObject( |
jsbell
2015/01/20 17:06:43
Doesn't this change the test? Instead of datum.blo
Yuki
2015/01/21 07:43:24
Ah, good catch! I should have been more careful.
| |
34 new Blob([Array(i * 4 + 1).join('x')], {type: "type " + i}))) | |
34 }; | 35 }; |
35 debug("store.put(" + JSON.stringify(datum) + ")"); | 36 debug("store.put(" + JSON.stringify(datum) + ")"); |
36 store.put(datum); | 37 store.put(datum); |
37 } | 38 } |
38 | 39 |
39 checkStringLengths(); | 40 checkStringLengths(); |
40 | 41 |
41 function checkStringLengths() { | 42 function checkStringLengths() { |
42 evalAndLog("request = store.index('string length').openCursor()"); | 43 evalAndLog("request = store.index('string length').openCursor()"); |
43 request.onerror = unexpectedErrorCallback; | 44 request.onerror = unexpectedErrorCallback; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 cursor = e.target.result; | 88 cursor = e.target.result; |
88 if (cursor) { | 89 if (cursor) { |
89 shouldBe("cursor.key", "cursor.value.blob.type"); | 90 shouldBe("cursor.key", "cursor.value.blob.type"); |
90 cursor.continue(); | 91 cursor.continue(); |
91 } | 92 } |
92 } | 93 } |
93 } | 94 } |
94 | 95 |
95 transaction.oncomplete = finishJSTest; | 96 transaction.oncomplete = finishJSTest; |
96 } | 97 } |
OLD | NEW |