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

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

Issue 11664009: Adjustments to next Chrome roll. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
OLDNEW
1 library IndexedDB3Test; 1 library IndexedDB3Test;
2 import '../../pkg/unittest/lib/unittest.dart'; 2 import '../../pkg/unittest/lib/unittest.dart';
3 import '../../pkg/unittest/lib/html_config.dart'; 3 import '../../pkg/unittest/lib/html_config.dart';
4 import 'dart:html'; 4 import 'dart:html';
5 import 'dart:indexed_db'; 5 import 'dart:indexed_db';
6 6
7 // Read with cursor. 7 // Read with cursor.
8 8
9 const String DB_NAME = 'Test'; 9 const String DB_NAME = 'Test';
10 const String STORE_NAME = 'TEST'; 10 const String STORE_NAME = 'TEST';
11 const int VERSION = 1; 11 const int VERSION = 1;
12 12
13 class Test { 13 class Test {
14 fail(message) => (e) { 14 fail(message) => (e) {
15 guardAsync(() { 15 guardAsync(() {
16 expect(false, isTrue, reason: 'IndexedDB failure: $message'); 16 expect(false, isTrue, reason: 'IndexedDB failure: $message');
17 }); 17 });
18 }; 18 };
19 19
20 _createObjectStore(db) { 20 _createObjectStore(db) {
21 try { 21 try {
22 // Nuke object store if it already exists. 22 // Nuke object store if it already exists.
23 db.deleteObjectStore(STORE_NAME); 23 db.deleteObjectStore(STORE_NAME);
24 } 24 }
25 on DatabaseException catch(e) { } // Chrome
antonm 2012/12/21 15:38:12 DatabaseException was killed, one should use DomEx
26 on DomException catch(e) { } // Firefox 25 on DomException catch(e) { } // Firefox
27 db.createObjectStore(STORE_NAME); 26 db.createObjectStore(STORE_NAME);
28 } 27 }
29 28
30 var db; 29 var db;
31 30
32 _openDb(afterOpen()) { 31 _openDb(afterOpen()) {
33 var request = window.indexedDB.open(DB_NAME, VERSION); 32 var request = window.indexedDB.open(DB_NAME, VERSION);
34 if (request is OpenDBRequest) { 33 if (request is OpenDBRequest) {
35 // New upgrade protocol. FireFox 15, Chrome 24, hopefully IE10. 34 // New upgrade protocol. FireFox 15, Chrome 24, hopefully IE10.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 140 }
142 141
143 main() { 142 main() {
144 useHtmlConfiguration(); 143 useHtmlConfiguration();
145 144
146 var test_ = new Test(); 145 var test_ = new Test();
147 test('prepare', test_.setupDb); 146 test('prepare', test_.setupDb);
148 test('readAll1', test_.readAllViaCursor); 147 test('readAll1', test_.readAllViaCursor);
149 test('readAll2', test_.readAllReversedViaCursor); 148 test('readAll2', test_.readAllReversedViaCursor);
150 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698