Title: [122475] trunk/LayoutTests
- Revision
- 122475
- Author
- jsb...@chromium.org
- Date
- 2012-07-12 10:10:43 -0700 (Thu, 12 Jul 2012)
Log Message
IndexedDB: Verify internal "delete pending" flag on database
https://bugs.webkit.org/show_bug.cgi?id=90995
Reviewed by Tony Chang.
Verify the behavior required by the spec that an open() following
a deleteDatabase() is delayed and returns a new database.
* storage/indexeddb/database-deletepending-flag-expected.txt: Added.
* storage/indexeddb/database-deletepending-flag.html: Added.
* storage/indexeddb/resources/database-deletepending-flag.js: Added.
(test):
(openConnection.request.onsuccess.request.onsuccess):
(openConnection.request.onsuccess):
(openConnection):
(testDatabaseDelete.connection.onversionchange):
(testDatabaseDelete.deleteRequest.onblocked):
(testDatabaseDelete.deleteRequest.onsuccess):
(testDatabaseDelete.openRequest.onsuccess):
(testDatabaseDelete):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (122474 => 122475)
--- trunk/LayoutTests/ChangeLog 2012-07-12 17:07:16 UTC (rev 122474)
+++ trunk/LayoutTests/ChangeLog 2012-07-12 17:10:43 UTC (rev 122475)
@@ -1,3 +1,26 @@
+2012-07-12 Joshua Bell <jsb...@chromium.org>
+
+ IndexedDB: Verify internal "delete pending" flag on database
+ https://bugs.webkit.org/show_bug.cgi?id=90995
+
+ Reviewed by Tony Chang.
+
+ Verify the behavior required by the spec that an open() following
+ a deleteDatabase() is delayed and returns a new database.
+
+ * storage/indexeddb/database-deletepending-flag-expected.txt: Added.
+ * storage/indexeddb/database-deletepending-flag.html: Added.
+ * storage/indexeddb/resources/database-deletepending-flag.js: Added.
+ (test):
+ (openConnection.request.onsuccess.request.onsuccess):
+ (openConnection.request.onsuccess):
+ (openConnection):
+ (testDatabaseDelete.connection.onversionchange):
+ (testDatabaseDelete.deleteRequest.onblocked):
+ (testDatabaseDelete.deleteRequest.onsuccess):
+ (testDatabaseDelete.openRequest.onsuccess):
+ (testDatabaseDelete):
+
2012-07-12 Allan Sandfeld Jensen <allan.jen...@nokia.com>
Move nodesFromRect tests to separate sub-directory.
Added: trunk/LayoutTests/storage/indexeddb/database-deletepending-flag-expected.txt (0 => 122475)
--- trunk/LayoutTests/storage/indexeddb/database-deletepending-flag-expected.txt (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/database-deletepending-flag-expected.txt 2012-07-12 17:10:43 UTC (rev 122475)
@@ -0,0 +1,49 @@
+Test IndexedDB IDBDatabase internal delete pending flag
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+dbname = self.location.pathname
+indexedDB.deleteDatabase(dbname)
+
+Open a connection and set a sentinel version:
+version = '10'
+request = indexedDB.open(dbname)
+connection = request.result
+request = connection.setVersion(version)
+PASS connection.version is version
+connection.createObjectStore('store')
+PASS connection.objectStoreNames.length is 1
+
+Issue a delete request against the database - should be blocked by the open connection:
+deleteRequest = indexedDB.deleteDatabase(dbname)
+state = 0
+
+Open a second connection - should be delayed:
+openRequest = indexedDB.open(dbname)
+
+connection received versionchange event - ignoring.
+PASS ++state is 1
+
+deleteRequest received blocked event.
+PASS ++state is 2
+connection.close()
+deleteRequest should now be unblocked.
+
+deleteRequest received success event.
+PASS ++state is 3
+openRequest should now be unblocked.
+
+PASS openRequest received success event.
+PASS ++state is 4
+connection2 = openRequest.result
+connection2 should reference a different database:
+PASS connection2.version == connection.version is false
+PASS connection2.objectStoreNames.length is 0
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/storage/indexeddb/database-deletepending-flag.html (0 => 122475)
--- trunk/LayoutTests/storage/indexeddb/database-deletepending-flag.html (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/database-deletepending-flag.html 2012-07-12 17:10:43 UTC (rev 122475)
@@ -0,0 +1,10 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/storage/indexeddb/resources/database-deletepending-flag.js (0 => 122475)
--- trunk/LayoutTests/storage/indexeddb/resources/database-deletepending-flag.js (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/resources/database-deletepending-flag.js 2012-07-12 17:10:43 UTC (rev 122475)
@@ -0,0 +1,90 @@
+if (this.importScripts) {
+ importScripts('../../../fast/js/resources/js-test-pre.js');
+ importScripts('shared.js');
+}
+
+description("Test IndexedDB IDBDatabase internal delete pending flag");
+
+function test()
+{
+ removeVendorPrefixes();
+
+ evalAndLog("dbname = self.location.pathname");
+ request = evalAndLog("indexedDB.deleteDatabase(dbname)");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onsuccess_ = openConnection;
+}
+
+function openConnection()
+{
+ debug("");
+ debug("Open a connection and set a sentinel version:");
+ evalAndLog("version = '10'");
+ evalAndLog("request = indexedDB.open(dbname)");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onsuccess_ = function() {
+ evalAndLog("connection = request.result");
+ evalAndLog("request = connection.setVersion(version)");
+ request._onerror_ = unexpectedErrorCallback;
+ request._onblocked_ = unexpectedBlockedCallback;
+ request._onsuccess_ = function() {
+ trans = request.result;
+ trans._onabort_ = unexpectedAbortCallback;
+ shouldBe("connection.version", "version");
+ evalAndLog("connection.createObjectStore('store')");
+ shouldBe("connection.objectStoreNames.length", "1");
+ trans._oncomplete_ = testDatabaseDelete;
+ };
+ };
+}
+
+function testDatabaseDelete()
+{
+ debug("");
+ debug("Issue a delete request against the database - should be blocked by the open connection:");
+ evalAndLog("deleteRequest = indexedDB.deleteDatabase(dbname)");
+ deleteRequest._onerror_ = unexpectedErrorCallback;
+ evalAndLog("state = 0");
+
+ debug("");
+ debug("Open a second connection - should be delayed:");
+ evalAndLog("openRequest = indexedDB.open(dbname)");
+ openRequest._onerror_ = unexpectedErrorCallback;
+
+ connection._onversionchange_ = function() {
+ debug("");
+ debug("connection received versionchange event - ignoring.");
+ shouldBe("++state", "1");
+ };
+
+ deleteRequest._onblocked_ = function() {
+ debug("");
+ debug("deleteRequest received blocked event.");
+ shouldBe("++state", "2");
+ evalAndLog("connection.close()");
+ debug("deleteRequest should now be unblocked.");
+ };
+
+ deleteRequest._onsuccess_ = function() {
+ debug("");
+ debug("deleteRequest received success event.");
+ shouldBe("++state", "3");
+ debug("openRequest should now be unblocked.");
+ };
+
+ openRequest._onsuccess_ = function() {
+ debug("");
+ testPassed("openRequest received success event.");
+ shouldBe("++state", "4");
+ evalAndLog("connection2 = openRequest.result");
+
+ debug("connection2 should reference a different database:");
+ shouldBeFalse("connection2.version == connection.version");
+ shouldBe("connection2.objectStoreNames.length", "0");
+
+ debug("");
+ finishJSTest();
+ };
+}
+
+test();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes