Title: [88708] trunk/LayoutTests
Revision
88708
Author
commit-qu...@webkit.org
Date
2011-06-13 15:17:57 -0700 (Mon, 13 Jun 2011)

Log Message

2011-06-13  Mark Pilgrim  <pilg...@chromium.org>

        Reviewed by Eric Seidel.

        IndexedDB test: readonly properties
        https://bugs.webkit.org/show_bug.cgi?id=62392

        * storage/indexeddb/readonly-expected.txt: Added.
        * storage/indexeddb/readonly.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (88707 => 88708)


--- trunk/LayoutTests/ChangeLog	2011-06-13 22:16:15 UTC (rev 88707)
+++ trunk/LayoutTests/ChangeLog	2011-06-13 22:17:57 UTC (rev 88708)
@@ -1,3 +1,13 @@
+2011-06-13  Mark Pilgrim  <pilg...@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        IndexedDB test: readonly properties
+        https://bugs.webkit.org/show_bug.cgi?id=62392
+
+        * storage/indexeddb/readonly-expected.txt: Added.
+        * storage/indexeddb/readonly.html: Added.
+
 2011-06-13  Annie Sullivan  <sulli...@chromium.org>
 
         Reviewed by Dimitri Glazkov.

Added: trunk/LayoutTests/storage/indexeddb/readonly-expected.txt (0 => 88708)


--- trunk/LayoutTests/storage/indexeddb/readonly-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/readonly-expected.txt	2011-06-13 22:17:57 UTC (rev 88708)
@@ -0,0 +1,93 @@
+Test IndexedDB readonly properties
+
+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)
+trying to set readonly property request.result
+request.result = Infinity
+PASS request.result is still [object IDBDatabase]
+trying to set readonly property request.errorCode
+request.errorCode = 666
+PASS request.errorCode is still 0
+trying to set readonly property request.source
+request.source = this
+PASS request.source is still [object IDBFactory]
+trying to set readonly property request.transaction
+request.transaction = this
+PASS request.transaction is still null
+trying to set readonly property request.readyState
+request.readyState = 666
+PASS request.readyState is still 2
+db = event.target.result
+trying to set readonly property db.name
+db.name = 'bar'
+PASS db.name is still foo
+request = db.setVersion('1')
+transaction = event.target.result;
+trying to set readonly property transaction.mode
+transaction.mode = 666
+PASS transaction.mode is still 2
+trying to set readonly property transaction.db
+transaction.db = this
+PASS transaction.db is still [object IDBDatabase]
+Deleted all object stores.
+objectStore = db.createObjectStore('foo');
+trying to set readonly property objectStore.name
+objectStore.name = 'bar'
+PASS objectStore.name is still foo
+trying to set readonly property objectStore.keyPath
+objectStore.keyPath = 'bar'
+PASS objectStore.keyPath is still null
+result = objectStore.add({}, 'first');
+result = objectStore.openCursor();
+cursor = event.target.result;
+trying to set readonly property cursor.source
+cursor.source = this
+PASS cursor.source is still [object IDBObjectStore]
+trying to set readonly property cursor.direction
+cursor.direction = 666
+PASS cursor.direction is still 0
+trying to set readonly property cursor.key
+cursor.key = Infinity
+PASS cursor.key is still first
+trying to set readonly property cursor.primaryKey
+cursor.primaryKey = Infinity
+PASS cursor.primaryKey is still first
+index = objectStore.createIndex('first', 'first');
+trying to set readonly property index.name
+index.name = 'bar'
+PASS index.name is still first
+trying to set readonly property index.objectStore
+index.objectStore = this
+PASS index.objectStore is still [object IDBObjectStore]
+trying to set readonly property index.keyPath
+index.keyPath = 'bar'
+PASS index.keyPath is still first
+trying to set readonly property index.unique
+index.unique = true
+PASS index.unique is still false
+trying to set readonly property keyRange.lower
+keyRange.lower = Infinity
+PASS keyRange.lower is still first
+trying to set readonly property keyRange.upper
+keyRange.upper = Infinity
+PASS keyRange.upper is still first
+trying to set readonly property keyRange.lowerOpen
+keyRange.lowerOpen = true
+PASS keyRange.lowerOpen is still false
+trying to set readonly property keyRange.upperOpen
+keyRange.upperOpen = true
+PASS keyRange.upperOpen is still false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/indexeddb/readonly.html (0 => 88708)


