[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
jorlow at chromium.org
jorlow at chromium.org
Wed Dec 22 13:14:16 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 956127d4f1ac91c3de1d657e2886002e527ce915
Author: jorlow at chromium.org <jorlow at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 9 15:10:57 2010 +0000
2010-09-09 Jeremy Orlow <jorlow at chromium.org>
Reviewed by Steve Block.
Convert IndexedDB tests from script tests to normal tests
https://bugs.webkit.org/show_bug.cgi?id=45452
Half the indexedDB tests are currently script tests and half aren't.
We should make them all the same. Based on the webkit-dev thread AP
started not long ago, I think normal tests (but using the script tests)
scripts makes the most sense.
There are no changes to the tests themselves...I just moved code between
files.
* storage/indexeddb/basics.html:
* storage/indexeddb/database-basics.html:
* storage/indexeddb/keyrange.html:
* storage/indexeddb/objectstore-basics.html:
* storage/indexeddb/open-cursor.html:
* storage/indexeddb/script-tests/TEMPLATE.html: Removed.
* storage/indexeddb/script-tests/basics.js: Removed.
* storage/indexeddb/script-tests/database-basics.js: Removed.
* storage/indexeddb/script-tests/keyrange.js: Removed.
* storage/indexeddb/script-tests/objectstore-basics.js: Removed.
* storage/indexeddb/script-tests/open-cursor.js: Removed.
* storage/indexeddb/script-tests/transaction-basics.js: Removed.
* storage/indexeddb/transaction-basics.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index d038411..67d33bf 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,32 @@
+2010-09-09 Jeremy Orlow <jorlow at chromium.org>
+
+ Reviewed by Steve Block.
+
+ Convert IndexedDB tests from script tests to normal tests
+ https://bugs.webkit.org/show_bug.cgi?id=45452
+
+ Half the indexedDB tests are currently script tests and half aren't.
+ We should make them all the same. Based on the webkit-dev thread AP
+ started not long ago, I think normal tests (but using the script tests)
+ scripts makes the most sense.
+
+ There are no changes to the tests themselves...I just moved code between
+ files.
+
+ * storage/indexeddb/basics.html:
+ * storage/indexeddb/database-basics.html:
+ * storage/indexeddb/keyrange.html:
+ * storage/indexeddb/objectstore-basics.html:
+ * storage/indexeddb/open-cursor.html:
+ * storage/indexeddb/script-tests/TEMPLATE.html: Removed.
+ * storage/indexeddb/script-tests/basics.js: Removed.
+ * storage/indexeddb/script-tests/database-basics.js: Removed.
+ * storage/indexeddb/script-tests/keyrange.js: Removed.
+ * storage/indexeddb/script-tests/objectstore-basics.js: Removed.
+ * storage/indexeddb/script-tests/open-cursor.js: Removed.
+ * storage/indexeddb/script-tests/transaction-basics.js: Removed.
+ * storage/indexeddb/transaction-basics.html:
+
2010-09-09 Andrey Kosyakov <caseq at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/LayoutTests/storage/indexeddb/basics.html b/LayoutTests/storage/indexeddb/basics.html
index 24af453..9f5f20f 100644
--- a/LayoutTests/storage/indexeddb/basics.html
+++ b/LayoutTests/storage/indexeddb/basics.html
@@ -8,6 +8,35 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/basics.js"></script>
+<script>
+
+description("Test IndexedDB's basics.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function openCallback()
+{
+ verifySuccessEvent(event);
+ done();
+}
+
+function test()
+{
+ shouldBeTrue("'indexedDB' in window");
+ shouldBeFalse("indexedDB == null");
+
+ // FIXME: Verify other IndexedDatabaseRequest constructors, once they're implemented.
+
+ result = evalAndLog("indexedDB.open('name', 'description')");
+ verifyResult(result);
+ result.onsuccess = openCallback;
+ result.onerror = unexpectedErrorCallback;
+}
+
+test();
+
+var successfullyParsed = true;
+
+</script>
</body>
</html>
diff --git a/LayoutTests/storage/indexeddb/database-basics.html b/LayoutTests/storage/indexeddb/database-basics.html
index 9c92194..b099a49 100644
--- a/LayoutTests/storage/indexeddb/database-basics.html
+++ b/LayoutTests/storage/indexeddb/database-basics.html
@@ -8,6 +8,80 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/database-basics.js"></script>
+<script>
+
+description("Test the basics of IndexedDB's IDBDatabase.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function openSuccess()
+{
+ verifySuccessEvent(event);
+
+ var db = evalAndLog("db = event.result");
+ deleteAllObjectStores(db);
+
+ // We must do something asynchronous before anything synchronous since
+ // deleteAllObjectStores only schedules the object stores to be removed.
+ // We don't know for sure whether it's happened until an IDBRequest object
+ // that was created after the removes fires.
+
+ debug("Testing setVersion.");
+ result = evalAndLog('db.setVersion("version a")');
+ verifyResult(result);
+ result.onsuccess = setVersionAgain;
+ result.onError = unexpectedErrorCallback;
+}
+
+function setVersionAgain()
+{
+ verifySuccessEvent(event);
+
+ result = evalAndLog('db.setVersion("version b")');
+ verifyResult(result);
+ result.onsuccess = createObjectStore;
+ result.onError = unexpectedErrorCallback;
+}
+
+function createObjectStore()
+{
+ verifySuccessEvent(event);
+ shouldBeEqualToString("db.version", "version b");
+ shouldBeEqualToString("db.name", "name");
+ shouldBe("db.objectStores", "[]");
+ shouldBe("db.objectStores.length", "0");
+ shouldBe("db.objectStores.contains('')", "false");
+
+ result = evalAndLog('db.createObjectStore("test123")');
+ verifyResult(result);
+ result.onsuccess = checkObjectStore;
+ result.onError = unexpectedErrorCallback;
+}
+
+function checkObjectStore()
+{
+ verifySuccessEvent(event);
+ shouldBe("db.objectStores", "['test123']");
+ shouldBe("db.objectStores.length", "1");
+ shouldBe("db.objectStores.contains('')", "false");
+ shouldBe("db.objectStores.contains('test456')", "false");
+ shouldBe("db.objectStores.contains('test123')", "true");
+
+ done();
+}
+
+function test()
+{
+ result = evalAndLog("indexedDB.open('name', 'description')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+test();
+
+var successfullyParsed = true;
+
+</script>
</body>
</html>
diff --git a/LayoutTests/storage/indexeddb/keyrange.html b/LayoutTests/storage/indexeddb/keyrange.html
index d4ef58e..d60cb15 100644
--- a/LayoutTests/storage/indexeddb/keyrange.html
+++ b/LayoutTests/storage/indexeddb/keyrange.html
@@ -8,6 +8,117 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/keyrange.js"></script>
+<script>
+
+description("Test IndexedDB's KeyRange.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function checkSingleKeyRange(value)
+{
+ keyRange = evalAndLog("IDBKeyRange.only(" + value + ")");
+ shouldBe("keyRange.left", "" + value);
+ shouldBe("keyRange.right", "" + value);
+ shouldBe("keyRange.flags", "keyRange.SINGLE");
+}
+
+function checkLeftBoundKeyRange(value, open)
+{
+ keyRange = evalAndLog("IDBKeyRange.leftBound(" + value + "," + open + ")");
+ shouldBe("keyRange.left", "" + value);
+ shouldBeNull("keyRange.right");
+ shouldBe("keyRange.flags", open ? "keyRange.LEFT_OPEN | keyRange.LEFT_BOUND" : "keyRange.LEFT_BOUND");
+}
+
+function checkRightBoundKeyRange(value, open)
+{
+ keyRange = evalAndLog("IDBKeyRange.rightBound(" + value + "," + open + ")");
+ shouldBe("keyRange.right", "" + value);
+ shouldBeNull("keyRange.left");
+ shouldBe("keyRange.flags", open ? "keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND" : "keyRange.RIGHT_BOUND");
+}
+
+function checkBoundKeyRange(left, right, openLeft, openRight)
+{
+ keyRange = evalAndLog("IDBKeyRange.bound(" + left + "," + right + "," + openLeft + "," + openRight + ")");
+ shouldBe("keyRange.left", "" + left);
+ shouldBe("keyRange.right", "" + right);
+ leftFlags = keyRange.flags & (keyRange.LEFT_OPEN | keyRange.LEFT_BOUND);
+ shouldBe("leftFlags", openLeft ? "keyRange.LEFT_OPEN | keyRange.LEFT_BOUND" : "keyRange.LEFT_BOUND");
+ rightFlags = keyRange.flags & (keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND);
+ shouldBe("rightFlags", openRight ? "keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND" : "keyRange.RIGHT_BOUND");
+}
+
+function test()
+{
+ shouldBeTrue("'SINGLE' in IDBKeyRange");
+ shouldBeTrue("'LEFT_OPEN' in IDBKeyRange");
+ shouldBeTrue("'RIGHT_OPEN' in IDBKeyRange");
+ shouldBeTrue("'LEFT_BOUND' in IDBKeyRange");
+ shouldBeTrue("'RIGHT_BOUND' in IDBKeyRange");
+ shouldBeFalse("'left' in IDBKeyRange");
+ shouldBeFalse("'right' in IDBKeyRange");
+ shouldBeFalse("'flags' in IDBKeyRange");
+ shouldBeTrue("'only' in IDBKeyRange");
+ shouldBeTrue("'leftBound' in IDBKeyRange");
+ shouldBeTrue("'rightBound' in IDBKeyRange");
+ shouldBeTrue("'bound' in IDBKeyRange");
+
+ debug("");
+
+ var instance = evalAndLog("instance = IDBKeyRange.only(1)");
+ shouldBeTrue("'SINGLE' in instance");
+ shouldBeTrue("'LEFT_OPEN' in instance");
+ shouldBeTrue("'RIGHT_OPEN' in instance");
+ shouldBeTrue("'LEFT_BOUND' in instance");
+ shouldBeTrue("'RIGHT_BOUND' in instance");
+ shouldBeTrue("'left' in instance");
+ shouldBeTrue("'right' in instance");
+ shouldBeTrue("'flags' in instance");
+ shouldBeFalse("'only' in instance");
+ shouldBeFalse("'leftBound' in instance");
+ shouldBeFalse("'rightBound' in instance");
+ shouldBeFalse("'bound' in instance");
+
+ debug("");
+
+ checkSingleKeyRange(1);
+ checkSingleKeyRange("'a'");
+
+ checkLeftBoundKeyRange(10, true);
+ checkLeftBoundKeyRange(11, false);
+ checkLeftBoundKeyRange(12);
+ checkLeftBoundKeyRange("'aa'", true);
+ checkLeftBoundKeyRange("'ab'", false);
+ checkLeftBoundKeyRange("'ac'");
+
+ checkRightBoundKeyRange(20, true);
+ checkRightBoundKeyRange(21, false);
+ checkRightBoundKeyRange(22);
+ checkRightBoundKeyRange("'ba'", true);
+ checkRightBoundKeyRange("'bb'", false);
+ checkRightBoundKeyRange("'bc'");
+
+ checkBoundKeyRange(30, 40);
+ checkBoundKeyRange(31, 41, false, false);
+ checkBoundKeyRange(32, 42, false, true);
+ checkBoundKeyRange(33, 43, true, false);
+ checkBoundKeyRange(34, 44, true, true);
+
+ checkBoundKeyRange("'aaa'", "'aba'", false, false);
+ checkBoundKeyRange("'aab'", "'abb'");
+ checkBoundKeyRange("'aac'", "'abc'", false, false);
+ checkBoundKeyRange("'aad'", "'abd'", false, true);
+ checkBoundKeyRange("'aae'", "'abe'", true, false);
+ checkBoundKeyRange("'aaf'", "'abf'", true, true);
+
+}
+
+test();
+
+var successfullyParsed = true;
+done();
+
+</script>
</body>
</html>
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics.html b/LayoutTests/storage/indexeddb/objectstore-basics.html
index 09eb68c..8b696c4 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics.html
+++ b/LayoutTests/storage/indexeddb/objectstore-basics.html
@@ -8,6 +8,103 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/objectstore-basics.js"></script>
+<script>
+
+description("Test the basics of IndexedDB's IDBObjectStore.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ result = evalAndLog("indexedDB.open('name', 'description')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ debug("openSuccess():");
+ verifySuccessEvent(event);
+ db = evalAndLog("db = event.result");
+
+ deleteAllObjectStores(db);
+
+ result = evalAndLog("db.createObjectStore('storeName', null)");
+ verifyResult(result);
+ result.onsuccess = createSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function createSuccess()
+{
+ debug("createSuccess():");
+ verifySuccessEvent(event);
+ var store = evalAndLog("store = event.result");
+ var storeNames = evalAndLog("storeNames = db.objectStores");
+
+ shouldBeEqualToString("store.name", "storeName");
+ shouldBeNull("store.keyPath");
+ shouldBe("storeNames.contains('storeName')", "true");
+ shouldBe("storeNames.length", "1");
+ // FIXME: test all of object store's methods.
+
+ result = evalAndLog("event.result.createIndex('indexName', 'x')");
+ verifyResult(result);
+ result.onsuccess = addIndexSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function addIndexSuccess()
+{
+ debug("addIndexSuccess():");
+ verifySuccessEvent(event);
+ shouldBeTrue("event.source.indexNames.contains('indexName')");
+
+ result = evalAndLog("event.source.add({x: 'value'}, 'key')");
+ verifyResult(result);
+ result.onsuccess = addSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function addSuccess()
+{
+ debug("addSuccess():");
+ verifySuccessEvent(event);
+ shouldBeEqualToString("event.result", "key");
+ var store = evalAndLog("store = event.source");
+
+ result = evalAndLog("store.get('key')");
+ verifyResult(result);
+ result.onsuccess = getSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function getSuccess()
+{
+ debug("getSuccess():");
+ verifySuccessEvent(event);
+ shouldBeEqualToString("event.result.x", "value");
+ var store = evalAndLog("store = event.source");
+
+ result = evalAndLog("store.remove('key')");
+ verifyResult(result);
+ result.onsuccess = removeSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function removeSuccess()
+{
+ debug("removeSuccess():");
+ verifySuccessEvent(event);
+ shouldBeNull("event.result");
+ done();
+}
+
+test();
+
+var successfullyParsed = true;
+
+</script>
</body>
</html>
diff --git a/LayoutTests/storage/indexeddb/open-cursor.html b/LayoutTests/storage/indexeddb/open-cursor.html
index f60365d..03d1da0 100644
--- a/LayoutTests/storage/indexeddb/open-cursor.html
+++ b/LayoutTests/storage/indexeddb/open-cursor.html
@@ -8,6 +8,92 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/open-cursor.js"></script>
+<script>
+
+description("Test IndexedDB's openCursor.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function emptyCursorSuccess()
+{
+ debug("Empty cursor opened successfully.")
+ verifySuccessEvent(event);
+ // FIXME: check that we can iterate the cursor.
+ done();
+}
+
+function openEmptyCursor()
+{
+ debug("Opening an empty cursor.");
+ keyRange = IDBKeyRange.leftBound("InexistentKey");
+ result = evalAndLog("objectStore.openCursor(keyRange)");
+ verifyResult(result);
+ result.onsuccess = emptyCursorSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function cursorSuccess()
+{
+ debug("Cursor opened successfully.")
+ verifySuccessEvent(event);
+ // FIXME: check that we can iterate the cursor.
+ shouldBe("event.result.direction", "0");
+ shouldBe("event.result.key", "'myKey'");
+ shouldBe("event.result.value", "'myValue'");
+ debug("");
+ openEmptyCursor();
+}
+
+function openCursor()
+{
+ debug("Opening cursor");
+ keyRange = IDBKeyRange.leftBound("myKey");
+ result = evalAndLog("objectStore.openCursor(keyRange)");
+ verifyResult(result);
+ result.onsuccess = cursorSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function populateObjectStore(objectStore)
+{
+ result = evalAndLog("objectStore.add('myValue', 'myKey')");
+ verifyResult(result);
+ result.onsuccess = openCursor;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function createObjectStoreSuccess()
+{
+ verifySuccessEvent(event);
+ var objectStore = evalAndLog("objectStore = event.result");
+ populateObjectStore(objectStore);
+}
+
+function openSuccess()
+{
+ verifySuccessEvent(event);
+ var db = evalAndLog("db = event.result");
+
+ deleteAllObjectStores(db);
+
+ result = evalAndLog("db.createObjectStore('test')");
+ verifyResult(result);
+ result.onsuccess = createObjectStoreSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function test()
+{
+ result = evalAndLog("indexedDB.open('name', 'description')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+test();
+
+var successfullyParsed = true;
+
+</script>
</body>
</html>
diff --git a/LayoutTests/storage/indexeddb/script-tests/TEMPLATE.html b/LayoutTests/storage/indexeddb/script-tests/TEMPLATE.html
deleted file mode 100644
index 865fadb..0000000
--- a/LayoutTests/storage/indexeddb/script-tests/TEMPLATE.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<html>
-<head>
-<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
-<script src="../../fast/js/resources/js-test-pre.js"></script>
-<script src="../../fast/js/resources/js-test-post-function.js"></script>
-<script src="resources/shared.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-<script src="YOUR_JS_FILE_HERE"></script>
-</body>
-</html>
diff --git a/LayoutTests/storage/indexeddb/script-tests/basics.js b/LayoutTests/storage/indexeddb/script-tests/basics.js
deleted file mode 100644
index cebd48f..0000000
--- a/LayoutTests/storage/indexeddb/script-tests/basics.js
+++ /dev/null
@@ -1,26 +0,0 @@
-description("Test IndexedDB's basics.");
-if (window.layoutTestController)
- layoutTestController.waitUntilDone();
-
-function openCallback()
-{
- verifySuccessEvent(event);
- done();
-}
-
-function test()
-{
- shouldBeTrue("'indexedDB' in window");
- shouldBeFalse("indexedDB == null");
-
- // FIXME: Verify other IndexedDatabaseRequest constructors, once they're implemented.
-
- result = evalAndLog("indexedDB.open('name', 'description')");
- verifyResult(result);
- result.onsuccess = openCallback;
- result.onerror = unexpectedErrorCallback;
-}
-
-test();
-
-var successfullyParsed = true;
diff --git a/LayoutTests/storage/indexeddb/script-tests/database-basics.js b/LayoutTests/storage/indexeddb/script-tests/database-basics.js
deleted file mode 100644
index 10139fe..0000000
--- a/LayoutTests/storage/indexeddb/script-tests/database-basics.js
+++ /dev/null
@@ -1,71 +0,0 @@
-description("Test the basics of IndexedDB's IDBDatabase.");
-if (window.layoutTestController)
- layoutTestController.waitUntilDone();
-
-function openSuccess()
-{
- verifySuccessEvent(event);
-
- var db = evalAndLog("db = event.result");
- deleteAllObjectStores(db);
-
- // We must do something asynchronous before anything synchronous since
- // deleteAllObjectStores only schedules the object stores to be removed.
- // We don't know for sure whether it's happened until an IDBRequest object
- // that was created after the removes fires.
-
- debug("Testing setVersion.");
- result = evalAndLog('db.setVersion("version a")');
- verifyResult(result);
- result.onsuccess = setVersionAgain;
- result.onError = unexpectedErrorCallback;
-}
-
-function setVersionAgain()
-{
- verifySuccessEvent(event);
-
- result = evalAndLog('db.setVersion("version b")');
- verifyResult(result);
- result.onsuccess = createObjectStore;
- result.onError = unexpectedErrorCallback;
-}
-
-function createObjectStore()
-{
- verifySuccessEvent(event);
- shouldBeEqualToString("db.version", "version b");
- shouldBeEqualToString("db.name", "name");
- shouldBe("db.objectStores", "[]");
- shouldBe("db.objectStores.length", "0");
- shouldBe("db.objectStores.contains('')", "false");
-
- result = evalAndLog('db.createObjectStore("test123")');
- verifyResult(result);
- result.onsuccess = checkObjectStore;
- result.onError = unexpectedErrorCallback;
-}
-
-function checkObjectStore()
-{
- verifySuccessEvent(event);
- shouldBe("db.objectStores", "['test123']");
- shouldBe("db.objectStores.length", "1");
- shouldBe("db.objectStores.contains('')", "false");
- shouldBe("db.objectStores.contains('test456')", "false");
- shouldBe("db.objectStores.contains('test123')", "true");
-
- done();
-}
-
-function test()
-{
- result = evalAndLog("indexedDB.open('name', 'description')");
- verifyResult(result);
- result.onsuccess = openSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-test();
-
-var successfullyParsed = true;
diff --git a/LayoutTests/storage/indexeddb/script-tests/keyrange.js b/LayoutTests/storage/indexeddb/script-tests/keyrange.js
deleted file mode 100644
index a5b58f4..0000000
--- a/LayoutTests/storage/indexeddb/script-tests/keyrange.js
+++ /dev/null
@@ -1,108 +0,0 @@
-description("Test IndexedDB's KeyRange.");
-if (window.layoutTestController)
- layoutTestController.waitUntilDone();
-
-function checkSingleKeyRange(value)
-{
- keyRange = evalAndLog("IDBKeyRange.only(" + value + ")");
- shouldBe("keyRange.left", "" + value);
- shouldBe("keyRange.right", "" + value);
- shouldBe("keyRange.flags", "keyRange.SINGLE");
-}
-
-function checkLeftBoundKeyRange(value, open)
-{
- keyRange = evalAndLog("IDBKeyRange.leftBound(" + value + "," + open + ")");
- shouldBe("keyRange.left", "" + value);
- shouldBeNull("keyRange.right");
- shouldBe("keyRange.flags", open ? "keyRange.LEFT_OPEN | keyRange.LEFT_BOUND" : "keyRange.LEFT_BOUND");
-}
-
-function checkRightBoundKeyRange(value, open)
-{
- keyRange = evalAndLog("IDBKeyRange.rightBound(" + value + "," + open + ")");
- shouldBe("keyRange.right", "" + value);
- shouldBeNull("keyRange.left");
- shouldBe("keyRange.flags", open ? "keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND" : "keyRange.RIGHT_BOUND");
-}
-
-function checkBoundKeyRange(left, right, openLeft, openRight)
-{
- keyRange = evalAndLog("IDBKeyRange.bound(" + left + "," + right + "," + openLeft + "," + openRight + ")");
- shouldBe("keyRange.left", "" + left);
- shouldBe("keyRange.right", "" + right);
- leftFlags = keyRange.flags & (keyRange.LEFT_OPEN | keyRange.LEFT_BOUND);
- shouldBe("leftFlags", openLeft ? "keyRange.LEFT_OPEN | keyRange.LEFT_BOUND" : "keyRange.LEFT_BOUND");
- rightFlags = keyRange.flags & (keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND);
- shouldBe("rightFlags", openRight ? "keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND" : "keyRange.RIGHT_BOUND");
-}
-
-function test()
-{
- shouldBeTrue("'SINGLE' in IDBKeyRange");
- shouldBeTrue("'LEFT_OPEN' in IDBKeyRange");
- shouldBeTrue("'RIGHT_OPEN' in IDBKeyRange");
- shouldBeTrue("'LEFT_BOUND' in IDBKeyRange");
- shouldBeTrue("'RIGHT_BOUND' in IDBKeyRange");
- shouldBeFalse("'left' in IDBKeyRange");
- shouldBeFalse("'right' in IDBKeyRange");
- shouldBeFalse("'flags' in IDBKeyRange");
- shouldBeTrue("'only' in IDBKeyRange");
- shouldBeTrue("'leftBound' in IDBKeyRange");
- shouldBeTrue("'rightBound' in IDBKeyRange");
- shouldBeTrue("'bound' in IDBKeyRange");
-
- debug("");
-
- var instance = evalAndLog("instance = IDBKeyRange.only(1)");
- shouldBeTrue("'SINGLE' in instance");
- shouldBeTrue("'LEFT_OPEN' in instance");
- shouldBeTrue("'RIGHT_OPEN' in instance");
- shouldBeTrue("'LEFT_BOUND' in instance");
- shouldBeTrue("'RIGHT_BOUND' in instance");
- shouldBeTrue("'left' in instance");
- shouldBeTrue("'right' in instance");
- shouldBeTrue("'flags' in instance");
- shouldBeFalse("'only' in instance");
- shouldBeFalse("'leftBound' in instance");
- shouldBeFalse("'rightBound' in instance");
- shouldBeFalse("'bound' in instance");
-
- debug("");
-
- checkSingleKeyRange(1);
- checkSingleKeyRange("'a'");
-
- checkLeftBoundKeyRange(10, true);
- checkLeftBoundKeyRange(11, false);
- checkLeftBoundKeyRange(12);
- checkLeftBoundKeyRange("'aa'", true);
- checkLeftBoundKeyRange("'ab'", false);
- checkLeftBoundKeyRange("'ac'");
-
- checkRightBoundKeyRange(20, true);
- checkRightBoundKeyRange(21, false);
- checkRightBoundKeyRange(22);
- checkRightBoundKeyRange("'ba'", true);
- checkRightBoundKeyRange("'bb'", false);
- checkRightBoundKeyRange("'bc'");
-
- checkBoundKeyRange(30, 40);
- checkBoundKeyRange(31, 41, false, false);
- checkBoundKeyRange(32, 42, false, true);
- checkBoundKeyRange(33, 43, true, false);
- checkBoundKeyRange(34, 44, true, true);
-
- checkBoundKeyRange("'aaa'", "'aba'", false, false);
- checkBoundKeyRange("'aab'", "'abb'");
- checkBoundKeyRange("'aac'", "'abc'", false, false);
- checkBoundKeyRange("'aad'", "'abd'", false, true);
- checkBoundKeyRange("'aae'", "'abe'", true, false);
- checkBoundKeyRange("'aaf'", "'abf'", true, true);
-
-}
-
-test();
-
-var successfullyParsed = true;
-done();
diff --git a/LayoutTests/storage/indexeddb/script-tests/objectstore-basics.js b/LayoutTests/storage/indexeddb/script-tests/objectstore-basics.js
deleted file mode 100644
index 35ccb4a..0000000
--- a/LayoutTests/storage/indexeddb/script-tests/objectstore-basics.js
+++ /dev/null
@@ -1,94 +0,0 @@
-description("Test the basics of IndexedDB's IDBObjectStore.");
-if (window.layoutTestController)
- layoutTestController.waitUntilDone();
-
-function test()
-{
- result = evalAndLog("indexedDB.open('name', 'description')");
- verifyResult(result);
- result.onsuccess = openSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-function openSuccess()
-{
- debug("openSuccess():");
- verifySuccessEvent(event);
- db = evalAndLog("db = event.result");
-
- deleteAllObjectStores(db);
-
- result = evalAndLog("db.createObjectStore('storeName', null)");
- verifyResult(result);
- result.onsuccess = createSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-function createSuccess()
-{
- debug("createSuccess():");
- verifySuccessEvent(event);
- var store = evalAndLog("store = event.result");
- var storeNames = evalAndLog("storeNames = db.objectStores");
-
- shouldBeEqualToString("store.name", "storeName");
- shouldBeNull("store.keyPath");
- shouldBe("storeNames.contains('storeName')", "true");
- shouldBe("storeNames.length", "1");
- // FIXME: test all of object store's methods.
-
- result = evalAndLog("event.result.createIndex('indexName', 'x')");
- verifyResult(result);
- result.onsuccess = addIndexSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-function addIndexSuccess()
-{
- debug("addIndexSuccess():");
- verifySuccessEvent(event);
- shouldBeTrue("event.source.indexNames.contains('indexName')");
-
- result = evalAndLog("event.source.add({x: 'value'}, 'key')");
- verifyResult(result);
- result.onsuccess = addSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-function addSuccess()
-{
- debug("addSuccess():");
- verifySuccessEvent(event);
- shouldBeEqualToString("event.result", "key");
- var store = evalAndLog("store = event.source");
-
- result = evalAndLog("store.get('key')");
- verifyResult(result);
- result.onsuccess = getSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-function getSuccess()
-{
- debug("getSuccess():");
- verifySuccessEvent(event);
- shouldBeEqualToString("event.result.x", "value");
- var store = evalAndLog("store = event.source");
-
- result = evalAndLog("store.remove('key')");
- verifyResult(result);
- result.onsuccess = removeSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-function removeSuccess()
-{
- debug("removeSuccess():");
- verifySuccessEvent(event);
- shouldBeNull("event.result");
- done();
-}
-
-test();
-
-var successfullyParsed = true;
diff --git a/LayoutTests/storage/indexeddb/script-tests/open-cursor.js b/LayoutTests/storage/indexeddb/script-tests/open-cursor.js
deleted file mode 100644
index 53ea96b..0000000
--- a/LayoutTests/storage/indexeddb/script-tests/open-cursor.js
+++ /dev/null
@@ -1,83 +0,0 @@
-description("Test IndexedDB's openCursor.");
-if (window.layoutTestController)
- layoutTestController.waitUntilDone();
-
-function emptyCursorSuccess()
-{
- debug("Empty cursor opened successfully.")
- verifySuccessEvent(event);
- // FIXME: check that we can iterate the cursor.
- done();
-}
-
-function openEmptyCursor()
-{
- debug("Opening an empty cursor.");
- keyRange = IDBKeyRange.leftBound("InexistentKey");
- result = evalAndLog("objectStore.openCursor(keyRange)");
- verifyResult(result);
- result.onsuccess = emptyCursorSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-function cursorSuccess()
-{
- debug("Cursor opened successfully.")
- verifySuccessEvent(event);
- // FIXME: check that we can iterate the cursor.
- shouldBe("event.result.direction", "0");
- shouldBe("event.result.key", "'myKey'");
- shouldBe("event.result.value", "'myValue'");
- debug("");
- openEmptyCursor();
-}
-
-function openCursor()
-{
- debug("Opening cursor");
- keyRange = IDBKeyRange.leftBound("myKey");
- result = evalAndLog("objectStore.openCursor(keyRange)");
- verifyResult(result);
- result.onsuccess = cursorSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-function populateObjectStore(objectStore)
-{
- result = evalAndLog("objectStore.add('myValue', 'myKey')");
- verifyResult(result);
- result.onsuccess = openCursor;
- result.onerror = unexpectedErrorCallback;
-}
-
-function createObjectStoreSuccess()
-{
- verifySuccessEvent(event);
- var objectStore = evalAndLog("objectStore = event.result");
- populateObjectStore(objectStore);
-}
-
-function openSuccess()
-{
- verifySuccessEvent(event);
- var db = evalAndLog("db = event.result");
-
- deleteAllObjectStores(db);
-
- result = evalAndLog("db.createObjectStore('test')");
- verifyResult(result);
- result.onsuccess = createObjectStoreSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-function test()
-{
- result = evalAndLog("indexedDB.open('name', 'description')");
- verifyResult(result);
- result.onsuccess = openSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-test();
-
-var successfullyParsed = true;
diff --git a/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js b/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js
deleted file mode 100644
index 58ac2a7..0000000
--- a/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js
+++ /dev/null
@@ -1,47 +0,0 @@
-description("Test IndexedDB transaction basics.");
-if (window.layoutTestController)
- layoutTestController.waitUntilDone();
-
-function test()
-{
- shouldBeTrue("'indexedDB' in window");
- shouldBeFalse("indexedDB == null");
-
- result = evalAndLog("indexedDB.open('name', 'description')");
- verifyResult(result);
- result.onsuccess = openSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-function openSuccess()
-{
- debug("createObjectStoreCallback():");
- verifySuccessEvent(event);
- db = evalAndLog("db = event.result");
-
- deleteAllObjectStores(db);
-
- result = evalAndLog("db.createObjectStore('storeName', null)");
- verifyResult(result);
- result.onsuccess = createSuccess;
- result.onerror = unexpectedErrorCallback;
-}
-
-function createSuccess()
-{
- verifySuccessEvent(event);
- transaction = evalAndLog("db.transaction()");
- transaction.onabort = abortCallback;
- var store = evalAndLog("store = transaction.objectStore('storeName')");
- shouldBeEqualToString("store.name", "storeName");
-}
-
-function abortCallback()
-{
- verifyAbortEvent(event);
- done();
-}
-
-test();
-
-var successfullyParsed = true;
diff --git a/LayoutTests/storage/indexeddb/transaction-basics.html b/LayoutTests/storage/indexeddb/transaction-basics.html
index a7238f6..cea5d5d 100644
--- a/LayoutTests/storage/indexeddb/transaction-basics.html
+++ b/LayoutTests/storage/indexeddb/transaction-basics.html
@@ -8,6 +8,56 @@
<body>
<p id="description"></p>
<div id="console"></div>
-<script src="script-tests/transaction-basics.js"></script>
+<script>
+
+description("Test IndexedDB transaction basics.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ shouldBeTrue("'indexedDB' in window");
+ shouldBeFalse("indexedDB == null");
+
+ result = evalAndLog("indexedDB.open('name', 'description')");
+ verifyResult(result);
+ result.onsuccess = openSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ debug("createObjectStoreCallback():");
+ verifySuccessEvent(event);
+ db = evalAndLog("db = event.result");
+
+ deleteAllObjectStores(db);
+
+ result = evalAndLog("db.createObjectStore('storeName', null)");
+ verifyResult(result);
+ result.onsuccess = createSuccess;
+ result.onerror = unexpectedErrorCallback;
+}
+
+function createSuccess()
+{
+ verifySuccessEvent(event);
+ transaction = evalAndLog("db.transaction()");
+ transaction.onabort = abortCallback;
+ var store = evalAndLog("store = transaction.objectStore('storeName')");
+ shouldBeEqualToString("store.name", "storeName");
+}
+
+function abortCallback()
+{
+ verifyAbortEvent(event);
+ done();
+}
+
+test();
+
+var successfullyParsed = true;
+
+</script>
</body>
</html>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list