Title: [147254] trunk/LayoutTests
Revision
147254
Author
[email protected]
Date
2013-03-29 15:10:06 -0700 (Fri, 29 Mar 2013)

Log Message

[Chromium] IndexedDB: Update terminated worker connection test
https://bugs.webkit.org/show_bug.cgi?id=113608

Reviewed by Tony Chang.

Update layout test only run under Chromium's content_shell that ensures that
worker termination does not result in stuck connections. The test was using
the obsolete setVersion() API.

* storage/indexeddb/pending-version-change-stuck-works-with-terminate-expected.txt:
* storage/indexeddb/pending-version-change-stuck-works-with-terminate.html:
* storage/indexeddb/resources/pending-version-change-stuck.js:
(test.request.onblocked):
(test):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (147253 => 147254)


--- trunk/LayoutTests/ChangeLog	2013-03-29 21:56:45 UTC (rev 147253)
+++ trunk/LayoutTests/ChangeLog	2013-03-29 22:10:06 UTC (rev 147254)
@@ -1,3 +1,20 @@
+2013-03-29  Joshua Bell  <[email protected]>
+
+        [Chromium] IndexedDB: Update terminated worker connection test
+        https://bugs.webkit.org/show_bug.cgi?id=113608
+
+        Reviewed by Tony Chang.
+
+        Update layout test only run under Chromium's content_shell that ensures that
+        worker termination does not result in stuck connections. The test was using
+        the obsolete setVersion() API.
+
+        * storage/indexeddb/pending-version-change-stuck-works-with-terminate-expected.txt:
+        * storage/indexeddb/pending-version-change-stuck-works-with-terminate.html:
+        * storage/indexeddb/resources/pending-version-change-stuck.js:
+        (test.request.onblocked):
+        (test):
+
 2013-03-29  Bem Jones-Bey  <[email protected]>
 
         [CSS Exclusions] shape outside segments not properly calculated for ellipses

Modified: trunk/LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate-expected.txt (147253 => 147254)


--- trunk/LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate-expected.txt	2013-03-29 21:56:45 UTC (rev 147253)
+++ trunk/LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate-expected.txt	2013-03-29 22:10:06 UTC (rev 147254)
@@ -1,11 +1,12 @@
-Explicitly terminating worker with blocked setVersion call should allow later open calls to proceed
+Explicitly terminating worker with blocked call should allow later open calls to proceed
 
 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;
 
-request = indexedDB.open("pending-version-change-stuck-works-with-terminate.html")
+dbname = "pending-version-change-stuck-works-with-terminate.html"
+indexedDB.open(dbname)
 PASS Open worked after page reload.
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate.html (147253 => 147254)


--- trunk/LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate.html	2013-03-29 21:56:45 UTC (rev 147253)
+++ trunk/LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate.html	2013-03-29 22:10:06 UTC (rev 147254)
@@ -6,28 +6,45 @@
 <body>
 <script>
 
-description("Explicitly terminating worker with blocked setVersion call should allow later open calls to proceed");
+description("Explicitly terminating worker with blocked call should allow later open calls to proceed");
 
 function test()
 {
     removeVendorPrefixes();
-    dbname = self.location.pathname.substring(1 + self.location.pathname.lastIndexOf("/"));
-    evalAndLog("request = indexedDB.open(\"" + dbname + "\")");
+    setDBNameFromPath();
+    if (self.location.search !== "?second") {
+        firstOpen();
+    } else {
+        secondOpen();
+    }
+}
+
+function firstOpen() {
+    request = evalAndLog("indexedDB.deleteDatabase(dbname)");
     request._onblocked_ = unexpectedBlockedCallback;
     request._onerror_ = unexpectedErrorCallback;
-    if (self.location.search == "?second") {
-        request._onsuccess_ = function() {
-            testPassed("Open worked after page reload.");
-            finishJSTest();
-        };
-    } else {
+    request._onsuccess_ = function() {
+        request = evalAndLog("indexedDB.open(dbname)");
+        request._onblocked_ = unexpectedBlockedCallback;
+        request._onerror_ = unexpectedErrorCallback;
         request._onsuccess_ = startTheWorker;
-    }
+    };
 }
 
+function secondOpen() {
+    request = evalAndLog("indexedDB.open(dbname)");
+    request._onblocked_ = unexpectedBlockedCallback;
+    request._onerror_ = unexpectedErrorCallback;
+    request._onupgradeneeded_ = unexpectedUpgradeNeededCallback;
+    request._onsuccess_ = function() {
+        testPassed("Open worked after page reload.");
+        finishJSTest();
+    };
+}
+
 function startTheWorker()
 {
-    var worker = startWorker("resources/pending-version-change-stuck.js?" + encodeURI(dbname));
+    var worker = startWorker("resources/pending-version-change-stuck.js?" + encodeURIComponent(dbname));
     worker._onerror_ = function(e) {
         testFailed(e.message);
         finishJSTest();
@@ -37,9 +54,10 @@
         if (event.data == "gotblocked") {
             worker.terminate();
             self.location = self.location + "?second";
+            return;
         }
-        else
-            originalOnMessage(event);
+
+        originalOnMessage(event);
     };
 }
 

Modified: trunk/LayoutTests/storage/indexeddb/resources/pending-version-change-stuck.js (147253 => 147254)


--- trunk/LayoutTests/storage/indexeddb/resources/pending-version-change-stuck.js	2013-03-29 21:56:45 UTC (rev 147253)
+++ trunk/LayoutTests/storage/indexeddb/resources/pending-version-change-stuck.js	2013-03-29 22:10:06 UTC (rev 147254)
@@ -6,17 +6,14 @@
 function test()
 {
     removeVendorPrefixes();
-    dbname = decodeURI(self.location.search.substring(1));
-    evalAndLog("request = indexedDB.open(\"" + dbname + "\")");
+    dbname = decodeURIComponent(self.location.search.substring(1));
+    request = evalAndLog("indexedDB.open(dbname, 2)");
     request._onerror_ = unexpectedErrorCallback;
-    request._onsuccess_ = function(e) {
-        db = request.result;
-        evalAndLog("request = db.setVersion(1)");
-        request._onsuccess_ = unexpectedSuccessCallback;
-        request._onblocked_ = function() {
-            testPassed("worker received blocked event.");
-            postMessage("gotblocked");
-        };
+    request._onsuccess_ = unexpectedSuccessCallback;
+    request._onupgradeneeded_ = unexpectedUpgradeNeededCallback;
+    request._onblocked_ = function() {
+        testPassed("worker received blocked event.");
+        postMessage("gotblocked");
     };
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to