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