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

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, 5 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
« no previous file with comments | « tests/html/form_data_test.dart ('k') | tests/html/indexeddb_2_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 var store = e.target.result.createObjectStore(storeName); 45 var store = e.target.result.createObjectStore(storeName);
46 expect(store, isNotNull); 46 expect(store, isNotNull);
47 } 47 }
48 48
49 var db; 49 var db;
50 return html.window.indexedDB.deleteDatabase(dbName).then((_) { 50 return html.window.indexedDB.deleteDatabase(dbName).then((_) {
51 return html.window.indexedDB.open(dbName, version: version, 51 return html.window.indexedDB.open(dbName, version: version,
52 onUpgradeNeeded: createObjectStore); 52 onUpgradeNeeded: createObjectStore);
53 }).then((result) { 53 }).then((result) {
54 db = result; 54 db = result;
55 var transaction = db.transaction([storeName], 'readwrite'); 55 var transaction = db.transactionList([storeName], 'readwrite');
56 transaction.objectStore(storeName).put(value, key); 56 transaction.objectStore(storeName).put(value, key);
57 return transaction.completed; 57 return transaction.completed;
58 }).then((_) { 58 }).then((_) {
59 var transaction = db.transaction(storeName, 'readonly'); 59 var transaction = db.transaction(storeName, 'readonly');
60 return transaction.objectStore(storeName).getObject(key); 60 return transaction.objectStore(storeName).getObject(key);
61 }).then((object) { 61 }).then((object) {
62 db.close(); 62 db.close();
63 expect(object, matcher); 63 expect(object, matcher);
64 }).whenComplete(() { 64 }).whenComplete(() {
65 if (db != null) { 65 if (db != null) {
(...skipping 13 matching lines...) Expand all
79 expect(store, isNotNull); 79 expect(store, isNotNull);
80 } 80 }
81 81
82 idb.Database db; 82 idb.Database db;
83 // Delete any existing DBs. 83 // Delete any existing DBs.
84 return html.window.indexedDB.deleteDatabase(dbName).then((_) { 84 return html.window.indexedDB.deleteDatabase(dbName).then((_) {
85 return html.window.indexedDB.open(dbName, version: version, 85 return html.window.indexedDB.open(dbName, version: version,
86 onUpgradeNeeded: createObjectStore); 86 onUpgradeNeeded: createObjectStore);
87 }).then((idb.Database result) { 87 }).then((idb.Database result) {
88 db = result; 88 db = result;
89 idb.Transaction transaction = db.transaction([storeName], 'readwrite'); 89 idb.Transaction transaction = db.transactionList([storeName], 'readwrite') ;
90 transaction.objectStore(storeName).put(value, key); 90 transaction.objectStore(storeName).put(value, key);
91 91
92 return transaction.completed; 92 return transaction.completed;
93 }).then((idb.Database result) { 93 }).then((idb.Database result) {
94 idb.Transaction transaction = db.transaction(storeName, 'readonly'); 94 idb.Transaction transaction = db.transaction(storeName, 'readonly');
95 return transaction.objectStore(storeName).getObject(key); 95 return transaction.objectStore(storeName).getObject(key);
96 }).then((object) { 96 }).then((object) {
97 db.close(); 97 db.close();
98 expect(object, matcher); 98 expect(object, matcher);
99 }).whenComplete(() { 99 }).whenComplete(() {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 }); 149 });
150 150
151 // Don't bother with these tests if it's unsupported. 151 // Don't bother with these tests if it's unsupported.
152 if (idb.IdbFactory.supported) { 152 if (idb.IdbFactory.supported) {
153 test('upgrade', testUpgrade); 153 test('upgrade', testUpgrade);
154 tests_dynamic(); 154 tests_dynamic();
155 tests_typed(); 155 tests_typed();
156 } 156 }
157 }); 157 });
158 } 158 }
OLDNEW
« no previous file with comments | « tests/html/form_data_test.dart ('k') | tests/html/indexeddb_2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698