Title: [96335] trunk/LayoutTests
- Revision
- 96335
- Author
- [email protected]
- Date
- 2011-09-29 09:42:48 -0700 (Thu, 29 Sep 2011)
Log Message
Layout test demonstrating IDBCursor inconsistency bug.
https://bugs.webkit.org/show_bug.cgi?id=69012
Reviewed by Nate Chapin.
* storage/indexeddb/cursor-inconsistency-expected.txt: Added.
* storage/indexeddb/cursor-inconsistency.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (96334 => 96335)
--- trunk/LayoutTests/ChangeLog 2011-09-29 16:32:49 UTC (rev 96334)
+++ trunk/LayoutTests/ChangeLog 2011-09-29 16:42:48 UTC (rev 96335)
@@ -1,3 +1,13 @@
+2011-09-29 David Grogan <[email protected]>
+
+ Layout test demonstrating IDBCursor inconsistency bug.
+ https://bugs.webkit.org/show_bug.cgi?id=69012
+
+ Reviewed by Nate Chapin.
+
+ * storage/indexeddb/cursor-inconsistency-expected.txt: Added.
+ * storage/indexeddb/cursor-inconsistency.html: Added.
+
2011-09-29 Adam Barth <[email protected]>
Generalize expected result to all of MAC.
Added: trunk/LayoutTests/storage/indexeddb/cursor-inconsistency-expected.txt (0 => 96335)
--- trunk/LayoutTests/storage/indexeddb/cursor-inconsistency-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/cursor-inconsistency-expected.txt 2011-09-29 16:42:48 UTC (rev 96335)
@@ -0,0 +1,62 @@
+Test consistency of IndexedDB's cursor objects.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+webkitIndexedDB.open('cursor-inconsistency')
+db = event.target.result
+db.setVersion('new version')
+setVersionSuccess():
+trans = event.target.result
+PASS trans !== null is true
+Deleted all object stores.
+objectStore = db.createObjectStore('basicStore')
+objectStore.add('someValue1', 'someKey1')._onerror_ = unexpectedErrorCallback
+objectStore.add('someValue2', 'someKey2')._onerror_ = unexpectedErrorCallback
+objectStore.add('someValue3', 'someKey3')._onerror_ = unexpectedErrorCallback
+objectStore.add('someValue4', 'someKey4')._onerror_ = unexpectedErrorCallback
+openBasicCursor()
+trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
+trans.objectStore('basicStore')
+objectStore.openCursor(keyRange)
+
+checkCursor()
+storedCursor = event.target.result
+PASS storedCursor === event.target.result is true
+PASS storedCursor.key is "someKey1"
+PASS event.target.result.key is "someKey1"
+PASS storedCursor.value is "someValue1"
+PASS event.target.result.value is "someValue1"
+event.target.result.continue()
+
+checkCursor()
+FAIL storedCursor === event.target.result should be true. Was false.
+PASS storedCursor.key is "someKey2"
+PASS event.target.result.key is "someKey2"
+FAIL storedCursor.value should be someValue2. Was someValue1.
+PASS event.target.result.value is "someValue2"
+event.target.result.continue()
+
+checkCursor()
+FAIL storedCursor === event.target.result should be true. Was false.
+PASS storedCursor.key is "someKey3"
+PASS event.target.result.key is "someKey3"
+FAIL storedCursor.value should be someValue3. Was someValue1.
+PASS event.target.result.value is "someValue3"
+event.target.result.continue()
+
+checkCursor()
+FAIL storedCursor === event.target.result should be true. Was false.
+PASS storedCursor.key is "someKey4"
+PASS event.target.result.key is "someKey4"
+FAIL storedCursor.value should be someValue4. Was someValue1.
+PASS event.target.result.value is "someValue4"
+event.target.result.continue()
+
+checkCursor()
+PASS counter is 5
+transactionComplete()
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/storage/indexeddb/cursor-inconsistency.html (0 => 96335)
--- trunk/LayoutTests/storage/indexeddb/cursor-inconsistency.html (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/cursor-inconsistency.html 2011-09-29 16:42:48 UTC (rev 96335)
@@ -0,0 +1,99 @@
+<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 consistency of IndexedDB's cursor objects.");
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+test();
+
+function test()
+{
+ request = evalAndLog("webkitIndexedDB.open('cursor-inconsistency')");
+ request._onsuccess_ = openSuccess;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+ var db = evalAndLog("db = event.target.result");
+
+ request = evalAndLog("db.setVersion('new version')");
+ request._onsuccess_ = setVersionSuccess;
+ request._onerror_ = unexpectedErrorCallback;
+}
+
+function setVersionSuccess()
+{
+ debug("setVersionSuccess():");
+ window.trans = evalAndLog("trans = event.target.result");
+ shouldBeTrue("trans !== null");
+ trans._onabort_ = unexpectedAbortCallback;
+ trans._oncomplete_ = openBasicCursor;
+
+ deleteAllObjectStores(db);
+
+ var objectStore = evalAndLog("objectStore = db.createObjectStore('basicStore')");
+ evalAndLog("objectStore.add('someValue1', 'someKey1')._onerror_ = unexpectedErrorCallback");
+ evalAndLog("objectStore.add('someValue2', 'someKey2')._onerror_ = unexpectedErrorCallback");
+ evalAndLog("objectStore.add('someValue3', 'someKey3')._onerror_ = unexpectedErrorCallback");
+ evalAndLog("objectStore.add('someValue4', 'someKey4')._onerror_ = unexpectedErrorCallback");
+
+}
+
+function openBasicCursor()
+{
+ debug("openBasicCursor()");
+ evalAndLog("trans = db.transaction([], webkitIDBTransaction.READ_WRITE)");
+ trans._onabort_ = unexpectedAbortCallback;
+ trans._oncomplete_ = transactionComplete;
+
+ keyRange = webkitIDBKeyRange.lowerBound("someKey1");
+ window.objectStore = evalAndLog("trans.objectStore('basicStore')");
+ request = evalAndLog("objectStore.openCursor(keyRange)");
+ request._onsuccess_ = checkCursor;
+ request._onerror_ = unexpectedErrorCallback;
+ counter = 1;
+}
+
+storedCursor = null;
+function checkCursor()
+{
+ debug("")
+ debug("checkCursor()");
+ if (event.target.result == null) {
+ shouldBe("counter", "5");
+ return;
+ }
+ if (storedCursor == null)
+ storedCursor = evalAndLog("storedCursor = event.target.result");
+
+ shouldBeTrue("storedCursor === event.target.result");
+ shouldBeEqualToString("storedCursor.key", "someKey" + counter);
+ shouldBeEqualToString("event.target.result.key", "someKey" + counter);
+ shouldBeEqualToString("storedCursor.value", "someValue" + counter);
+ shouldBeEqualToString("event.target.result.value", "someValue" + counter);
+ counter++;
+ evalAndLog("event.target.result.continue()");
+}
+
+function transactionComplete()
+{
+ debug("transactionComplete()");
+ done();
+}
+
+var successfullyParsed = true;
+
+</script>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes