diff options
Diffstat (limited to 'LayoutTests/storage/indexeddb/resources/shared.js')
-rw-r--r-- | LayoutTests/storage/indexeddb/resources/shared.js | 75 |
1 files changed, 8 insertions, 67 deletions
diff --git a/LayoutTests/storage/indexeddb/resources/shared.js b/LayoutTests/storage/indexeddb/resources/shared.js index 8c56832..9b23cb8 100644 --- a/LayoutTests/storage/indexeddb/resources/shared.js +++ b/LayoutTests/storage/indexeddb/resources/shared.js @@ -5,86 +5,29 @@ function done() layoutTestController.notifyDone() } -function verifyEventCommon(event) -{ - shouldBeTrue("'source' in event"); - shouldBeTrue("event.source != null"); - shouldBeTrue("'onsuccess' in event.target"); - shouldBeTrue("'onerror' in event.target"); - shouldBeTrue("'readyState' in event.target"); - shouldBe("event.target.readyState", "event.target.DONE"); - debug(""); -} - -function verifyErrorEvent(event) -{ - debug("Error event fired:"); - shouldBeFalse("'result' in event"); - shouldBeTrue("'code' in event"); - shouldBeTrue("'message' in event"); - verifyEventCommon(event); -} - -function verifySuccessEvent(event) -{ - debug("Success event fired:"); - shouldBeTrue("'result' in event"); - shouldBeFalse("'code' in event"); - shouldBeFalse("'message' in event"); - verifyEventCommon(event); -} - -function verifyAbortEvent(event) -{ - debug("Abort event fired:"); - shouldBeEqualToString("event.type", "abort"); -} - -function verifyCompleteEvent(event) -{ - debug("Complete event fired:"); - shouldBeEqualToString("event.type", "complete"); -} - -function verifyResult(result) -{ - shouldBeTrue("'onsuccess' in result"); - shouldBeTrue("'onerror' in result"); - shouldBeTrue("'readyState' in result"); - debug("An event should fire shortly..."); - debug(""); -} - function unexpectedSuccessCallback() { testFailed("Success function called unexpectedly."); - debug(""); - verifySuccessEvent(event); - done(); } function unexpectedErrorCallback() { - testFailed("Error function called unexpectedly: (" + event.code + ") " + event.message); - debug(""); - verifyErrorEvent(event); - done(); + testFailed("Error function called unexpectedly: (" + event.target.errorCode + ") " + event.target.webkitErrorMessage); } function unexpectedAbortCallback() { testFailed("Abort function called unexpectedly!"); - debug(""); - verifyAbortEvent(event); - done(); } function unexpectedCompleteCallback() { testFailed("oncomplete function called unexpectedly!"); - debug(""); - verifyCompleteEvent(event); - done(); +} + +function unexpectedBlockedCallback() +{ + testFailed("onblocked called unexpectedly"); } function evalAndExpectException(cmd, expected) @@ -95,16 +38,14 @@ function evalAndExpectException(cmd, expected) testFailed("No exception thrown! Should have been " + expected); } catch (e) { code = e.code; + testPassed("Exception was thrown."); shouldBe("code", expected); } } -// FIXME: remove the onfinished parameter. -function deleteAllObjectStores(db, onfinished) +function deleteAllObjectStores(db) { while (db.objectStoreNames.length) db.deleteObjectStore(db.objectStoreNames.item(0)); - debug("Deleted all object stores."); - onfinished(); } |