Title: [89476] trunk/LayoutTests
Revision
89476
Author
[email protected]
Date
2011-06-22 13:44:42 -0700 (Wed, 22 Jun 2011)

Log Message

2011-06-22  Tony Chang  <[email protected]>

        Add test that got renamed.  Should have been included with r89466.

        * storage/indexeddb/keypath-basics.html: Renamed from LayoutTests/storage/indexeddb/keypath-as-array.html.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (89475 => 89476)


--- trunk/LayoutTests/ChangeLog	2011-06-22 20:43:11 UTC (rev 89475)
+++ trunk/LayoutTests/ChangeLog	2011-06-22 20:44:42 UTC (rev 89476)
@@ -1,3 +1,9 @@
+2011-06-22  Tony Chang  <[email protected]>
+
+        Add test that got renamed.  Should have been included with r89466.
+
+        * storage/indexeddb/keypath-basics.html: Renamed from LayoutTests/storage/indexeddb/keypath-as-array.html.
+
 2011-06-22  Beth Dakin  <[email protected]>
 
         Reviewed by Simon Fraser.

Deleted: trunk/LayoutTests/storage/indexeddb/keypath-as-array.html (89475 => 89476)


--- trunk/LayoutTests/storage/indexeddb/keypath-as-array.html	2011-06-22 20:43:11 UTC (rev 89475)
+++ trunk/LayoutTests/storage/indexeddb/keypath-as-array.html	2011-06-22 20:44:42 UTC (rev 89476)
@@ -1,65 +0,0 @@
-<!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 path corner cases");
-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_ = testGroup1;
-    request._onerror_ = unexpectedErrorCallback;
-}
-
-function testGroup1()
-{
-    deleteAllObjectStores(db);
-
-    debug("test keypath as array");
-    evalAndLog("db.createObjectStore('foo', {keyPath: ['foo'], autoIncrement: true})");
-    evalAndLog("db.createObjectStore('foobar', {keyPath: ['foo', 'bar'], autoIncrement: true})");
-    evalAndLog("db.createObjectStore('empty', {keyPath: [], autoIncrement: true})");
-    evalAndLog("db.createObjectStore('nested', {keyPath: [[]], autoIncrement: true})");
-    evalAndLog("db.createObjectStore('arrayofempty', {keyPath: ['', ''], autoIncrement: true})");
-    evalAndLog("db.createObjectStore('arrayoffloat', {keyPath: [1.0, 2.0], autoIncrement: true})");
-    done();
-}
-
-var successfullyParsed = true;
-
-test();
-
-</script>
-</body>
-</html>

Copied: trunk/LayoutTests/storage/indexeddb/keypath-basics.html (from rev 89475, trunk/LayoutTests/storage/indexeddb/keypath-as-array.html) (0 => 89476)


--- trunk/LayoutTests/storage/indexeddb/keypath-basics.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/keypath-basics.html	2011-06-22 20:44:42 UTC (rev 89476)
@@ -0,0 +1,79 @@
+<!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 for valid and invalid keypaths");
+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_ = testValidKeyPaths;
+    request._onerror_ = unexpectedErrorCallback;
+}
+
+function testValidKeyPaths()
+{
+    deleteAllObjectStores(db);
+
+    testKeyPaths = [null, undefined, '', 'foo', 'foo.bar.baz'];
+    testKeyPaths.forEach(function (keyPath) {
+        globalKeyPath = keyPath;
+        evalAndLog("db.createObjectStore('name', {keyPath: globalKeyPath})");
+        deleteAllObjectStores(db);
+    });
+
+    testInvalidKeyPaths();
+}
+
+function testInvalidKeyPaths()
+{
+    deleteAllObjectStores(db);
+
+    testKeyPaths = ['[]', '["foo"]', '["foo", "bar"]', '["", ""]', '[1.0, 2.0]', '[["foo"]]', '["foo", ["bar"]]'];
+    testKeyPaths.forEach(function (keyPath) {
+        globalKeyPath = keyPath;
+        evalAndExpectException("db.createObjectStore('name', {keyPath: globalKeyPath})", "IDBDatabaseException.NON_TRANSIENT_ERR");
+        deleteAllObjectStores(db);
+    });
+
+    done();
+}
+
+var successfullyParsed = true;
+
+test();
+
+</script>
+</body>
+</html>

Property changes: trunk/LayoutTests/storage/indexeddb/keypath-basics.html


Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to