Home | History | Annotate | Download | only in indexeddb
      1 <html>
      2 <head>
      3 <link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
      4 <script src="../../fast/js/resources/js-test-pre.js"></script>
      5 <script src="../../fast/js/resources/js-test-post-function.js"></script>
      6 <script src="resources/shared.js"></script>
      7 </head>
      8 <body>
      9 <p id="description"></p>
     10 <div id="console"></div>
     11 <script>
     12 
     13 description("Test IndexedDB's basics.");
     14 if (window.layoutTestController)
     15     layoutTestController.waitUntilDone();
     16 
     17 function test()
     18 {
     19     shouldBeTrue("'webkitIndexedDB' in window");
     20     shouldBeFalse("webkitIndexedDB == null");
     21 
     22     shouldBeTrue("'webkitIDBCursor' in window");
     23     shouldBeFalse("webkitIDBCursor == null");
     24 
     25     request = evalAndLog("webkitIndexedDB.open('basics')");
     26     shouldBeTrue("'result' in request");
     27     evalAndExpectException("request.result", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
     28     shouldBeTrue("'errorCode' in request");
     29     evalAndExpectException("request.errorCode", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
     30     shouldBeTrue("'webkitErrorMessage' in request");
     31     evalAndExpectException("request.webkitErrorMessage", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
     32     shouldBeTrue("'source' in request");
     33     shouldBe("request.source", "webkitIndexedDB");
     34     shouldBeTrue("'transaction' in request");
     35     shouldBeNull("request.transaction");
     36     shouldBeTrue("'readyState' in request");
     37     shouldBe("request.readyState", "webkitIDBRequest.LOADING");
     38     shouldBeTrue("'onsuccess' in request");
     39     shouldBeNull("request.onsuccess");
     40     shouldBeTrue("'onerror' in request");
     41     shouldBeNull("request.onerror");
     42     shouldBe("request.LOADING", "1");
     43     shouldBe("request.DONE", "2");
     44     request.onsuccess = openCallback;
     45     request.onerror = unexpectedErrorCallback;
     46 }
     47 
     48 function openCallback()
     49 {
     50     shouldBeTrue("'result' in event.target");
     51     shouldBeTrue("!!event.target.result");
     52     shouldBeTrue("'errorCode' in event.target");
     53     shouldBe("event.target.errorCode", "0");
     54     shouldBeTrue("'webkitErrorMessage' in event.target");
     55     shouldBeUndefined("event.target.webkitErrorMessage");
     56     shouldBeTrue("'source' in event.target");
     57     shouldBe("request.source", "webkitIndexedDB");
     58     shouldBeTrue("'transaction' in event.target");
     59     shouldBeNull("event.target.transaction");
     60     shouldBeTrue("'readyState' in request");
     61     shouldBe("event.target.readyState", "webkitIDBRequest.DONE");
     62     shouldBeTrue("'onsuccess' in event.target");
     63     shouldBeTrue("'onerror' in event.target");
     64     shouldBe("event.target.LOADING", "1");
     65     shouldBe("event.target.DONE", "2");
     66 
     67     done();
     68 }
     69 
     70 test();
     71 
     72 var successfullyParsed = true;
     73 
     74 </script>
     75 </body>
     76 </html>
     77