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

Unified Diff: tests/html/indexeddb_2_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_2_test.dart
diff --git a/tests/html/indexeddb_2_test.dart b/tests/html/indexeddb_2_test.dart
index ac41b3d98d4ae0043d9aff0e630cf858ad56dc9a..66fef6c89f7c5fc9ccafef47eb36c299877da655 100644
--- a/tests/html/indexeddb_2_test.dart
+++ b/tests/html/indexeddb_2_test.dart
@@ -32,19 +32,19 @@ testReadWrite(key, value, check,
step2(e) {
var transaction = db.transaction(storeName, 'readonly');
var request = transaction.objectStore(storeName).getObject(key);
- request.on.success.add(expectAsync1((e) {
+ request.onSuccess.listen(expectAsync1((e) {
var object = e.target.result;
db.close();
check(value, object);
}));
- request.on.error.add(fail);
+ request.onError.listen(fail);
}
step1() {
var transaction = db.transaction([storeName], 'readwrite');
var request = transaction.objectStore(storeName).put(value, key);
- request.on.success.add(expectAsync1(step2));
- request.on.error.add(fail);
+ request.onSuccess.listen(expectAsync1(step2));
+ request.onError.listen(fail);
}
initDb(e) {
@@ -52,15 +52,15 @@ testReadWrite(key, value, check,
if (version != db.version) {
// Legacy 'setVersion' upgrade protocol.
var request = db.setVersion('$version');
- request.on.success.add(
+ request.onSuccess.listen(
expectAsync1((e) {
createObjectStore(db);
var transaction = e.target.result;
- transaction.on.complete.add(expectAsync1((e) => step1()));
- transaction.on.error.add(fail);
+ transaction.onComplete.listen(expectAsync1((e) => step1()));
+ transaction.onError.listen(fail);
})
);
- request.on.error.add(fail);
+ request.onError.listen(fail);
} else {
step1();
}
@@ -69,12 +69,12 @@ testReadWrite(key, value, check,
openDb(e) {
var request = html.window.indexedDB.open(dbName, version);
expect(request, isNotNull);
- request.on.success.add(expectAsync1(initDb));
- request.on.error.add(fail);
+ request.onSuccess.listen(expectAsync1(initDb));
+ request.onError.listen(fail);
if (request is idb.OpenDBRequest) {
// New upgrade protocol. Old API has no 'upgradeNeeded' and uses
// setVersion instead.
- request.on.upgradeNeeded.add((e) {
+ request.onUpgradeNeeded.listen((e) {
guardAsync(() {
createObjectStore(e.target.result);
});
@@ -84,8 +84,8 @@ testReadWrite(key, value, check,
// Delete any existing DB.
var deleteRequest = html.window.indexedDB.deleteDatabase(dbName);
- deleteRequest.on.success.add(expectAsync1(openDb));
- deleteRequest.on.error.add(fail);
+ deleteRequest.onSuccess.listen(expectAsync1(openDb));
+ deleteRequest.onError.listen(fail);
};

Powered by Google App Engine
This is Rietveld 408576698