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

Unified Diff: tests/html/indexeddb_4_test.dart

Issue 12040059: Converting tests over to using event streams. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: tests/html/indexeddb_4_test.dart
diff --git a/tests/html/indexeddb_4_test.dart b/tests/html/indexeddb_4_test.dart
index d8a134147e6a53d9e8a256d6b164c8200957af32..6704af095d14de3fcac77dc88e5a53d00f13d78a 100644
--- a/tests/html/indexeddb_4_test.dart
+++ b/tests/html/indexeddb_4_test.dart
@@ -32,43 +32,43 @@ class Test {
var request = window.indexedDB.open(DB_NAME, VERSION);
if (request is OpenDBRequest) {
// New upgrade protocol.
- request.on.success.add(expectAsync1((e) {
+ request.onSuccess.listen(expectAsync1((e) {
db = e.target.result;
afterOpen();
}));
- request.on.upgradeNeeded.add((e) {
+ request.onUpgradeNeeded.listen((e) {
guardAsync(() {
_createObjectStore(e.target.result);
});
});
- request.on.error.add(fail('open'));
+ request.onError.listen(fail('open'));
} else {
// Legacy setVersion upgrade protocol.
- request.on.success.add(expectAsync1((e) {
+ request.onSuccess.listen(expectAsync1((e) {
db = e.target.result;
if (db.version != '$VERSION') {
var setRequest = db.setVersion('$VERSION');
- setRequest.on.success.add(
+ setRequest.onSuccess.listen(
expectAsync1((e) {
_createObjectStore(db);
var transaction = e.target.result;
- transaction.on.complete.add(
+ transaction.onComplete.listen(
expectAsync1((e) => afterOpen()));
- transaction.on.error.add(fail('Upgrade'));
+ transaction.onError.listen(fail('Upgrade'));
}));
- setRequest.on.error.add(fail('setVersion error'));
+ setRequest.onError.listen(fail('setVersion error'));
} else {
afterOpen();
}
}));
- request.on.error.add(fail('open'));
+ request.onError.listen(fail('open'));
}
}
_createAndOpenDb(afterOpen()) {
var request = window.indexedDB.deleteDatabase(DB_NAME);
- request.on.success.add(expectAsync1((e) { _openDb(afterOpen); }));
- request.on.error.add(fail('delete old Db'));
+ request.onSuccess.listen(expectAsync1((e) { _openDb(afterOpen); }));
+ request.onError.listen(fail('delete old Db'));
}
writeItems(int index) {
@@ -76,11 +76,11 @@ class Test {
var transaction = db.transaction([STORE_NAME], 'readwrite');
var request = transaction.objectStore(STORE_NAME)
.put('Item $index', index);
- request.on.success.add(expectAsync1((e) {
+ request.onSuccess.listen(expectAsync1((e) {
writeItems(index + 1);
}
));
- request.on.error.add(fail('put'));
+ request.onError.listen(fail('put'));
}
}
@@ -93,7 +93,7 @@ class Test {
int itemCount = 0;
int firstKey = null;
int lastKey = null;
- cursorRequest.on.success.add(expectAsync1((e) {
+ cursorRequest.onSuccess.listen(expectAsync1((e) {
var cursor = e.target.result;
if (cursor != null) {
if (firstKey == null) firstKey = cursor.key;
@@ -114,7 +114,7 @@ class Test {
},
count: 1 + ((expectedFirst == null) ?
0 : (expectedLast - expectedFirst + 1))));
- cursorRequest.on.error.add(fail('openCursor'));
+ cursorRequest.onError.listen(fail('openCursor'));
}
only1() => testRange(new KeyRange.only(55), 55, 55);

Powered by Google App Engine
This is Rietveld 408576698