| OLD | NEW |
| 1 #library('IndexedDB4Test'); | 1 #library('IndexedDB4Test'); |
| 2 #import('../../lib/unittest/unittest.dart'); | 2 #import('../../lib/unittest/unittest.dart'); |
| 3 #import('../../lib/unittest/dom_config.dart'); | 3 #import('../../lib/unittest/dom_config.dart'); |
| 4 #import('dart:dom'); | 4 #import('dart:dom'); |
| 5 | 5 |
| 6 // Test for IDBKeyRange and IDBCursor. | 6 // Test for IDBKeyRange and IDBCursor. |
| 7 | 7 |
| 8 final String DB_NAME = 'Test'; | 8 final String DB_NAME = 'Test'; |
| 9 final String STORE_NAME = 'TEST'; | 9 final String STORE_NAME = 'TEST'; |
| 10 final String VERSION = '1'; | 10 final String VERSION = '1'; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 fail(message) => (e) { | 52 fail(message) => (e) { |
| 53 callbackDone(); | 53 callbackDone(); |
| 54 Expect.fail('IndexedDB failure: $message'); | 54 Expect.fail('IndexedDB failure: $message'); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 testRange(range, expectedFirst, expectedLast) { | 57 testRange(range, expectedFirst, expectedLast) { |
| 58 IDBTransaction txn = db.transaction(STORE_NAME, IDBTransaction.READ_ONLY); | 58 IDBTransaction txn = db.transaction(STORE_NAME, IDBTransaction.READ_ONLY); |
| 59 IDBObjectStore objectStore = txn.objectStore(STORE_NAME); | 59 IDBObjectStore objectStore = txn.objectStore(STORE_NAME); |
| 60 IDBRequest cursorRequest = objectStore.openCursor(range); | 60 IDBRequest cursorRequest = objectStore.openCursor(range); |
| 61 int itemCount = 0; | 61 int itemCount = 0; |
| 62 int firstKey = null; | 62 num firstKey = null; |
| 63 int lastKey = null; | 63 num lastKey = null; |
| 64 cursorRequest.addEventListener("success", (e) { | 64 cursorRequest.addEventListener("success", (e) { |
| 65 var cursor = e.target.result; | 65 var cursor = e.target.result; |
| 66 if (cursor != null) { | 66 if (cursor != null) { |
| 67 if (firstKey == null) firstKey = cursor.key; | 67 if (firstKey == null) firstKey = cursor.key; |
| 68 lastKey = cursor.key; | 68 lastKey = cursor.key; |
| 69 itemCount += 1; | 69 itemCount += 1; |
| 70 Expect.equals('Item ${cursor.key.toStringAsFixed(0)}', cursor.value); | 70 Expect.equals('Item ${cursor.key.toStringAsFixed(0)}', cursor.value); |
| 71 cursor.continueFunction(); | 71 cursor.continueFunction(); |
| 72 } else { | 72 } else { |
| 73 // Done | 73 // Done |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 asyncTest('upper2', 1, test.upper2); | 132 asyncTest('upper2', 1, test.upper2); |
| 133 asyncTest('upper3', 1, test.upper3); | 133 asyncTest('upper3', 1, test.upper3); |
| 134 | 134 |
| 135 asyncTest('bound1', 1, test.bound1); | 135 asyncTest('bound1', 1, test.bound1); |
| 136 asyncTest('bound2', 1, test.bound2); | 136 asyncTest('bound2', 1, test.bound2); |
| 137 asyncTest('bound3', 1, test.bound3); | 137 asyncTest('bound3', 1, test.bound3); |
| 138 asyncTest('bound4', 1, test.bound4); | 138 asyncTest('bound4', 1, test.bound4); |
| 139 asyncTest('bound5', 1, test.bound5); | 139 asyncTest('bound5', 1, test.bound5); |
| 140 | 140 |
| 141 } | 141 } |
| OLD | NEW |