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

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

Issue 16494002: Expand overloaded methods and optional parameters in the html library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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
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
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 var store = e.target.result.createObjectStore(storeName); 46 var store = e.target.result.createObjectStore(storeName);
47 expect(store, isNotNull); 47 expect(store, isNotNull);
48 } 48 }
49 49
50 var db; 50 var db;
51 return html.window.indexedDB.deleteDatabase(dbName).then((_) { 51 return html.window.indexedDB.deleteDatabase(dbName).then((_) {
52 return html.window.indexedDB.open(dbName, version: version, 52 return html.window.indexedDB.open(dbName, version: version,
53 onUpgradeNeeded: createObjectStore); 53 onUpgradeNeeded: createObjectStore);
54 }).then((result) { 54 }).then((result) {
55 db = result; 55 db = result;
56 var transaction = db.transaction([storeName], 'readwrite'); 56 var transaction = db.transactionList([storeName], 'readwrite');
57 transaction.objectStore(storeName).put(value, key); 57 transaction.objectStore(storeName).put(value, key);
58 return transaction.completed; 58 return transaction.completed;
59 }).then((_) { 59 }).then((_) {
60 var transaction = db.transaction(storeName, 'readonly'); 60 var transaction = db.transaction(storeName, 'readonly');
61 return transaction.objectStore(storeName).getObject(key); 61 return transaction.objectStore(storeName).getObject(key);
62 }).then((object) { 62 }).then((object) {
63 db.close(); 63 db.close();
64 expect(object, matcher); 64 expect(object, matcher);
65 }).whenComplete(() { 65 }).whenComplete(() {
66 if (db != null) { 66 if (db != null) {
(...skipping 13 matching lines...) Expand all
80 expect(store, isNotNull); 80 expect(store, isNotNull);
81 } 81 }
82 82
83 idb.Database db; 83 idb.Database db;
84 // Delete any existing DBs. 84 // Delete any existing DBs.
85 return html.window.indexedDB.deleteDatabase(dbName).then((_) { 85 return html.window.indexedDB.deleteDatabase(dbName).then((_) {
86 return html.window.indexedDB.open(dbName, version: version, 86 return html.window.indexedDB.open(dbName, version: version,
87 onUpgradeNeeded: createObjectStore); 87 onUpgradeNeeded: createObjectStore);
88 }).then((idb.Database result) { 88 }).then((idb.Database result) {
89 db = result; 89 db = result;
90 idb.Transaction transaction = db.transaction([storeName], 'readwrite'); 90 idb.Transaction transaction = db.transactionList([storeName], 'readwrite') ;
91 transaction.objectStore(storeName).put(value, key); 91 transaction.objectStore(storeName).put(value, key);
92 92
93 return transaction.completed; 93 return transaction.completed;
94 }).then((idb.Database result) { 94 }).then((idb.Database result) {
95 idb.Transaction transaction = db.transaction(storeName, 'readonly'); 95 idb.Transaction transaction = db.transaction(storeName, 'readonly');
96 return transaction.objectStore(storeName).getObject(key); 96 return transaction.objectStore(storeName).getObject(key);
97 }).then((object) { 97 }).then((object) {
98 db.close(); 98 db.close();
99 expect(object, matcher); 99 expect(object, matcher);
100 }).whenComplete(() { 100 }).whenComplete(() {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 }); 150 });
151 151
152 // Don't bother with these tests if it's unsupported. 152 // Don't bother with these tests if it's unsupported.
153 if (idb.IdbFactory.supported) { 153 if (idb.IdbFactory.supported) {
154 test('upgrade', testUpgrade); 154 test('upgrade', testUpgrade);
155 tests_dynamic(); 155 tests_dynamic();
156 tests_typed(); 156 tests_typed();
157 } 157 }
158 }); 158 });
159 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698