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

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

Issue 18173004: Updating indexed_db test to account for fixed blocking bug. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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
« no previous file with comments | « no previous file | 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 library IndexedDB1Test; 1 library IndexedDB1Test;
2 import '../../pkg/unittest/lib/unittest.dart'; 2 import '../../pkg/unittest/lib/unittest.dart';
3 import '../../pkg/unittest/lib/html_individual_config.dart'; 3 import '../../pkg/unittest/lib/html_individual_config.dart';
4 import 'dart:async'; 4 import 'dart:async';
5 import 'dart:html' as html; 5 import 'dart:html' as html;
6 import 'dart:indexed_db' as idb; 6 import 'dart:indexed_db' as idb;
7 7
8 const String STORE_NAME = 'TEST'; 8 const String STORE_NAME = 'TEST';
9 const int VERSION = 1; 9 const int VERSION = 1;
10 10
11 var databaseNameIndex = 0; 11 var databaseNameIndex = 0;
12 String nextDatabaseName() { 12 String nextDatabaseName() {
13 return 'Test1_${databaseNameIndex++}'; 13 return 'Test1_${databaseNameIndex++}';
14 } 14 }
15 15
16 Future testUpgrade() { 16 Future testUpgrade() {
17 var dbName = nextDatabaseName(); 17 var dbName = nextDatabaseName();
18 var upgraded = false; 18 var upgraded = false;
19 19
20 // Delete any existing DBs. 20 // Delete any existing DBs.
21 return html.window.indexedDB.deleteDatabase(dbName).then((_) { 21 return html.window.indexedDB.deleteDatabase(dbName).then((_) {
22 22
23 return html.window.indexedDB.open(dbName, version: 1, 23 return html.window.indexedDB.open(dbName, version: 1,
24 onUpgradeNeeded: (e) {}); 24 onUpgradeNeeded: (e) {});
25 }).then((db) { 25 }).then((db) {
26 db.close(); 26 db.close();
27 }).then((_) { 27 }).then((_) {
28 return html.window.indexedDB.open(dbName, version: 2, 28 return html.window.indexedDB.open(dbName, version: 2,
29 onUpgradeNeeded: (e) { 29 onUpgradeNeeded: (e) {
30 // Bug 8265, we're getting the wrong type here. 30 expect(e.oldVersion, 1);
31 //expect(e.oldVersion, 1); 31 expect(e.newVersion, 2);
32 //expect(e.newVersion, 2);
33 upgraded = true; 32 upgraded = true;
34 }); 33 });
35 }).then((_) { 34 }).then((_) {
36 expect(upgraded, isTrue); 35 expect(upgraded, isTrue);
37 }); 36 });
38 } 37 }
39 38
40 testReadWrite(key, value, matcher, 39 testReadWrite(key, value, matcher,
41 [dbName, storeName = STORE_NAME, version = VERSION]) => () { 40 [dbName, storeName = STORE_NAME, version = VERSION]) => () {
42 if (dbName == null) { 41 if (dbName == null) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 }); 149 });
151 150
152 // Don't bother with these tests if it's unsupported. 151 // Don't bother with these tests if it's unsupported.
153 if (idb.IdbFactory.supported) { 152 if (idb.IdbFactory.supported) {
154 test('upgrade', testUpgrade); 153 test('upgrade', testUpgrade);
155 tests_dynamic(); 154 tests_dynamic();
156 tests_typed(); 155 tests_typed();
157 } 156 }
158 }); 157 });
159 } 158 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698