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

Side by Side Diff: chrome/test/data/indexeddb/cursor_test.js

Issue 5695002: IndexedDB: Numeric keys are floating point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/indexed_db_param_traits.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 function emptyCursorSuccess() 5 function emptyCursorSuccess()
6 { 6 {
7 debug('Empty cursor opened successfully.') 7 debug('Empty cursor opened successfully.')
8 done(); 8 done();
9 } 9 }
10 10
(...skipping 10 matching lines...) Expand all
21 { 21 {
22 var cursor = event.result; 22 var cursor = event.result;
23 if (cursor === null) { 23 if (cursor === null) {
24 debug('Cursor reached end of range.'); 24 debug('Cursor reached end of range.');
25 openEmptyCursor(); 25 openEmptyCursor();
26 return; 26 return;
27 } 27 }
28 28
29 debug('Cursor opened successfully.'); 29 debug('Cursor opened successfully.');
30 shouldBe("event.result.direction", "0"); 30 shouldBe("event.result.direction", "0");
31 shouldBe("event.result.key", "'myKey'"); 31 shouldBe("event.result.key", "3.14");
32 shouldBe("event.result.value", "'myValue'"); 32 shouldBe("event.result.value", "'myValue'");
33 33
34 cursor.continue(); 34 cursor.continue();
35 } 35 }
36 36
37 function openCursor(objectStore) 37 function openCursor(objectStore)
38 { 38 {
39 debug('Opening cursor'); 39 debug('Opening cursor');
40 var keyRange = webkitIDBKeyRange.lowerBound('myKey'); 40 var keyRange = webkitIDBKeyRange.lowerBound(3.12);
jorlow 2010/12/09 17:40:19 Is 3.12 intentional?
hans 2010/12/09 17:42:30 Yes, but there's no deep rationale for it. Just fi
41 var result = objectStore.openCursor({range: keyRange}); 41 var result = objectStore.openCursor({range: keyRange});
42 result.onsuccess = cursorSuccess; 42 result.onsuccess = cursorSuccess;
43 result.onerror = unexpectedErrorCallback; 43 result.onerror = unexpectedErrorCallback;
44 } 44 }
45 45
46 function dataAddedSuccess() 46 function dataAddedSuccess()
47 { 47 {
48 debug('Data added'); 48 debug('Data added');
49 openCursor(objectStore); 49 openCursor(objectStore);
50 } 50 }
51 51
52 function populateObjectStore() 52 function populateObjectStore()
53 { 53 {
54 debug('Populating object store'); 54 debug('Populating object store');
55 deleteAllObjectStores(db); 55 deleteAllObjectStores(db);
56 window.objectStore = db.createObjectStore('test'); 56 window.objectStore = db.createObjectStore('test');
57 var result = objectStore.add('myValue', 'myKey'); 57 var result = objectStore.add('myValue', 3.14);
58 result.onsuccess = dataAddedSuccess; 58 result.onsuccess = dataAddedSuccess;
59 result.onerror = unexpectedErrorCallback; 59 result.onerror = unexpectedErrorCallback;
60 } 60 }
61 61
62 function setVersion() 62 function setVersion()
63 { 63 {
64 debug('setVersion'); 64 debug('setVersion');
65 window.db = event.result; 65 window.db = event.result;
66 var result = db.setVersion('new version'); 66 var result = db.setVersion('new version');
67 result.onsuccess = populateObjectStore; 67 result.onsuccess = populateObjectStore;
68 result.onerror = unexpectedErrorCallback; 68 result.onerror = unexpectedErrorCallback;
69 } 69 }
70 70
71 function test() 71 function test()
72 { 72 {
73 debug('Connecting to indexedDB'); 73 debug('Connecting to indexedDB');
74 var result = webkitIndexedDB.open('name'); 74 var result = webkitIndexedDB.open('name');
75 result.onsuccess = setVersion; 75 result.onsuccess = setVersion;
76 result.onerror = unexpectedErrorCallback; 76 result.onerror = unexpectedErrorCallback;
77 } 77 }
OLDNEW
« no previous file with comments | « chrome/common/indexed_db_param_traits.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698