OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 function cursorSuccess() | 6 function cursorSuccess() |
7 { | 7 { |
8 debug("Cursor opened successfully.") | 8 debug("Cursor opened successfully.") |
9 // FIXME: check that we can iterate the cursor. | 9 // FIXME: check that we can iterate the cursor. |
10 shouldBe("event.result.direction", "0"); | 10 shouldBe("event.result.direction", "0"); |
11 shouldBe("event.result.key", "'myKey' + count"); | 11 shouldBe("event.result.key", "'myKey' + count"); |
12 shouldBe("event.result.value.keyPath", "'myKey' + count"); | 12 shouldBe("event.result.value.keyPath", "'myKey' + count"); |
13 shouldBe("event.result.value.value", "'myValue' + count"); | 13 shouldBe("event.result.value.value", "'myValue' + count"); |
14 if (++count >= 5) | 14 if (++count >= 5) |
15 done(); | 15 done(); |
16 else | 16 else |
17 openCursor(); | 17 openCursor(); |
18 } | 18 } |
19 | 19 |
20 function openCursor() | 20 function openCursor() |
21 { | 21 { |
22 debug("Opening cursor #" + count); | 22 debug("Opening cursor #" + count); |
23 keyRange = webkitIDBKeyRange.lowerBound("myKey" + count); | 23 keyRange = webkitIDBKeyRange.lowerBound("myKey" + count); |
24 result = objectStore.openCursor({range: keyRange}); | 24 result = objectStore.openCursor(keyRange); |
25 result.onsuccess = cursorSuccess; | 25 result.onsuccess = cursorSuccess; |
26 result.onerror = unexpectedErrorCallback; | 26 result.onerror = unexpectedErrorCallback; |
27 } | 27 } |
28 | 28 |
29 function populateObjectStore() | 29 function populateObjectStore() |
30 { | 30 { |
31 debug("Populating object store #" + count); | 31 debug("Populating object store #" + count); |
32 obj = {'keyPath': 'myKey' + count, 'value': 'myValue' + count}; | 32 obj = {'keyPath': 'myKey' + count, 'value': 'myValue' + count}; |
33 result = objectStore.add(obj); | 33 result = objectStore.add(obj); |
34 result.onerror = unexpectedErrorCallback; | 34 result.onerror = unexpectedErrorCallback; |
(...skipping 26 matching lines...) Expand all Loading... |
61 function test() | 61 function test() |
62 { | 62 { |
63 debug("Test IndexedDB's KeyPath."); | 63 debug("Test IndexedDB's KeyPath."); |
64 debug("Opening IndexedDB"); | 64 debug("Opening IndexedDB"); |
65 result = webkitIndexedDB.open('name'); | 65 result = webkitIndexedDB.open('name'); |
66 result.onsuccess = setVersion; | 66 result.onsuccess = setVersion; |
67 result.onerror = unexpectedErrorCallback; | 67 result.onerror = unexpectedErrorCallback; |
68 } | 68 } |
69 | 69 |
70 var successfullyParsed = true; | 70 var successfullyParsed = true; |
OLD | NEW |