Title: [88397] trunk/LayoutTests
- Revision
- 88397
- Author
- commit-qu...@webkit.org
- Date
- 2011-06-08 15:35:08 -0700 (Wed, 08 Jun 2011)
Log Message
2011-06-08 Mark Pilgrim <pilg...@chromium.org>
Reviewed by Tony Chang.
IndexedDB test: key sort order across types
https://bugs.webkit.org/show_bug.cgi?id=62299
* storage/indexeddb/key-sort-order-across-types-expected.txt: Added.
* storage/indexeddb/key-sort-order-across-types.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (88396 => 88397)
--- trunk/LayoutTests/ChangeLog 2011-06-08 22:24:38 UTC (rev 88396)
+++ trunk/LayoutTests/ChangeLog 2011-06-08 22:35:08 UTC (rev 88397)
@@ -2,6 +2,16 @@
Reviewed by Tony Chang.
+ IndexedDB test: key sort order across types
+ https://bugs.webkit.org/show_bug.cgi?id=62299
+
+ * storage/indexeddb/key-sort-order-across-types-expected.txt: Added.
+ * storage/indexeddb/key-sort-order-across-types.html: Added.
+
+2011-06-08 Mark Pilgrim <pilg...@chromium.org>
+
+ Reviewed by Tony Chang.
+
IndexedDB test: key sort order for Date objects
https://bugs.webkit.org/show_bug.cgi?id=62300
Added: trunk/LayoutTests/storage/indexeddb/key-sort-order-across-types-expected.txt (0 => 88397)
--- trunk/LayoutTests/storage/indexeddb/key-sort-order-across-types-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/key-sort-order-across-types-expected.txt 2011-06-08 22:35:08 UTC (rev 88397)
@@ -0,0 +1,50 @@
+Test IndexedDB key comparison
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
+PASS indexedDB == null is false
+IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;
+PASS IDBDatabaseException == null is false
+IDBCursor = window.IDBCursor || window.webkitIDBCursor;
+PASS IDBCursor == null is false
+IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
+PASS IDBKeyRange == null is false
+indexedDB.open(name, description)
+db = event.target.result
+request = db.setVersion('1')
+Deleted all object stores.
+db.createObjectStore('foo');
+request = objectStore.add([], Infinity);
+request = objectStore.add([], -Infinity);
+request = objectStore.add([], 1.0);
+request = objectStore.add([], '');
+request = objectStore.add([], '1.0');
+sortedKey = [-Infinity, 1.0, Infinity, '', '1.0'];
+request = objectStore.openCursor();
+cursor = event.target.result;
+PASS cursor.key is sortedKeys[keyIndex]
+cursor.continue();
+keyIndex++;
+cursor = event.target.result;
+PASS cursor.key is sortedKeys[keyIndex]
+cursor.continue();
+keyIndex++;
+cursor = event.target.result;
+PASS cursor.key is sortedKeys[keyIndex]
+cursor.continue();
+keyIndex++;
+cursor = event.target.result;
+PASS cursor.key is sortedKeys[keyIndex]
+cursor.continue();
+keyIndex++;
+cursor = event.target.result;
+PASS cursor.key is sortedKeys[keyIndex]
+cursor.continue();
+keyIndex++;
+cursor = event.target.result;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/storage/indexeddb/key-sort-order-across-types.html (0 => 88397)
--- trunk/LayoutTests/storage/indexeddb/key-sort-order-across-types.html (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/key-sort-order-across-types.html 2011-06-08 22:35:08 UTC (rev 88397)
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+
+description("Test IndexedDB key comparison");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function test()
+{
+ indexedDB = evalAndLog("indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;");
+ shouldBeFalse("indexedDB == null");
+ IDBDatabaseException = evalAndLog("IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;");
+ shouldBeFalse("IDBDatabaseException == null");
+ IDBCursor = evalAndLog("IDBCursor = window.IDBCursor || window.webkitIDBCursor;");
+ shouldBeFalse("IDBCursor == null");
+ IDBKeyRange = evalAndLog("IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;");
+ shouldBeFalse("IDBKeyRange == null");
+
+ name = window.location.pathname;
+ description = "My Test Database";
+ request = evalAndLog("indexedDB.open(name, description)");
+ request._onsuccess_ = openSuccess;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ db = evalAndLog("db = event.target.result");
+
+ request = evalAndLog("request = db.setVersion('1')");
+ request._onsuccess_ = addKey1;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function addKey1()
+{
+ deleteAllObjectStores(db);
+
+ objectStore = evalAndLog("db.createObjectStore('foo');");
+ request = evalAndLog("request = objectStore.add([], Infinity);");
+ request._onsuccess_ = addKey2;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function addKey2()
+{
+ request = evalAndLog("request = objectStore.add([], -Infinity);");
+ request._onsuccess_ = addKey3;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function addKey3()
+{
+ request = evalAndLog("request = objectStore.add([], 1.0);");
+ request._onsuccess_ = addKey4;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function addKey4()
+{
+ request = evalAndLog("request = objectStore.add([], '');");
+ request._onsuccess_ = addKey5;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function addKey5()
+{
+ request = evalAndLog("request = objectStore.add([], '1.0');");
+ request._onsuccess_ = openACursor;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function openACursor()
+{
+ keyIndex = 0;
+ sortedKeys = evalAndLog("sortedKey = [-Infinity, 1.0, Infinity, '', '1.0'];");
+ request = evalAndLog("request = objectStore.openCursor();");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onsuccess_ = function (event) {
+ cursor = evalAndLog("cursor = event.target.result;");
+ if (cursor) {
+ shouldBe("cursor.key", "sortedKeys[keyIndex]");
+ evalAndLog("cursor.continue();");
+ evalAndLog("keyIndex++;");
+ }
+ else {
+ done();
+ }
+ }
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes