OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>IndexedDB: Verify deleteDatabase success event</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script> |
| 6 (function() { |
| 7 var t = async_test('deleteDatabase success event type, existing DB'); |
| 8 t.step(function() { |
| 9 var dbName = 'db' + location.pathname; |
| 10 var openRequest = indexedDB.open(dbName, 9); |
| 11 openRequest.onsuccess = t.step_func(function(e) { |
| 12 var db = openRequest.result; |
| 13 db.close(); |
| 14 |
| 15 var deleteRequest = indexedDB.deleteDatabase(dbName); |
| 16 deleteRequest.onsuccess = t.step_func(function(e) { |
| 17 assert_equals(deleteRequest.result, undefined, |
| 18 '...the implementation must set the result of the
request to undefined...'); |
| 19 assert_true(e instanceof IDBVersionChangeEvent, |
| 20 'The event must implement the IDBVersionChangeEvent
interface ...'); |
| 21 assert_equals(e.oldVersion, 9, |
| 22 'and have oldVersion set to database version...'); |
| 23 assert_equals(e.newVersion, null, |
| 24 'and have the newVersion property set to null.'); |
| 25 t.done(); |
| 26 }); |
| 27 }); |
| 28 }); |
| 29 }()); |
| 30 |
| 31 (function() { |
| 32 var t = async_test('deleteDatabase success event, non-existent DB'); |
| 33 t.step(function() { |
| 34 |
| 35 var dbName = 'db' + location.pathname + '-does-not-exist'; |
| 36 var deleteRequest = indexedDB.deleteDatabase(dbName); |
| 37 deleteRequest.onsuccess = t.step_func(function(e) { |
| 38 assert_equals(deleteRequest.result, undefined, |
| 39 '...the implementation must set the result of the requ
est to undefined...'); |
| 40 assert_true(e instanceof IDBVersionChangeEvent, |
| 41 'The event must implement the IDBVersionChangeEvent inte
rface ...'); |
| 42 assert_equals(e.oldVersion, 0, |
| 43 'and have oldVersion set to database version...'); |
| 44 assert_equals(e.newVersion, null, |
| 45 'and have the newVersion property set to null.'); |
| 46 t.done(); |
| 47 }); |
| 48 }); |
| 49 }()); |
| 50 </script> |
OLD | NEW |