Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <meta charset="utf-8"> |
michael@0 | 5 | <title>Test for DataStore - sync</title> |
michael@0 | 6 | </head> |
michael@0 | 7 | <body> |
michael@0 | 8 | <div id="container"></div> |
michael@0 | 9 | <script type="application/javascript;version=1.7"> |
michael@0 | 10 | |
michael@0 | 11 | var gStore; |
michael@0 | 12 | var gRevisions = []; |
michael@0 | 13 | var gCursor; |
michael@0 | 14 | var gExpectedEvents = true; |
michael@0 | 15 | |
michael@0 | 16 | function is(a, b, msg) { |
michael@0 | 17 | alert((a === b ? 'OK' : 'KO') + ' ' + msg) |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | function ok(a, msg) { |
michael@0 | 21 | alert((a ? 'OK' : 'KO')+ ' ' + msg) |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | function cbError() { |
michael@0 | 25 | alert('KO error'); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | function finish() { |
michael@0 | 29 | alert('DONE'); |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | function testGetDataStores() { |
michael@0 | 33 | navigator.getDataStores('foo').then(function(stores) { |
michael@0 | 34 | is(stores.length, 1, "getDataStores('foo') returns 1 element"); |
michael@0 | 35 | |
michael@0 | 36 | gStore = stores[0]; |
michael@0 | 37 | gRevisions.push(gStore.revisionId); |
michael@0 | 38 | |
michael@0 | 39 | gStore.onchange = function(aEvent) { |
michael@0 | 40 | ok(gExpectedEvents, "Events received!"); |
michael@0 | 41 | runTest(); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | runTest(); |
michael@0 | 45 | }, cbError); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | function testBasicInterface() { |
michael@0 | 49 | var cursor = gStore.sync(); |
michael@0 | 50 | ok(cursor, "Cursor is created"); |
michael@0 | 51 | is(cursor.store, gStore, "Cursor.store is the store"); |
michael@0 | 52 | |
michael@0 | 53 | ok("next" in cursor, "Cursor.next exists"); |
michael@0 | 54 | ok("close" in cursor, "Cursor.close exists"); |
michael@0 | 55 | |
michael@0 | 56 | cursor.close(); |
michael@0 | 57 | |
michael@0 | 58 | runTest(); |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | function testCursor(cursor, steps) { |
michael@0 | 62 | if (!steps.length) { |
michael@0 | 63 | runTest(); |
michael@0 | 64 | return; |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | var step = steps.shift(); |
michael@0 | 68 | cursor.next().then(function(data) { |
michael@0 | 69 | ok(!!data, "Cursor.next returns data"); |
michael@0 | 70 | is(data.operation, step.operation, "Waiting for operation: '" + step.operation + "' received '" + data.operation + "'"); |
michael@0 | 71 | |
michael@0 | 72 | |
michael@0 | 73 | switch (data.operation) { |
michael@0 | 74 | case 'done': |
michael@0 | 75 | is(/[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}/.test(data.revisionId), true, "done has a valid revisionId"); |
michael@0 | 76 | is (data.revisionId, gRevisions[gRevisions.length-1], "Last revision matches"); |
michael@0 | 77 | break; |
michael@0 | 78 | |
michael@0 | 79 | case 'add': |
michael@0 | 80 | case 'update': |
michael@0 | 81 | if ('id' in step) { |
michael@0 | 82 | is(data.id, step.id, "next() add: id matches: " + data.id + " " + step.id); |
michael@0 | 83 | } |
michael@0 | 84 | |
michael@0 | 85 | if ('data' in step) { |
michael@0 | 86 | is(data.data, step.data, "next() add: data matches: " + data.data + " " + step.data); |
michael@0 | 87 | } |
michael@0 | 88 | |
michael@0 | 89 | break; |
michael@0 | 90 | |
michael@0 | 91 | case 'remove': |
michael@0 | 92 | if ('id' in step) { |
michael@0 | 93 | is(data.id, step.id, "next() add: id matches: " + data.id + " " + step.id); |
michael@0 | 94 | } |
michael@0 | 95 | |
michael@0 | 96 | break; |
michael@0 | 97 | } |
michael@0 | 98 | |
michael@0 | 99 | testCursor(cursor, steps); |
michael@0 | 100 | }); |
michael@0 | 101 | } |
michael@0 | 102 | |
michael@0 | 103 | var tests = [ |
michael@0 | 104 | // Test for GetDataStore |
michael@0 | 105 | testGetDataStores, |
michael@0 | 106 | |
michael@0 | 107 | // interface test |
michael@0 | 108 | testBasicInterface, |
michael@0 | 109 | |
michael@0 | 110 | // empty DataStore |
michael@0 | 111 | function() { |
michael@0 | 112 | var cursor = gStore.sync(); |
michael@0 | 113 | var steps = [ { operation: 'clear' }, |
michael@0 | 114 | { operation: 'done' }, |
michael@0 | 115 | { operation: 'done' }]; |
michael@0 | 116 | testCursor(cursor, steps); |
michael@0 | 117 | }, |
michael@0 | 118 | |
michael@0 | 119 | function() { |
michael@0 | 120 | gExpectedEvents = false; |
michael@0 | 121 | var cursor = gStore.sync('wrong revision ID'); |
michael@0 | 122 | var steps = [ { operation: 'clear' }, |
michael@0 | 123 | { operation: 'done' }, |
michael@0 | 124 | { operation: 'done' }]; |
michael@0 | 125 | testCursor(cursor, steps); |
michael@0 | 126 | }, |
michael@0 | 127 | |
michael@0 | 128 | function() { |
michael@0 | 129 | var cursor = gStore.sync(gRevisions[0]); |
michael@0 | 130 | var steps = [ { operation: 'done' }, |
michael@0 | 131 | { operation: 'done' }]; |
michael@0 | 132 | testCursor(cursor, steps); |
michael@0 | 133 | }, |
michael@0 | 134 | |
michael@0 | 135 | // Test add from scratch |
michael@0 | 136 | function() { |
michael@0 | 137 | gExpectedEvents = true; |
michael@0 | 138 | |
michael@0 | 139 | gStore.add(1).then(function(id) { |
michael@0 | 140 | gRevisions.push(gStore.revisionId); |
michael@0 | 141 | ok(true, "Item: " + id + " added"); |
michael@0 | 142 | }); |
michael@0 | 143 | }, |
michael@0 | 144 | |
michael@0 | 145 | function() { |
michael@0 | 146 | gStore.add(2,"foobar").then(function(id) { |
michael@0 | 147 | gRevisions.push(gStore.revisionId); |
michael@0 | 148 | ok(true, "Item: " + id + " added"); |
michael@0 | 149 | }); |
michael@0 | 150 | }, |
michael@0 | 151 | |
michael@0 | 152 | function() { |
michael@0 | 153 | gStore.add(3,3).then(function(id) { |
michael@0 | 154 | gRevisions.push(gStore.revisionId); |
michael@0 | 155 | ok(true, "Item: " + id + " added"); |
michael@0 | 156 | }); |
michael@0 | 157 | }, |
michael@0 | 158 | |
michael@0 | 159 | function() { |
michael@0 | 160 | gExpectedEvents = false; |
michael@0 | 161 | var cursor = gStore.sync(); |
michael@0 | 162 | var steps = [ { operation: 'clear', }, |
michael@0 | 163 | { operation: 'add', id: 1, data: 1 }, |
michael@0 | 164 | { operation: 'add', id: 3, data: 3 }, |
michael@0 | 165 | { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 166 | { operation: 'done' }]; |
michael@0 | 167 | testCursor(cursor, steps); |
michael@0 | 168 | }, |
michael@0 | 169 | |
michael@0 | 170 | function() { |
michael@0 | 171 | var cursor = gStore.sync('wrong revision ID'); |
michael@0 | 172 | var steps = [ { operation: 'clear', }, |
michael@0 | 173 | { operation: 'add', id: 1, data: 1 }, |
michael@0 | 174 | { operation: 'add', id: 3, data: 3 }, |
michael@0 | 175 | { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 176 | { operation: 'done' }]; |
michael@0 | 177 | testCursor(cursor, steps); |
michael@0 | 178 | }, |
michael@0 | 179 | |
michael@0 | 180 | function() { |
michael@0 | 181 | var cursor = gStore.sync(gRevisions[0]); |
michael@0 | 182 | var steps = [ { operation: 'add', id: 1, data: 1 }, |
michael@0 | 183 | { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 184 | { operation: 'add', id: 3, data: 3 }, |
michael@0 | 185 | { operation: 'done' }]; |
michael@0 | 186 | testCursor(cursor, steps); |
michael@0 | 187 | }, |
michael@0 | 188 | |
michael@0 | 189 | function() { |
michael@0 | 190 | var cursor = gStore.sync(gRevisions[1]); |
michael@0 | 191 | var steps = [ { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 192 | { operation: 'add', id: 3, data: 3 }, |
michael@0 | 193 | { operation: 'done' }]; |
michael@0 | 194 | testCursor(cursor, steps); |
michael@0 | 195 | }, |
michael@0 | 196 | |
michael@0 | 197 | function() { |
michael@0 | 198 | var cursor = gStore.sync(gRevisions[2]); |
michael@0 | 199 | var steps = [ { operation: 'add', id: 3, data: 3 }, |
michael@0 | 200 | { operation: 'done' }]; |
michael@0 | 201 | testCursor(cursor, steps); |
michael@0 | 202 | }, |
michael@0 | 203 | |
michael@0 | 204 | function() { |
michael@0 | 205 | var cursor = gStore.sync(gRevisions[3]); |
michael@0 | 206 | var steps = [ { operation: 'done' }]; |
michael@0 | 207 | testCursor(cursor, steps); |
michael@0 | 208 | }, |
michael@0 | 209 | |
michael@0 | 210 | // Test after an update |
michael@0 | 211 | function() { |
michael@0 | 212 | gExpectedEvents = true; |
michael@0 | 213 | gStore.put(123, 1).then(function() { |
michael@0 | 214 | gRevisions.push(gStore.revisionId); |
michael@0 | 215 | }); |
michael@0 | 216 | }, |
michael@0 | 217 | |
michael@0 | 218 | function() { |
michael@0 | 219 | gExpectedEvents = false; |
michael@0 | 220 | var cursor = gStore.sync(); |
michael@0 | 221 | var steps = [ { operation: 'clear', }, |
michael@0 | 222 | { operation: 'add', id: 1, data: 123 }, |
michael@0 | 223 | { operation: 'add', id: 3, data: 3 }, |
michael@0 | 224 | { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 225 | { operation: 'done' }]; |
michael@0 | 226 | testCursor(cursor, steps); |
michael@0 | 227 | }, |
michael@0 | 228 | |
michael@0 | 229 | function() { |
michael@0 | 230 | var cursor = gStore.sync('wrong revision ID'); |
michael@0 | 231 | var steps = [ { operation: 'clear', }, |
michael@0 | 232 | { operation: 'add', id: 1, data: 123 }, |
michael@0 | 233 | { operation: 'add', id: 3, data: 3 }, |
michael@0 | 234 | { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 235 | { operation: 'done' }]; |
michael@0 | 236 | testCursor(cursor, steps); |
michael@0 | 237 | }, |
michael@0 | 238 | |
michael@0 | 239 | function() { |
michael@0 | 240 | var cursor = gStore.sync(gRevisions[0]); |
michael@0 | 241 | var steps = [ { operation: 'add', id: 1, data: 123 }, |
michael@0 | 242 | { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 243 | { operation: 'add', id: 3, data: 3 }, |
michael@0 | 244 | { operation: 'done' }]; |
michael@0 | 245 | testCursor(cursor, steps); |
michael@0 | 246 | }, |
michael@0 | 247 | |
michael@0 | 248 | function() { |
michael@0 | 249 | var cursor = gStore.sync(gRevisions[1]); |
michael@0 | 250 | var steps = [ { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 251 | { operation: 'add', id: 3, data: 3 }, |
michael@0 | 252 | { operation: 'update', id: 1, data: 123 }, |
michael@0 | 253 | { operation: 'done' }]; |
michael@0 | 254 | testCursor(cursor, steps); |
michael@0 | 255 | }, |
michael@0 | 256 | |
michael@0 | 257 | function() { |
michael@0 | 258 | var cursor = gStore.sync(gRevisions[2]); |
michael@0 | 259 | var steps = [ { operation: 'add', id: 3, data: 3 }, |
michael@0 | 260 | { operation: 'update', id: 1, data: 123 }, |
michael@0 | 261 | { operation: 'done' }]; |
michael@0 | 262 | testCursor(cursor, steps); |
michael@0 | 263 | }, |
michael@0 | 264 | |
michael@0 | 265 | function() { |
michael@0 | 266 | var cursor = gStore.sync(gRevisions[3]); |
michael@0 | 267 | var steps = [ { operation: 'update', id: 1, data: 123 }, |
michael@0 | 268 | { operation: 'done' }]; |
michael@0 | 269 | testCursor(cursor, steps); |
michael@0 | 270 | }, |
michael@0 | 271 | |
michael@0 | 272 | function() { |
michael@0 | 273 | var cursor = gStore.sync(gRevisions[4]); |
michael@0 | 274 | var steps = [ { operation: 'done' }]; |
michael@0 | 275 | testCursor(cursor, steps); |
michael@0 | 276 | }, |
michael@0 | 277 | |
michael@0 | 278 | // Test after a remove |
michael@0 | 279 | function() { |
michael@0 | 280 | gExpectedEvents = true; |
michael@0 | 281 | gStore.remove(3).then(function() { |
michael@0 | 282 | gRevisions.push(gStore.revisionId); |
michael@0 | 283 | }); |
michael@0 | 284 | }, |
michael@0 | 285 | |
michael@0 | 286 | function() { |
michael@0 | 287 | gExpectedEvents = false; |
michael@0 | 288 | var cursor = gStore.sync(); |
michael@0 | 289 | var steps = [ { operation: 'clear', }, |
michael@0 | 290 | { operation: 'add', id: 1, data: 123 }, |
michael@0 | 291 | { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 292 | { operation: 'done' }]; |
michael@0 | 293 | testCursor(cursor, steps); |
michael@0 | 294 | }, |
michael@0 | 295 | |
michael@0 | 296 | function() { |
michael@0 | 297 | var cursor = gStore.sync('wrong revision ID'); |
michael@0 | 298 | var steps = [ { operation: 'clear', }, |
michael@0 | 299 | { operation: 'add', id: 1, data: 123 }, |
michael@0 | 300 | { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 301 | { operation: 'done' }]; |
michael@0 | 302 | testCursor(cursor, steps); |
michael@0 | 303 | }, |
michael@0 | 304 | |
michael@0 | 305 | function() { |
michael@0 | 306 | var cursor = gStore.sync(gRevisions[0]); |
michael@0 | 307 | var steps = [ { operation: 'add', id: 1, data: 123 }, |
michael@0 | 308 | { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 309 | { operation: 'done' }]; |
michael@0 | 310 | testCursor(cursor, steps); |
michael@0 | 311 | }, |
michael@0 | 312 | |
michael@0 | 313 | function() { |
michael@0 | 314 | var cursor = gStore.sync(gRevisions[1]); |
michael@0 | 315 | var steps = [ { operation: 'add', id: 'foobar', data: 2 }, |
michael@0 | 316 | { operation: 'update', id: 1, data: 123 }, |
michael@0 | 317 | { operation: 'done' }]; |
michael@0 | 318 | testCursor(cursor, steps); |
michael@0 | 319 | }, |
michael@0 | 320 | |
michael@0 | 321 | function() { |
michael@0 | 322 | var cursor = gStore.sync(gRevisions[2]); |
michael@0 | 323 | var steps = [ { operation: 'update', id: 1, data: 123 }, |
michael@0 | 324 | { operation: 'done' }]; |
michael@0 | 325 | testCursor(cursor, steps); |
michael@0 | 326 | }, |
michael@0 | 327 | |
michael@0 | 328 | function() { |
michael@0 | 329 | var cursor = gStore.sync(gRevisions[3]); |
michael@0 | 330 | var steps = [ { operation: 'update', id: 1, data: 123 }, |
michael@0 | 331 | { operation: 'remove', id: 3 }, |
michael@0 | 332 | { operation: 'done' }]; |
michael@0 | 333 | testCursor(cursor, steps); |
michael@0 | 334 | }, |
michael@0 | 335 | |
michael@0 | 336 | function() { |
michael@0 | 337 | var cursor = gStore.sync(gRevisions[4]); |
michael@0 | 338 | var steps = [ { operation: 'remove', id: 3 }, |
michael@0 | 339 | { operation: 'done' }]; |
michael@0 | 340 | testCursor(cursor, steps); |
michael@0 | 341 | }, |
michael@0 | 342 | |
michael@0 | 343 | function() { |
michael@0 | 344 | var cursor = gStore.sync(gRevisions[5]); |
michael@0 | 345 | var steps = [ { operation: 'done' }]; |
michael@0 | 346 | testCursor(cursor, steps); |
michael@0 | 347 | }, |
michael@0 | 348 | |
michael@0 | 349 | // New events when the cursor is active |
michael@0 | 350 | function() { |
michael@0 | 351 | gCursor = gStore.sync(); |
michael@0 | 352 | var steps = [ { operation: 'clear', }, |
michael@0 | 353 | { operation: 'add', id: 1, data: 123 }, |
michael@0 | 354 | { operation: 'add', id: 'foobar', data: 2 } ]; |
michael@0 | 355 | testCursor(gCursor, steps); |
michael@0 | 356 | }, |
michael@0 | 357 | |
michael@0 | 358 | function() { |
michael@0 | 359 | gStore.add(42, 2).then(function(id) { |
michael@0 | 360 | ok(true, "Item: " + id + " added"); |
michael@0 | 361 | gRevisions.push(gStore.revisionId); |
michael@0 | 362 | runTest(); |
michael@0 | 363 | }); |
michael@0 | 364 | }, |
michael@0 | 365 | |
michael@0 | 366 | function() { |
michael@0 | 367 | var steps = [ { operation: 'clear', }, |
michael@0 | 368 | { operation: 'add', id: 1, data: 123 }, |
michael@0 | 369 | { operation: 'add', id: 2, data: 42 }, |
michael@0 | 370 | { operation: 'add', id: 'foobar', data: 2 } ] |
michael@0 | 371 | testCursor(gCursor, steps); |
michael@0 | 372 | }, |
michael@0 | 373 | |
michael@0 | 374 | function() { |
michael@0 | 375 | gStore.put(43, 2).then(function(id) { |
michael@0 | 376 | gRevisions.push(gStore.revisionId); |
michael@0 | 377 | runTest(); |
michael@0 | 378 | }); |
michael@0 | 379 | }, |
michael@0 | 380 | |
michael@0 | 381 | function() { |
michael@0 | 382 | var steps = [ { operation: 'clear', }, |
michael@0 | 383 | { operation: 'add', id: 1, data: 123 }, |
michael@0 | 384 | { operation: 'add', id: 2, data: 43 }, |
michael@0 | 385 | { operation: 'add', id: 'foobar', data: 2 } ] |
michael@0 | 386 | testCursor(gCursor, steps); |
michael@0 | 387 | }, |
michael@0 | 388 | |
michael@0 | 389 | function() { |
michael@0 | 390 | gStore.remove(2).then(function(id) { |
michael@0 | 391 | gRevisions.push(gStore.revisionId); |
michael@0 | 392 | runTest(); |
michael@0 | 393 | }); |
michael@0 | 394 | }, |
michael@0 | 395 | |
michael@0 | 396 | function() { |
michael@0 | 397 | var steps = [ { operation: 'clear', }, |
michael@0 | 398 | { operation: 'add', id: 1, data: 123 }, |
michael@0 | 399 | { operation: 'add', id: 'foobar', data: 2 } ] |
michael@0 | 400 | testCursor(gCursor, steps); |
michael@0 | 401 | }, |
michael@0 | 402 | |
michael@0 | 403 | function() { |
michael@0 | 404 | gStore.add(42).then(function(id) { |
michael@0 | 405 | ok(true, "Item: " + id + " added"); |
michael@0 | 406 | gRevisions.push(gStore.revisionId); |
michael@0 | 407 | runTest(); |
michael@0 | 408 | }); |
michael@0 | 409 | }, |
michael@0 | 410 | |
michael@0 | 411 | function() { |
michael@0 | 412 | var steps = [ { operation: 'clear', }, |
michael@0 | 413 | { operation: 'add', id: 1, data: 123 }, |
michael@0 | 414 | { operation: 'add', id: 4, data: 42 }, |
michael@0 | 415 | { operation: 'add', id: 'foobar', data: 2 } ] |
michael@0 | 416 | testCursor(gCursor, steps); |
michael@0 | 417 | }, |
michael@0 | 418 | |
michael@0 | 419 | function() { |
michael@0 | 420 | gStore.clear().then(function() { |
michael@0 | 421 | gRevisions.push(gStore.revisionId); |
michael@0 | 422 | runTest(); |
michael@0 | 423 | }); |
michael@0 | 424 | }, |
michael@0 | 425 | |
michael@0 | 426 | function() { |
michael@0 | 427 | var steps = [ { operation: 'clear' } ]; |
michael@0 | 428 | testCursor(gCursor, steps); |
michael@0 | 429 | }, |
michael@0 | 430 | |
michael@0 | 431 | function() { |
michael@0 | 432 | gStore.add(42).then(function(id) { |
michael@0 | 433 | ok(true, "Item: " + id + " added"); |
michael@0 | 434 | gRevisions.push(gStore.revisionId); |
michael@0 | 435 | runTest(); |
michael@0 | 436 | }); |
michael@0 | 437 | }, |
michael@0 | 438 | |
michael@0 | 439 | function() { |
michael@0 | 440 | var steps = [ { operation: 'clear', }, |
michael@0 | 441 | { operation: 'add', id: 5, data: 42 } ]; |
michael@0 | 442 | testCursor(gCursor, steps); |
michael@0 | 443 | }, |
michael@0 | 444 | |
michael@0 | 445 | function() { |
michael@0 | 446 | gStore.clear().then(function() { |
michael@0 | 447 | gRevisions.push(gStore.revisionId); |
michael@0 | 448 | runTest(); |
michael@0 | 449 | }); |
michael@0 | 450 | }, |
michael@0 | 451 | |
michael@0 | 452 | function() { |
michael@0 | 453 | gStore.add(42).then(function(id) { |
michael@0 | 454 | ok(true, "Item: " + id + " added"); |
michael@0 | 455 | gRevisions.push(gStore.revisionId); |
michael@0 | 456 | runTest(); |
michael@0 | 457 | }); |
michael@0 | 458 | }, |
michael@0 | 459 | |
michael@0 | 460 | function() { |
michael@0 | 461 | var steps = [ { operation: 'clear' }, |
michael@0 | 462 | { operation: 'add', id: 6, data: 42 }, |
michael@0 | 463 | { operation: 'done'} ]; |
michael@0 | 464 | testCursor(gCursor, steps); |
michael@0 | 465 | }, |
michael@0 | 466 | |
michael@0 | 467 | function() { |
michael@0 | 468 | gExpectedEvents = true; |
michael@0 | 469 | gStore.add(42).then(function(id) { |
michael@0 | 470 | }); |
michael@0 | 471 | } |
michael@0 | 472 | ]; |
michael@0 | 473 | |
michael@0 | 474 | function runTest() { |
michael@0 | 475 | if (!tests.length) { |
michael@0 | 476 | finish(); |
michael@0 | 477 | return; |
michael@0 | 478 | } |
michael@0 | 479 | |
michael@0 | 480 | var test = tests.shift(); |
michael@0 | 481 | test(); |
michael@0 | 482 | } |
michael@0 | 483 | |
michael@0 | 484 | runTest(); |
michael@0 | 485 | </script> |
michael@0 | 486 | </body> |
michael@0 | 487 | </html> |