Title: [154907] trunk/LayoutTests
Revision
154907
Author
[email protected]
Date
2013-08-30 13:01:38 -0700 (Fri, 30 Aug 2013)

Log Message

Web Inspector: inspector/storage-panel-dom-storage-update.html is flakey on the bots
https://bugs.webkit.org/show_bug.cgi?id=120544

Patch by Joseph Pecoraro <[email protected]> on 2013-08-30
Reviewed by Dean Jackson.

Explicitly listen for events instead of running callbacks after a delay.

* inspector/storage-panel-dom-storage-update.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154906 => 154907)


--- trunk/LayoutTests/ChangeLog	2013-08-30 19:29:03 UTC (rev 154906)
+++ trunk/LayoutTests/ChangeLog	2013-08-30 20:01:38 UTC (rev 154907)
@@ -1,3 +1,14 @@
+2013-08-30  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: inspector/storage-panel-dom-storage-update.html is flakey on the bots
+        https://bugs.webkit.org/show_bug.cgi?id=120544
+
+        Reviewed by Dean Jackson.
+
+        Explicitly listen for events instead of running callbacks after a delay.
+
+        * inspector/storage-panel-dom-storage-update.html:
+
 2013-08-30  Dirk Schulze  <[email protected]>
 
         Animate CSS Image filter() function

Modified: trunk/LayoutTests/inspector/storage-panel-dom-storage-update.html (154906 => 154907)


--- trunk/LayoutTests/inspector/storage-panel-dom-storage-update.html	2013-08-30 19:29:03 UTC (rev 154906)
+++ trunk/LayoutTests/inspector/storage-panel-dom-storage-update.html	2013-08-30 20:01:38 UTC (rev 154907)
@@ -2,7 +2,6 @@
 <head>
 <script src=""
 <script>
-
 function addItem(key,value)
 {
     localStorage.setItem(key,value);
@@ -40,15 +39,46 @@
         InspectorTest.addResult("KeyValue pairs: [" + rows.join() + "]");
     }
 
+    var nextDOMStorageClearHandler = null;
+    InspectorTest.addSniffer(WebInspector.DOMStorageDispatcher.prototype, "domStorageItemsCleared", function() {
+        if (nextDOMStorageClearHandler) {
+            nextDOMStorageClearHandler();
+            nextDOMStorageClearHandler = null;
+        } else
+            InspectorTest.addResult("ERROR: domStorageItemsCleared event without handler");
+    }, true);
+
+    var nextDOMStorageAddHandler = null;
+    InspectorTest.addSniffer(WebInspector.DOMStorageDispatcher.prototype, "domStorageItemAdded", function() {
+        if (nextDOMStorageAddHandler) {
+            nextDOMStorageAddHandler();
+            nextDOMStorageAddHandler = null;
+        } else
+            InspectorTest.addResult("ERROR: domStorageItemAdded event without handler");
+    }, true);
+
+    var nextDOMStorageRemoveHandler = null;
+    InspectorTest.addSniffer(WebInspector.DOMStorageDispatcher.prototype, "domStorageItemRemoved", function() {
+        if (nextDOMStorageRemoveHandler) {
+            nextDOMStorageRemoveHandler();
+            nextDOMStorageRemoveHandler = null;
+        } else
+            InspectorTest.addResult("ERROR: domStorageItemRemoved event without handler");
+    }, true);
+
+
     InspectorTest.runTestSuite([
         function initialize(next)
         {
-            function initialized(result)
+            function didClear(result)
             {
                 InspectorTest.addResult("Initialized localStorage by clearing entries");
                 next();
             }
-            InspectorTest.evaluateInPage("clear()", initialized );
+
+            nextDOMStorageClearHandler = didClear;
+
+            InspectorTest.evaluateInPage("clear()");
         },
 
         function updateLocalStorageView(next)
@@ -59,6 +89,7 @@
                 InspectorTest.addResult("Resource Panel with localStorage view updated");
                 next();
             }
+
             var storages = WebInspector.domStorageModel.storages();
             for (var i = 0; i < storages.length; ++i) {
                 storage = storages[i];
@@ -74,8 +105,7 @@
         {
             function viewUpdatedAfterAddition()
             {
-                InspectorTest.runAfterPendingDispatches(function()
-                {
+                InspectorTest.runAfterPendingDispatches(function() {
                     rootNode = WebInspector.panels.resources._domStorageViews.get(storage)._dataGrid.rootNode();
                     dumpDataGrid();
                     if (count < 6)
@@ -85,13 +115,10 @@
                 });
             }
 
-            function itemAdded(result)
-            {
-                viewUpdatedAfterAddition();
-            }
+            nextDOMStorageAddHandler = viewUpdatedAfterAddition;
 
             InspectorTest.addResult("addItem('a"+count+"','=value"+count+"')");
-            InspectorTest.evaluateInPage("addItem('a"+count+"','=value"+count+"')", itemAdded );
+            InspectorTest.evaluateInPage("addItem('a"+count+"','=value"+count+"')");
             count++;
         },
 
@@ -109,14 +136,11 @@
                 });
             }
 
-            function itemRemoved(result)
-            {
-                setTimeout(viewUpdatedAfterRemoval, 0 );
-            }
+            nextDOMStorageRemoveHandler = viewUpdatedAfterRemoval;
 
             --count;
             InspectorTest.addResult("removeItem('a"+count+"')");
-            InspectorTest.evaluateInPage("removeItem('a"+count+"')", itemRemoved );
+            InspectorTest.evaluateInPage("removeItem('a"+count+"')");
         },
 
         function clearTest(next)
@@ -130,21 +154,16 @@
                 });
             }
 
-            function cleared(result)
-            {
-                setTimeout(viewUpdatedAfterClear, 0 );
-            }
+            nextDOMStorageClearHandler = viewUpdatedAfterClear;
 
             InspectorTest.addResult("clear()");
-            InspectorTest.evaluateInPage("clear()", cleared );
+            InspectorTest.evaluateInPage("clear()");
         }
     ]);
 }
 </script>
 </head>
-
 <body _onload_="runTest()">
 <p>Test that storage panel is present and that it contains correct data whenever localStorage is updated.</p>
 </body>
 </html>
-
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to