commit-queue@webkit.org | 45c0dad | 2011-05-20 18:30:35 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <!-- |
| 3 | original test: http://mxr.mozilla.org/mozilla2.0/source/dom/indexedDB/test/test_create_objectStore.html |
| 4 | license of original test: |
| 5 | " Any copyright is dedicated to the Public Domain. |
| 6 | http://creativecommons.org/publicdomain/zero/1.0/ " |
| 7 | --> |
| 8 | <html> |
| 9 | <head> |
| 10 | <link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css"> |
| 11 | <script src="../../../fast/js/resources/js-test-pre.js"></script> |
commit-queue@webkit.org | 45c0dad | 2011-05-20 18:30:35 +0000 | [diff] [blame] | 12 | <script src="../resources/shared.js"></script> |
| 13 | </head> |
| 14 | <body> |
| 15 | <p id="description"></p> |
| 16 | <div id="console"></div> |
| 17 | <script> |
| 18 | |
| 19 | description("Test IndexedDB's creating object store with null name"); |
| 20 | if (window.layoutTestController) |
| 21 | layoutTestController.waitUntilDone(); |
| 22 | |
| 23 | function test() |
| 24 | { |
| 25 | indexedDB = evalAndLog("indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;"); |
| 26 | shouldBeFalse("indexedDB == null"); |
| 27 | IDBDatabaseException = evalAndLog("IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;"); |
| 28 | shouldBeFalse("IDBDatabaseException == null"); |
| 29 | |
| 30 | name = window.location.pathname; |
| 31 | description = "My Test Database"; |
| 32 | request = evalAndLog("indexedDB.open(name, description)"); |
| 33 | request.onsuccess = openSuccess; |
| 34 | request.onerror = unexpectedErrorCallback; |
| 35 | } |
| 36 | |
| 37 | function openSuccess() |
| 38 | { |
| 39 | db = evalAndLog("db = event.target.result"); |
| 40 | |
| 41 | request = evalAndLog("request = db.setVersion('1')"); |
| 42 | request.onsuccess = cleanDatabase; |
| 43 | request.onerror = unexpectedErrorCallback; |
| 44 | } |
| 45 | |
| 46 | function cleanDatabase() |
| 47 | { |
| 48 | deleteAllObjectStores(db); |
| 49 | |
commit-queue@webkit.org | ada248d | 2011-06-22 18:03:33 +0000 | [diff] [blame] | 50 | objectStore = evalAndLog("objectStore = db.createObjectStore(null);"); |
| 51 | shouldBe("objectStore.name", "'null'"); |
commit-queue@webkit.org | 45c0dad | 2011-05-20 18:30:35 +0000 | [diff] [blame] | 52 | |
| 53 | done(); |
| 54 | } |
| 55 | |
| 56 | var successfullyParsed = true; |
| 57 | |
| 58 | test(); |
| 59 | |
| 60 | </script> |
| 61 | </body> |
| 62 | </html> |
| 63 | |