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

Unified Diff: tests/html/indexeddb_3_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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_3_test.dart
diff --git a/tests/html/indexeddb_3_test.dart b/tests/html/indexeddb_3_test.dart
index c5034c45f394b4b95573c86af3fc1a9d9108a91d..50a4d85ea652a2ba3958503c6e536eb7db01c89c 100644
--- a/tests/html/indexeddb_3_test.dart
+++ b/tests/html/indexeddb_3_test.dart
@@ -1,4 +1,5 @@
library IndexedDB3Test;
+
import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';
import 'dart:async';
@@ -11,14 +12,13 @@ const String DB_NAME = 'Test3';
const String STORE_NAME = 'TEST';
const int VERSION = 1;
-
Future<Database> createAndOpenDb() {
return html.window.indexedDB.deleteDatabase(DB_NAME).then((_) {
return html.window.indexedDB.open(DB_NAME, version: VERSION,
onUpgradeNeeded: (e) {
- var db = e.target.result;
- db.createObjectStore(STORE_NAME);
- });
+ var db = e.target.result;
+ db.createObjectStore(STORE_NAME);
+ });
});
}
@@ -50,20 +50,18 @@ Future<Database> readAllViaCursor(Database db) {
var lastKey = null;
var cursors = objectStore.openCursor().asBroadcastStream();
- cursors.listen(
- (cursor) {
- ++itemCount;
- lastKey = cursor.key;
- sumKeys += cursor.key;
- expect(cursor.value, 'Item ${cursor.key}');
- cursor.next();
- });
- cursors.last.then(
- (cursor) {
- expect(lastKey, 99);
- expect(sumKeys, (100 * 99) ~/ 2);
- expect(itemCount, 100);
- });
+ cursors.listen((cursor) {
+ ++itemCount;
+ lastKey = cursor.key;
+ sumKeys += cursor.key;
+ expect(cursor.value, 'Item ${cursor.key}');
+ cursor.next();
+ });
+ cursors.last.then((cursor) {
+ expect(lastKey, 99);
+ expect(sumKeys, (100 * 99) ~/ 2);
+ expect(itemCount, 100);
+ });
return cursors.last.then((_) => db);
}
@@ -76,20 +74,18 @@ Future<Database> readAllReversedViaCursor(Database db) {
var lastKey = null;
var cursors = objectStore.openCursor(direction: 'prev').asBroadcastStream();
- cursors.listen(
- (cursor) {
- ++itemCount;
- lastKey = cursor.key;
- sumKeys += cursor.key;
- expect(cursor.value, 'Item ${cursor.key}');
- cursor.next();
- });
- cursors.last.then(
- (cursor) {
- expect(lastKey, 0);
- expect(sumKeys, (100 * 99) ~/ 2);
- expect(itemCount, 100);
- });
+ cursors.listen((cursor) {
+ ++itemCount;
+ lastKey = cursor.key;
+ sumKeys += cursor.key;
+ expect(cursor.value, 'Item ${cursor.key}');
+ cursor.next();
+ });
+ cursors.last.then((cursor) {
+ expect(lastKey, 0);
+ expect(sumKeys, (100 * 99) ~/ 2);
+ expect(itemCount, 100);
+ });
return cursors.last.then((_) => db);
}
@@ -101,7 +97,9 @@ main() {
if (IdbFactory.supported) {
var db;
test('prepare', () {
- return setupDb().then((result) { db = result; });
+ return setupDb().then((result) {
+ db = result;
+ });
});
test('readAll1', () {
return readAllViaCursor(db);

Powered by Google App Engine
This is Rietveld 408576698