Web Inspector: [Extensions API] simplify panel size check in extensions-panel.html
authorcaseq@chromium.org <caseq@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jul 2012 12:23:46 +0000 (12:23 +0000)
committercaseq@chromium.org <caseq@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jul 2012 12:23:46 +0000 (12:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90799

Reviewed by Vsevolod Vlasov.

- use window argument in Panel.onShown() to check panel window size;

* http/tests/inspector/resources/extension-panel.html:
* inspector/extensions/extensions-panel-expected.txt:
* inspector/extensions/extensions-panel.html:
* platform/mac/Skipped:
* platform/qt/Skipped:
* platform/wincairo/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@122216 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/resources/extension-panel.html
LayoutTests/inspector/extensions/extensions-panel-expected.txt
LayoutTests/inspector/extensions/extensions-panel.html
LayoutTests/platform/mac/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/wincairo/Skipped

index a8101ca..b0912a5 100644 (file)
@@ -1,3 +1,19 @@
+2012-07-09  Andrey Kosyakov  <caseq@chromium.org>
+
+        Web Inspector: [Extensions API] simplify panel size check in extensions-panel.html
+        https://bugs.webkit.org/show_bug.cgi?id=90799
+
+        Reviewed by Vsevolod Vlasov.
+
+        - use window argument in Panel.onShown() to check panel window size;
+
+        * http/tests/inspector/resources/extension-panel.html:
+        * inspector/extensions/extensions-panel-expected.txt:
+        * inspector/extensions/extensions-panel.html:
+        * platform/mac/Skipped:
+        * platform/qt/Skipped:
+        * platform/wincairo/Skipped:
+
 2012-07-10  Ádám Kallai  <kadam@inf.u-szeged.hu>
 
         [Qt] Unreviewed gardening. Skip a flakey test after r122168.
index b277f4f..d194ea1 100644 (file)
@@ -1,15 +1,7 @@
 <html>
 <head>
 <script src="extension-main.js"></script>
-<script type="text/javascript">
-function onLoad()
-{
-    var width = window.innerWidth;
-    var height = window.innerHeight;
-    evaluateOnFrontend("if (InspectorTest.panelCallback) InspectorTest.panelCallback(" + width + "," + height +");");
-}
-</script>
 </head>
-<body onload="onLoad()">
+<body>
 </body>
 </html>
index 867dab8..f229294 100644 (file)
@@ -21,8 +21,8 @@ Panel created
     createStatusBarButton : <function>
     show : <function>
 }
-Extension panel size correct
 Panel shown
+Extension panel size correct
 RUNNING TEST: extension_testSearch
 Panel hidden
 Panel searched:
