OLD | NEW |
1 dart_library.library('lib/html/indexeddb_5_test', null, /* Imports */[ | 1 dart_library.library('lib/html/indexeddb_5_test', null, /* Imports */[ |
2 'dart_sdk', | 2 'dart_sdk', |
3 'unittest' | 3 'unittest' |
4 ], function load__indexeddb_5_test(exports, dart_sdk, unittest) { | 4 ], function load__indexeddb_5_test(exports, dart_sdk, unittest) { |
5 'use strict'; | 5 'use strict'; |
6 const core = dart_sdk.core; | 6 const core = dart_sdk.core; |
7 const indexed_db = dart_sdk.indexed_db; | 7 const indexed_db = dart_sdk.indexed_db; |
8 const html = dart_sdk.html; | 8 const html = dart_sdk.html; |
9 const async = dart_sdk.async; | 9 const async = dart_sdk.async; |
10 const _interceptors = dart_sdk._interceptors; | 10 const _interceptors = dart_sdk._interceptors; |
(...skipping 28 matching lines...) Expand all Loading... |
39 let objectStore = dart.dsend(db, 'createObjectStore', storeName, {autoIn
crement: true}); | 39 let objectStore = dart.dsend(db, 'createObjectStore', storeName, {autoIn
crement: true}); |
40 let index = dart.dsend(objectStore, 'createIndex', indexName, 'name_inde
x', {unique: false}); | 40 let index = dart.dsend(objectStore, 'createIndex', indexName, 'name_inde
x', {unique: false}); |
41 }, dynamicTovoid())}), IdbFactoryToFutureOfDatabase())).then(dart.dynamic)
(dart.fn(database => { | 41 }, dynamicTovoid())}), IdbFactoryToFutureOfDatabase())).then(dart.dynamic)
(dart.fn(database => { |
42 db = database; | 42 db = database; |
43 }, DatabaseTodynamic())), VoidToFuture())); | 43 }, DatabaseTodynamic())), VoidToFuture())); |
44 if (dart.test(html.window[dartx.indexedDB][dartx.supportsDatabaseNames])) { | 44 if (dart.test(html.window[dartx.indexedDB][dartx.supportsDatabaseNames])) { |
45 unittest$.test('getDatabaseNames', dart.fn(() => html.window[dartx.indexed
DB][dartx.getDatabaseNames]().then(dart.dynamic)(dart.fn(names => { | 45 unittest$.test('getDatabaseNames', dart.fn(() => html.window[dartx.indexed
DB][dartx.getDatabaseNames]().then(dart.dynamic)(dart.fn(names => { |
46 src__matcher__expect.expect(names[dartx.contains](dbName), src__matcher_
_core_matchers.isTrue); | 46 src__matcher__expect.expect(names[dartx.contains](dbName), src__matcher_
_core_matchers.isTrue); |
47 }, ListOfStringTodynamic())), VoidToFuture())); | 47 }, ListOfStringTodynamic())), VoidToFuture())); |
48 } | 48 } |
49 let value = dart.map({name_index: 'one', value: 'add_value'}); | 49 let value = dart.map({name_index: 'one', value: 'add_value'}, core.String, c
ore.String); |
50 unittest$.test('add/delete', dart.fn(() => { | 50 unittest$.test('add/delete', dart.fn(() => { |
51 let transaction = dart.dsend(db, 'transaction', storeName, 'readwrite'); | 51 let transaction = dart.dsend(db, 'transaction', storeName, 'readwrite'); |
52 let key = null; | 52 let key = null; |
53 return dart.dsend(dart.dsend(dart.dsend(dart.dsend(dart.dsend(dart.dsend(d
art.dsend(dart.dsend(dart.dsend(dart.dsend(transaction, 'objectStore', storeName
), 'add', value), 'then', dart.fn(addedKey => { | 53 return dart.dsend(dart.dsend(dart.dsend(dart.dsend(dart.dsend(dart.dsend(d
art.dsend(dart.dsend(dart.dsend(dart.dsend(transaction, 'objectStore', storeName
), 'add', value), 'then', dart.fn(addedKey => { |
54 key = addedKey; | 54 key = addedKey; |
55 }, dynamicTodynamic())), 'then', dart.fn(_ => dart.dload(transaction, 'com
pleted'), dynamicTodynamic())), 'then', dart.fn(_ => { | 55 }, dynamicTodynamic())), 'then', dart.fn(_ => dart.dload(transaction, 'com
pleted'), dynamicTodynamic())), 'then', dart.fn(_ => { |
56 transaction = dart.dsend(db, 'transaction', storeName, 'readonly'); | 56 transaction = dart.dsend(db, 'transaction', storeName, 'readonly'); |
57 return dart.dsend(dart.dsend(transaction, 'objectStore', storeName), 'ge
tObject', key); | 57 return dart.dsend(dart.dsend(transaction, 'objectStore', storeName), 'ge
tObject', key); |
58 }, dynamicTodynamic())), 'then', dart.fn(readValue => { | 58 }, dynamicTodynamic())), 'then', dart.fn(readValue => { |
59 src__matcher__expect.expect(dart.dindex(readValue, 'value'), value[dartx
.get]('value')); | 59 src__matcher__expect.expect(dart.dindex(readValue, 'value'), value[dartx
.get]('value')); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return dart.dsend(index, 'get', 'one'); | 120 return dart.dsend(index, 'get', 'one'); |
121 }, dynamicTodynamic())), 'then', dart.fn(readValue => { | 121 }, dynamicTodynamic())), 'then', dart.fn(readValue => { |
122 src__matcher__expect.expect(dart.dindex(readValue, 'value'), value[dartx
.get]('value')); | 122 src__matcher__expect.expect(dart.dindex(readValue, 'value'), value[dartx
.get]('value')); |
123 return dart.dload(transaction, 'completed'); | 123 return dart.dload(transaction, 'completed'); |
124 }, dynamicTodynamic())), 'then', dart.fn(_ => { | 124 }, dynamicTodynamic())), 'then', dart.fn(_ => { |
125 transaction = dart.dsend(db, 'transaction', storeName, 'readwrite'); | 125 transaction = dart.dsend(db, 'transaction', storeName, 'readwrite'); |
126 dart.dsend(dart.dsend(transaction, 'objectStore', storeName), 'clear'); | 126 dart.dsend(dart.dsend(transaction, 'objectStore', storeName), 'clear'); |
127 return dart.dload(transaction, 'completed'); | 127 return dart.dload(transaction, 'completed'); |
128 }, dynamicTodynamic())); | 128 }, dynamicTodynamic())); |
129 }, VoidTodynamic())); | 129 }, VoidTodynamic())); |
130 let deleteValue = dart.map({name_index: 'two', value: 'delete_value'}); | 130 let deleteValue = dart.map({name_index: 'two', value: 'delete_value'}, core.
String, core.String); |
131 let updateValue = dart.map({name_index: 'three', value: 'update_value'}); | 131 let updateValue = dart.map({name_index: 'three', value: 'update_value'}, cor
e.String, core.String); |
132 let updatedValue = dart.map({name_index: 'three', value: 'updated_value'}); | 132 let updatedValue = dart.map({name_index: 'three', value: 'updated_value'}, c
ore.String, core.String); |
133 unittest$.test('cursor', dart.fn(() => { | 133 unittest$.test('cursor', dart.fn(() => { |
134 let transaction = dart.dsend(db, 'transaction', storeName, 'readwrite'); | 134 let transaction = dart.dsend(db, 'transaction', storeName, 'readwrite'); |
135 dart.dsend(dart.dsend(transaction, 'objectStore', storeName), 'add', value
); | 135 dart.dsend(dart.dsend(transaction, 'objectStore', storeName), 'add', value
); |
136 dart.dsend(dart.dsend(transaction, 'objectStore', storeName), 'add', delet
eValue); | 136 dart.dsend(dart.dsend(transaction, 'objectStore', storeName), 'add', delet
eValue); |
137 dart.dsend(dart.dsend(transaction, 'objectStore', storeName), 'add', updat
eValue); | 137 dart.dsend(dart.dsend(transaction, 'objectStore', storeName), 'add', updat
eValue); |
138 return dart.dsend(dart.dsend(dart.dsend(dart.dsend(dart.dsend(dart.dsend(d
art.dload(transaction, 'completed'), 'then', dart.fn(_ => { | 138 return dart.dsend(dart.dsend(dart.dsend(dart.dsend(dart.dsend(dart.dsend(d
art.dload(transaction, 'completed'), 'then', dart.fn(_ => { |
139 transaction = dart.dsend(db, 'transactionList', JSArrayOfString().of([st
oreName]), 'readwrite'); | 139 transaction = dart.dsend(db, 'transactionList', JSArrayOfString().of([st
oreName]), 'readwrite'); |
140 let index = dart.dsend(dart.dsend(transaction, 'objectStore', storeName)
, 'index', indexName); | 140 let index = dart.dsend(dart.dsend(transaction, 'objectStore', storeName)
, 'index', indexName); |
141 let cursors = dart.dsend(dart.dsend(index, 'openCursor'), 'asBroadcastSt
ream'); | 141 let cursors = dart.dsend(dart.dsend(index, 'openCursor'), 'asBroadcastSt
ream'); |
142 dart.dsend(cursors, 'listen', dart.fn(cursor => { | 142 dart.dsend(cursors, 'listen', dart.fn(cursor => { |
(...skipping 25 matching lines...) Expand all Loading... |
168 }, dynamicTodynamic())), 'then', dart.fn(readValue => { | 168 }, dynamicTodynamic())), 'then', dart.fn(readValue => { |
169 src__matcher__expect.expect(readValue, src__matcher__core_matchers.isNul
l); | 169 src__matcher__expect.expect(readValue, src__matcher__core_matchers.isNul
l); |
170 return dart.dload(transaction, 'completed'); | 170 return dart.dload(transaction, 'completed'); |
171 }, dynamicTodynamic())); | 171 }, dynamicTodynamic())); |
172 }, VoidTodynamic())); | 172 }, VoidTodynamic())); |
173 }; | 173 }; |
174 dart.fn(indexeddb_5_test.main, VoidTodynamic()); | 174 dart.fn(indexeddb_5_test.main, VoidTodynamic()); |
175 // Exports: | 175 // Exports: |
176 exports.indexeddb_5_test = indexeddb_5_test; | 176 exports.indexeddb_5_test = indexeddb_5_test; |
177 }); | 177 }); |
OLD | NEW |