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

Side by Side Diff: tests/html/indexeddb_3_test.dart

Issue 10543023: Fix dart to native dispatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months 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
OLDNEW
1 #library('IndexedDB3Test'); 1 #library('IndexedDB3Test');
2 #import('../../lib/unittest/unittest.dart'); 2 #import('../../lib/unittest/unittest.dart');
3 #import('../../lib/unittest/html_config.dart'); 3 #import('../../lib/unittest/html_config.dart');
4 #import('dart:html'); 4 #import('dart:html');
5 5
6 // Read with cursor. 6 // Read with cursor.
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 Expect.equals(100, itemCount); 78 Expect.equals(100, itemCount);
79 Expect.equals((100 * 99) ~/ 2, sumKeys); 79 Expect.equals((100 * 99) ~/ 2, sumKeys);
80 } 80 }
81 }, count:101)); 81 }, count:101));
82 cursorRequest.on.error.add(fail('openCursor')); 82 cursorRequest.on.error.add(fail('openCursor'));
83 } 83 }
84 84
85 readAllReversedViaCursor() { 85 readAllReversedViaCursor() {
86 IDBTransaction txn = db.transaction(STORE_NAME, 'readonly'); 86 IDBTransaction txn = db.transaction(STORE_NAME, 'readonly');
87 IDBObjectStore objectStore = txn.objectStore(STORE_NAME); 87 IDBObjectStore objectStore = txn.objectStore(STORE_NAME);
88 IDBRequest cursorRequest = objectStore.openCursor(new IDBKeyRange.bound(0, 1 00), 'prev'); 88 // TODO: create a IDBKeyRange(0,100)
89 IDBRequest cursorRequest = objectStore.openCursor(null, 'prev');
podivilov 2012/06/06 13:26:08 Reverted to initial state.
89 int itemCount = 0; 90 int itemCount = 0;
90 int sumKeys = 0; 91 int sumKeys = 0;
91 int lastKey = null; 92 int lastKey = null;
92 cursorRequest.on.success.add(expectAsync1((e) { 93 cursorRequest.on.success.add(expectAsync1((e) {
93 var cursor = e.target.result; 94 var cursor = e.target.result;
94 if (cursor != null) { 95 if (cursor != null) {
95 lastKey = cursor.key; 96 lastKey = cursor.key;
96 itemCount += 1; 97 itemCount += 1;
97 sumKeys += cursor.key; 98 sumKeys += cursor.key;
98 Expect.equals('Item ${cursor.key}', cursor.value); 99 Expect.equals('Item ${cursor.key}', cursor.value);
(...skipping 10 matching lines...) Expand all
109 } 110 }
110 111
111 main() { 112 main() {
112 useHtmlConfiguration(); 113 useHtmlConfiguration();
113 114
114 var test_ = new Test(); 115 var test_ = new Test();
115 test('prepare', test_.start); 116 test('prepare', test_.start);
116 test('readAll1', test_.readAllViaCursor); 117 test('readAll1', test_.readAllViaCursor);
117 test('readAll2', test_.readAllReversedViaCursor); 118 test('readAll2', test_.readAllReversedViaCursor);
118 } 119 }
OLDNEW
« lib/dom/scripts/generator.py ('K') | « lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698