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

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

Issue 10544208: Fix indexeddb tests to implement proper setVersion semantics. (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 14 matching lines...) Expand all
25 // open call and listening to onversionchange. Can we feature-detect the 25 // open call and listening to onversionchange. Can we feature-detect the
26 // difference and make it work? 26 // difference and make it work?
27 var request = db.setVersion(VERSION); 27 var request = db.setVersion(VERSION);
28 request.on.success.add( 28 request.on.success.add(
29 expectAsync1((e) { 29 expectAsync1((e) {
30 try { 30 try {
31 // Nuke object store if it already exists. 31 // Nuke object store if it already exists.
32 db.deleteObjectStore(STORE_NAME); 32 db.deleteObjectStore(STORE_NAME);
33 } catch (IDBDatabaseException e) { } 33 } catch (IDBDatabaseException e) { }
34 db.createObjectStore(STORE_NAME); 34 db.createObjectStore(STORE_NAME);
35 writeItems(0); 35
36 var transaction = e.target.result;
37 transaction.on.complete.add(expectAsync1((e) => writeItems(0)));
38 transaction.on.error.add(fail);
36 }) 39 })
37 ); 40 );
38 request.on.error.add(fail('setVersion error')); 41 request.on.error.add(fail('setVersion error'));
39 } 42 }
40 43
41 writeItems(int index) { 44 writeItems(int index) {
42 if (index < 100) { 45 if (index < 100) {
43 var transaction = db.transaction([STORE_NAME], 'readwrite'); 46 var transaction = db.transaction([STORE_NAME], 'readwrite');
44 var request = transaction.objectStore(STORE_NAME) 47 var request = transaction.objectStore(STORE_NAME)
45 .put('Item $index', index); 48 .put('Item $index', index);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 113 }
111 114
112 main() { 115 main() {
113 useHtmlConfiguration(); 116 useHtmlConfiguration();
114 117
115 var test_ = new Test(); 118 var test_ = new Test();
116 test('prepare', test_.start); 119 test('prepare', test_.start);
117 test('readAll1', test_.readAllViaCursor); 120 test('readAll1', test_.readAllViaCursor);
118 test('readAll2', test_.readAllReversedViaCursor); 121 test('readAll2', test_.readAllReversedViaCursor);
119 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698