--- trunk/LayoutTests/storage/indexeddb/readonly.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/readonly.html	2011-06-13 22:17:57 UTC (rev 88708)
@@ -0,0 +1,128 @@
+<!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 readonly properties");
+if (window.layoutTestController)
+    layoutTestController.waitUntilDone();
+
+function setReadonlyProperty(property, value)
+{
+    oldValue = eval(property);
+    debug("trying to set readonly property " + property);
+    evalAndLog(property + " = " + value);
+    newValue = eval(property);
+    if (oldValue == newValue) {
+        testPassed(property + " is still " + oldValue);
+    } else {
+        testFailed(property + " value was changed");
+    }
+}
+
+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 = "foo";
+    description = "My Test Database";
+    request = evalAndLog("indexedDB.open(name, description)");
+    request._onsuccess_ = openSuccess;
+    request._onerror_ = unexpectedErrorCallback;
+}
+
+function openSuccess()
+{
+    setReadonlyProperty("request.result", "Infinity");
+    setReadonlyProperty("request.errorCode", "666");
+    setReadonlyProperty("request.source", "this");
+    setReadonlyProperty("request.transaction", "this");
+    setReadonlyProperty("request.readyState", "666");
+
+    db = evalAndLog("db = event.target.result");
+    setReadonlyProperty("db.name", "'bar'");
+
+    request = evalAndLog("request = db.setVersion('1')");
+    request._onsuccess_ = createAndPopulateObjectStore;
+    request._onerror_ = unexpectedErrorCallback;
+}
+
+function createAndPopulateObjectStore()
+{
+    transaction = evalAndLog("transaction = event.target.result;");
+    setReadonlyProperty("transaction.mode", "666");
+    setReadonlyProperty("transaction.db", "this");
+
+    deleteAllObjectStores(db);
+
+    objectStore = evalAndLog("objectStore = db.createObjectStore('foo');");
+
+    setReadonlyProperty("objectStore.name", "'bar'");
+    setReadonlyProperty("objectStore.keyPath", "'bar'");
+/* fails, split into separate test
+    setReadonlyProperty("objectStore.indexNames", "['bar']");
+*/
+/* fails, split into separate test
+    setReadonlyProperty("objectStore.transaction", "this");
+*/
+
+    result = evalAndLog("result = objectStore.add({}, 'first');");
+    result._onerror_ = unexpectedErrorCallback;
+    result._onsuccess_ = addSuccess;
+}
+
+function addSuccess()
+{
+    result = evalAndLog("result = objectStore.openCursor();");
+    result._onerror_ = unexpectedErrorCallback;
+    result._onsuccess_ = checkCursor;
+}
+
+function checkCursor()
+{
+    cursor = evalAndLog("cursor = event.target.result;");
+    if (cursor) {
+        setReadonlyProperty("cursor.source", "this");
+        setReadonlyProperty("cursor.direction", "666");
+        setReadonlyProperty("cursor.key", "Infinity");
+        setReadonlyProperty("cursor.primaryKey", "Infinity");
+    } else {
+        testFailed("cursor is null");
+    }
+
+    index = evalAndLog("index = objectStore.createIndex('first', 'first');");
+    setReadonlyProperty("index.name", "'bar'");
+    setReadonlyProperty("index.objectStore", "this");
+    setReadonlyProperty("index.keyPath", "'bar'");
+    setReadonlyProperty("index.unique", "true");
+
+    keyRange = IDBKeyRange.only("first");
+    setReadonlyProperty("keyRange.lower", "Infinity");
+    setReadonlyProperty("keyRange.upper", "Infinity");
+    setReadonlyProperty("keyRange.lowerOpen", "true");
+    setReadonlyProperty("keyRange.upperOpen", "true");
+
+    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

Reply via email to