index 262dc5c..4d1f2d5 100644 (file)
@@ -10,28 +10,14 @@ function logMessage()
 
 function initialize_extensionsPanelTest()
 {
-    InspectorTest.panelCallback = function(width, height)
-    {
-        InspectorTest.checkPanelSize(width, height);
-        var callback = InspectorTest._pendingPanelSizeTestCallback;
-        if (callback) {
-            delete InspectorTest._pendingPanelSizeTestCallback;
-            callback();
-        }
-    }
-
-    InspectorTest.waitForPanel = function(callback)
-    {
-         InspectorTest._pendingPanelSizeTestCallback = callback;
-    }
-
-    InspectorTest.checkPanelSize = function(width, height)
+    InspectorTest.getPanelSize = function()
     {
         var extensionPanel = WebInspector.inspectorView._panelOrder[WebInspector.inspectorView._panelOrder.length - 1];
         var boundingRect = document.getElementById("main-panels").getBoundingClientRect();
-        InspectorTest.assertEquals(boundingRect.width, width, "panel width mismatch");
-        InspectorTest.assertEquals(boundingRect.height, height, "panel height mismatch");
-        InspectorTest.addResult("Extension panel size correct");
+        return {
+            width: boundingRect.width,
+            height: boundingRect.height
+        };
     }
 
     InspectorTest.dumpStatusBarButtons = function()
@@ -70,6 +56,28 @@ function initialize_extensionsPanelTest()
 
 function extension_testCreatePanel(nextTest)
 {
+    var expectOnShown = false;
+
+    function onPanelShown(panel, window)
+    {
+        if (!expectOnShown) {
+            output("FAIL: unexpected onShown event");
+            nextTest();
+            return;
+        }
+        output("Panel shown");
+        panel.onShown.removeListener(onPanelShown);
+        evaluateOnFrontend("reply(InspectorTest.getPanelSize())", function(result) {
+            if (result.width !== window.innerWidth)
+                output("panel width mismatch, outer: " + result.width + ", inner:" + window.innerWidth);
+            else if (result.height !== window.innerHeight)
+                output("panel height mismatch, outer: " + result.height + ", inner:" + window.innerHeight);
+            else
+                output("Extension panel size correct");
+            nextTest();
+        });
+    }
+
     function onPanelCreated(panel)
     {
         output("Panel created");
@@ -77,9 +85,7 @@ function extension_testCreatePanel(nextTest)
         panel.onHidden.addListener(function() {
             output("Panel hidden");
         });
-        panel.onShown.addListener(function(window) {
-            output("Panel shown");
-        });
+        panel.onShown.addListener(onPanelShown.bind(this, panel));
 
         // This is not authorized and therefore should not produce any output
         panel.show();
@@ -87,17 +93,16 @@ function extension_testCreatePanel(nextTest)
 
         function handleOpenResource(resource, lineNumber)
         {
-            // This will force extension iframe to be really loaded and will cause waitForPanel() callback below.
+            // This will force extension iframe to be really loaded.
             panel.show();
         }
         webInspector.panels.setOpenResourceHandler(handleOpenResource);
         evaluateOnFrontend("WebInspector.openAnchorLocationRegistry._activeHandler = 'test extension'");
         webInspector.inspectedWindow.eval("logMessage()", function() {
+            expectOnShown = true;
             evaluateOnFrontend("InspectorTest.clickOnURL();");
         });
     }
-    // The panel code is expected to report its size via InspectorTest.panelCallback()
-    evaluateOnFrontend("InspectorTest.waitForPanel(reply);", nextTest);
     var basePath = location.pathname.replace(/\/[^/]*$/, "/");
     webInspector.panels.create("Test Panel", basePath + "extension-panel.png", basePath + "extension-panel.html", onPanelCreated);
 }
index 8c9a548..ce92ddc 100644 (file)
@@ -851,9 +851,6 @@ http/tests/security/referrer-policy-redirect-link.html
 inspector/extensions/extensions-eval-content-script.html
 inspector/extensions/extensions-audits-content-script.html
 
-# https://bugs.webkit.org/show_bug.cgi?id=89790
-inspector/extensions/extensions-panel.html
-
 # https://bugs.webkit.org/show_bug.cgi?id=86480
 plugins/npruntime/delete-plugin-within-setProperty.html
 plugins/npruntime/delete-plugin-within-hasProperty-return-true.html
index e526b51..2e8f21a 100644 (file)
@@ -973,10 +973,6 @@ http/tests/misc/link-rel-icon-beforeload.html
 # https://bugs.webkit.org/show_bug.cgi?id=64002
 fast/selectors/unqualified-hover-strict.html
 
-# [Qt] inspector/extensions/extensions-panel.html is flakey
-# https://bugs.webkit.org/show_bug.cgi?id=89333
-inspector/extensions/extensions-panel.html
-
 # [Qt] http/tests/misc/script-defer.html is flakey
 # https://bugs.webkit.org/show_bug.cgi?id=90845
 http/tests/misc/script-defer.html
index e8fa77d..d0f91af 100644 (file)
@@ -438,7 +438,6 @@ inspector/debugger/breakpoint-manager.html
 inspector/debugger/raw-source-code.html
 inspector/extensions/extensions-console.html
 inspector/extensions/extensions-events.html
-inspector/extensions/extensions-panel.html
 inspector/styles/styles-invalid-color-values.html
 inspector/timeline/timeline-animation-frame.html 
 inspector/timeline/timeline-load-event.html