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

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

Issue 11419300: Dartifying dart:html type names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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_config.dart'; 3 import '../../pkg/unittest/lib/html_config.dart';
4 import 'dart:html'; 4 import 'dart:html' as html;
5 import 'dart:indexed_db' as idb;
5 import 'dart:collection'; 6 import 'dart:collection';
6 import 'utils.dart'; 7 import 'utils.dart';
7 8
8 // Write and re-read Maps: simple Maps; Maps with DAGs; Maps with cycles. 9 // Write and re-read Maps: simple Maps; Maps with DAGs; Maps with cycles.
9 10
10 const String DB_NAME = 'Test'; 11 const String DB_NAME = 'Test';
11 const String STORE_NAME = 'TEST'; 12 const String STORE_NAME = 'TEST';
12 const int VERSION = 1; 13 const int VERSION = 1;
13 14
14 testReadWrite(key, value, check, 15 testReadWrite(key, value, check,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 transaction.on.error.add(fail); 60 transaction.on.error.add(fail);
60 }) 61 })
61 ); 62 );
62 request.on.error.add(fail); 63 request.on.error.add(fail);
63 } else { 64 } else {
64 step1(); 65 step1();
65 } 66 }
66 } 67 }
67 68
68 openDb(e) { 69 openDb(e) {
69 var request = window.indexedDB.open(dbName, version); 70 var request = html.window.indexedDB.open(dbName, version);
70 expect(request, isNotNull); 71 expect(request, isNotNull);
71 request.on.success.add(expectAsync1(initDb)); 72 request.on.success.add(expectAsync1(initDb));
72 request.on.error.add(fail); 73 request.on.error.add(fail);
73 if (request is IDBOpenDBRequest) { 74 if (request is idb.OpenDBRequest) {
74 // New upgrade protocol. Old API has no 'upgradeNeeded' and uses 75 // New upgrade protocol. Old API has no 'upgradeNeeded' and uses
75 // setVersion instead. 76 // setVersion instead.
76 request.on.upgradeNeeded.add((e) { 77 request.on.upgradeNeeded.add((e) {
77 guardAsync(() { 78 guardAsync(() {
78 createObjectStore(e.target.result); 79 createObjectStore(e.target.result);
79 }); 80 });
80 }); 81 });
81 } 82 }
82 } 83 }
83 84
84 // Delete any existing DB. 85 // Delete any existing DB.
85 var deleteRequest = window.indexedDB.deleteDatabase(dbName); 86 var deleteRequest = html.window.indexedDB.deleteDatabase(dbName);
86 deleteRequest.on.success.add(expectAsync1(openDb)); 87 deleteRequest.on.success.add(expectAsync1(openDb));
87 deleteRequest.on.error.add(fail); 88 deleteRequest.on.error.add(fail);
88 }; 89 };
89 90
90 91
91 main() { 92 main() {
92 useHtmlConfiguration(); 93 useHtmlConfiguration();
93 94
94 var obj1 = {'a': 100, 'b': 's'}; 95 var obj1 = {'a': 100, 'b': 's'};
95 var obj2 = {'x': obj1, 'y': obj1}; // DAG. 96 var obj2 = {'x': obj1, 'y': obj1}; // DAG.
(...skipping 28 matching lines...) Expand all
124 go('test_simple', obj1); 125 go('test_simple', obj1);
125 go('test_DAG', obj2); 126 go('test_DAG', obj2);
126 go('test_cycle', obj3); 127 go('test_cycle', obj3);
127 go('test_simple_splay', obj4); 128 go('test_simple_splay', obj4);
128 go('const_array_1', const [const [1], const [2]]); 129 go('const_array_1', const [const [1], const [2]]);
129 go('const_array_dag', const [const [1], const [1]]); 130 go('const_array_dag', const [const [1], const [1]]);
130 go('array_deferred_copy', [1,2,3, obj3, obj3, 6]); 131 go('array_deferred_copy', [1,2,3, obj3, obj3, 6]);
131 go('array_deferred_copy_2', [1,2,3, [4, 5, obj3], [obj3, 6]]); 132 go('array_deferred_copy_2', [1,2,3, [4, 5, obj3], [obj3, 6]]);
132 go('cyclic_list', cyclic_list); 133 go('cyclic_list', cyclic_list);
133 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698