Chromium Code Reviews| Index: tests/html/indexeddb_1_test.dart |
| diff --git a/tests/html/indexeddb_1_test.dart b/tests/html/indexeddb_1_test.dart |
| index c57f8d11838cd3e83e4f8fee5e05ef91fe17825c..db0944385eaa390a5b67c7e60e173ad1c545b88a 100644 |
| --- a/tests/html/indexeddb_1_test.dart |
| +++ b/tests/html/indexeddb_1_test.dart |
| @@ -37,7 +37,8 @@ Future testUpgrade() { |
| } |
| testReadWrite(key, value, matcher, |
| - [dbName, storeName = STORE_NAME, version = VERSION]) => () { |
| + [dbName, storeName = STORE_NAME, version = VERSION, |
| + stringifyResult = false]) => () { |
| if (dbName == null) { |
| dbName = nextDatabaseName(); |
| } |
| @@ -60,7 +61,13 @@ testReadWrite(key, value, matcher, |
| return transaction.objectStore(storeName).getObject(key); |
| }).then((object) { |
| db.close(); |
| - expect(object, matcher); |
| + if (stringifyResult) { |
| + // Stringify the numbers to verify that we're correctly returning ints |
| + // as ints vs doubles. |
| + expect(object.toString(), matcher); |
| + } else { |
| + expect(object, matcher); |
| + } |
| }).whenComplete(() { |
| if (db != null) { |
| db.close(); |
| @@ -70,7 +77,8 @@ testReadWrite(key, value, matcher, |
| }; |
| testReadWriteTyped(key, value, matcher, |
| - [dbName, storeName = STORE_NAME, version = VERSION]) => () { |
| + [dbName, storeName = STORE_NAME, version = VERSION, |
| + stringifyResult = false]) => () { |
| if (dbName == null) { |
| dbName = nextDatabaseName(); |
| } |
| @@ -95,7 +103,13 @@ testReadWriteTyped(key, value, matcher, |
| return transaction.objectStore(storeName).getObject(key); |
| }).then((object) { |
| db.close(); |
| - expect(object, matcher); |
| + if (stringifyResult) { |
| + // Stringify the numbers to verify that we're correctly returning ints |
| + // as ints vs doubles. |
| + expect(object.toString(), matcher); |
| + } else { |
| + expect(object, matcher); |
| + } |
| }).whenComplete(() { |
| if (db != null) { |
| db.close(); |
| @@ -110,6 +124,10 @@ void testTypes(testFunction) { |
| test('List', testFunction(123, [1, 2, 3], equals([1, 2, 3]))); |
| test('List 2', testFunction(123, [2, 3, 4], equals([2, 3, 4]))); |
| test('bool', testFunction(123, [true, false], equals([true, false]))); |
| + test('largeInt', testFunction(123, 1371854424211, |
| + equals("1371854424211"), null, STORE_NAME, VERSION, true)); |
| + test('largeIntInMap', testFunction(123, {'time': 4503599627370492}, |
| + equals("{time: 4503599627370492}"), null, STORE_NAME, VERSION, true)); |
|
blois
2013/10/17 22:16:15
Can you add a double test or two here too?
|
| var now = new DateTime.now(); |
| test('DateTime', testFunction(123, now, |
| predicate((date) => |