Commit d4a07657 authored by dgrogan@chromium.org's avatar dgrogan@chromium.org

IndexedDB: refactor basics layout test so that it can be run on workers.

https://bugs.webkit.org/show_bug.cgi?id=76683

Reviewed by Tony Chang.

* storage/indexeddb/basics-workers-expected.txt: Added.
* storage/indexeddb/basics-workers.html: Added.
* storage/indexeddb/basics.html:
* storage/indexeddb/resources/basics.js: Copied from LayoutTests/storage/indexeddb/basics.html.
(test):
(openCallback):
* storage/indexeddb/resources/idb-worker-common.js: Added.
(debug):
(finishJSTest):
(description):
(testPassed):
(testFailed):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 821fd116
2012-01-31 David Grogan <dgrogan@chromium.org>
IndexedDB: refactor basics layout test so that it can be run on workers.
https://bugs.webkit.org/show_bug.cgi?id=76683
Reviewed by Tony Chang.
* storage/indexeddb/basics-workers-expected.txt: Added.
* storage/indexeddb/basics-workers.html: Added.
* storage/indexeddb/basics.html:
* storage/indexeddb/resources/basics.js: Copied from LayoutTests/storage/indexeddb/basics.html.
(test):
(openCallback):
* storage/indexeddb/resources/idb-worker-common.js: Added.
(debug):
(finishJSTest):
(description):
(testPassed):
(testFailed):
2012-01-31 Eric Seidel <eric@webkit.org>
Rebaseline results after http://trac.webkit.org/changeset/106373
......@@ -3,9 +3,9 @@ Test IndexedDB's basics.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS 'webkitIndexedDB' in window is true
PASS 'webkitIndexedDB' in self is true
PASS webkitIndexedDB == null is false
PASS 'webkitIDBCursor' in window is true
PASS 'webkitIDBCursor' in self is true
PASS webkitIDBCursor == null is false
webkitIndexedDB.open('basics')
PASS 'result' in request is true
......
[Worker] Test IndexedDB's basics.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Starting worker: resources/basics.js
PASS [Worker] 'webkitIndexedDB' in self is true
PASS [Worker] webkitIndexedDB == null is false
PASS [Worker] 'webkitIDBCursor' in self is true
PASS [Worker] webkitIDBCursor == null is false
[Worker] webkitIndexedDB.open('basics')
PASS [Worker] 'result' in request is true
[Worker] Expecting exception from request.result
PASS [Worker] Exception was thrown.
PASS [Worker] code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
PASS [Worker] 'errorCode' in request is true
[Worker] Expecting exception from request.errorCode
PASS [Worker] Exception was thrown.
PASS [Worker] code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
PASS [Worker] 'webkitErrorMessage' in request is true
[Worker] Expecting exception from request.webkitErrorMessage
PASS [Worker] Exception was thrown.
PASS [Worker] code is webkitIDBDatabaseException.NOT_ALLOWED_ERR
PASS [Worker] 'source' in request is true
PASS [Worker] request.source is webkitIndexedDB
PASS [Worker] 'transaction' in request is true
PASS [Worker] request.transaction is null
PASS [Worker] 'readyState' in request is true
PASS [Worker] request.readyState is webkitIDBRequest.LOADING
PASS [Worker] 'onsuccess' in request is true
PASS [Worker] request.onsuccess is null
PASS [Worker] 'onerror' in request is true
PASS [Worker] request.onerror is null
PASS [Worker] request.LOADING is 1
PASS [Worker] request.DONE is 2
PASS [Worker] 'result' in event.target is true
PASS [Worker] !!event.target.result is true
PASS [Worker] 'errorCode' in event.target is true
PASS [Worker] event.target.errorCode is 0
PASS [Worker] 'webkitErrorMessage' in event.target is true
PASS [Worker] event.target.webkitErrorMessage is undefined.
PASS [Worker] 'source' in event.target is true
PASS [Worker] request.source is webkitIndexedDB
PASS [Worker] 'transaction' in event.target is true
PASS [Worker] event.target.transaction is null
PASS [Worker] 'readyState' in request is true
PASS [Worker] event.target.readyState is webkitIDBRequest.DONE
PASS [Worker] 'onsuccess' in event.target is true
PASS [Worker] 'onerror' in event.target is true
PASS [Worker] event.target.LOADING is 1
PASS [Worker] event.target.DONE is 2
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../fast/js/resources/js-test-pre.js"></script>
<script src="resources/shared.js"></script>
<script src="../../fast/filesystem/resources/fs-worker-test-util.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>startWorker('resources/basics.js');</script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
......@@ -6,68 +6,7 @@
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description("Test IndexedDB's basics.");
if (window.layoutTestController)
layoutTestController.waitUntilDone();
function test()
{
shouldBeTrue("'webkitIndexedDB' in window");
shouldBeFalse("webkitIndexedDB == null");
shouldBeTrue("'webkitIDBCursor' in window");
shouldBeFalse("webkitIDBCursor == null");
request = evalAndLog("webkitIndexedDB.open('basics')");
shouldBeTrue("'result' in request");
evalAndExpectException("request.result", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
shouldBeTrue("'errorCode' in request");
evalAndExpectException("request.errorCode", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
shouldBeTrue("'webkitErrorMessage' in request");
evalAndExpectException("request.webkitErrorMessage", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
shouldBeTrue("'source' in request");
shouldBe("request.source", "webkitIndexedDB");
shouldBeTrue("'transaction' in request");
shouldBeNull("request.transaction");
shouldBeTrue("'readyState' in request");
shouldBe("request.readyState", "webkitIDBRequest.LOADING");
shouldBeTrue("'onsuccess' in request");
shouldBeNull("request.onsuccess");
shouldBeTrue("'onerror' in request");
shouldBeNull("request.onerror");
shouldBe("request.LOADING", "1");
shouldBe("request.DONE", "2");
request.onsuccess = openCallback;
request.onerror = unexpectedErrorCallback;
}
function openCallback()
{
shouldBeTrue("'result' in event.target");
shouldBeTrue("!!event.target.result");
shouldBeTrue("'errorCode' in event.target");
shouldBe("event.target.errorCode", "0");
shouldBeTrue("'webkitErrorMessage' in event.target");
shouldBeUndefined("event.target.webkitErrorMessage");
shouldBeTrue("'source' in event.target");
shouldBe("request.source", "webkitIndexedDB");
shouldBeTrue("'transaction' in event.target");
shouldBeNull("event.target.transaction");
shouldBeTrue("'readyState' in request");
shouldBe("event.target.readyState", "webkitIDBRequest.DONE");
shouldBeTrue("'onsuccess' in event.target");
shouldBeTrue("'onerror' in event.target");
shouldBe("event.target.LOADING", "1");
shouldBe("event.target.DONE", "2");
done();
}
test();
</script>
<script src="resources/basics.js"></script>
<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
if (this.importScripts) {
// FIXME: Change js-test-pre.js to use self in place of window where
// possible, so we can remove the next line. http://webkit.org/b/76762
window = self;
importScripts('../../../fast/js/resources/js-test-pre.js');
importScripts('idb-worker-common.js');
importScripts('shared.js');
}
description("Test IndexedDB's basics.");
function test()
{
shouldBeTrue("'webkitIndexedDB' in self");
shouldBeFalse("webkitIndexedDB == null");
shouldBeTrue("'webkitIDBCursor' in self");
shouldBeFalse("webkitIDBCursor == null");
request = evalAndLog("webkitIndexedDB.open('basics')");
shouldBeTrue("'result' in request");
evalAndExpectException("request.result", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
shouldBeTrue("'errorCode' in request");
evalAndExpectException("request.errorCode", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
shouldBeTrue("'webkitErrorMessage' in request");
evalAndExpectException("request.webkitErrorMessage", "webkitIDBDatabaseException.NOT_ALLOWED_ERR");
shouldBeTrue("'source' in request");
shouldBe("request.source", "webkitIndexedDB");
shouldBeTrue("'transaction' in request");
shouldBeNull("request.transaction");
shouldBeTrue("'readyState' in request");
shouldBe("request.readyState", "webkitIDBRequest.LOADING");
shouldBeTrue("'onsuccess' in request");
shouldBeNull("request.onsuccess");
shouldBeTrue("'onerror' in request");
shouldBeNull("request.onerror");
shouldBe("request.LOADING", "1");
shouldBe("request.DONE", "2");
request.onsuccess = openCallback;
request.onerror = unexpectedErrorCallback;
}
function openCallback(evt)
{
event = evt;
shouldBeTrue("'result' in event.target");
shouldBeTrue("!!event.target.result");
shouldBeTrue("'errorCode' in event.target");
shouldBe("event.target.errorCode", "0");
shouldBeTrue("'webkitErrorMessage' in event.target");
shouldBeUndefined("event.target.webkitErrorMessage");
shouldBeTrue("'source' in event.target");
shouldBe("request.source", "webkitIndexedDB");
shouldBeTrue("'transaction' in event.target");
shouldBeNull("event.target.transaction");
shouldBeTrue("'readyState' in request");
shouldBe("event.target.readyState", "webkitIDBRequest.DONE");
shouldBeTrue("'onsuccess' in event.target");
shouldBeTrue("'onerror' in event.target");
shouldBe("event.target.LOADING", "1");
shouldBe("event.target.DONE", "2");
finishJSTest();
}
test();
function debug(message)
{
postMessage("MESG:" + message);
}
function finishJSTest()
{
postMessage("DONE:");
}
function description(message)
{
postMessage('DESC:' + message);
}
function testPassed(msg)
{
postMessage("PASS:" + msg);
}
function testFailed(msg)
{
postMessage("FAIL:" + msg);
}
var jsTestIsAsync = true;
function done()
{
isSuccessfullyParsed();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment