Changeset 85849 in webkit


Ignore:
Timestamp:
May 5, 2011 5:14:17 AM (13 years ago)
Author:
caseq@chromium.org
Message:

2011-05-04 Andrey Kosyakov <caseq@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: add test for shadow DOM access in the console API
https://bugs.webkit.org/show_bug.cgi?id=60192

  • http/tests/inspector/elements-test.js: (initialize_ElementTest.InspectorTest.findNode.processChildren): (initialize_ElementTest.InspectorTest.nodeWithId): (initialize_ElementTest.InspectorTest.selectNode):
  • inspector/console/console-shadow-dom-access-expected.txt: Added.
  • inspector/console/console-shadow-dom-access.html: Added.
Location:
trunk/LayoutTests
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r85848 r85849  
     12011-05-04  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: add test for shadow DOM access in the console API
     6        https://bugs.webkit.org/show_bug.cgi?id=60192
     7
     8        * http/tests/inspector/elements-test.js:
     9        (initialize_ElementTest.InspectorTest.findNode.processChildren):
     10        (initialize_ElementTest.InspectorTest.nodeWithId):
     11        (initialize_ElementTest.InspectorTest.selectNode):
     12        * inspector/console/console-shadow-dom-access-expected.txt: Added.
     13        * inspector/console/console-shadow-dom-access.html: Added.
     14
    1152011-05-05  Philippe Normand  <pnormand@igalia.com>
    216
  • trunk/LayoutTests/http/tests/inspector/elements-test.js

    r85751 r85849  
    11var initialize_ElementTest = function() {
    22
    3 
    4 InspectorTest.nodeWithId = function(idValue, callback)
     3InspectorTest.findNode = function(matchFunction, callback)
    54{
    65    callback = InspectorTest.safeWrap(callback);
     
    1615        for (var i = 0; children && i < children.length; ++i) {
    1716            var childNode = children[i];
    18             if (childNode.getAttribute("id") === idValue) {
     17            if (matchFunction(childNode)) {
    1918                result = childNode;
     19                callback(result);
     20                return;
     21            }
     22            if (childNode.shadowRoot && matchFunction(childNode.shadowRoot)) {
     23                result = childNode.shadowRoot;
    2024                callback(result);
    2125                return;
     
    4347};
    4448
     49InspectorTest.nodeWithId = function(idValue, callback)
     50{
     51    function nodeIdMatches(node)
     52    {
     53        return node.getAttribute("id") === idValue;
     54    }
     55    InspectorTest.findNode(nodeIdMatches, callback);
     56}
     57
    4558InspectorTest.expandedNodeWithId = function(idValue)
    4659{
     
    5669InspectorTest.selectNodeWithId = function(idValue, callback)
    5770{
     71    function onNodeFound(node)
     72    {
     73        InspectorTest.selectNode(node, callback);
     74    }
     75    InspectorTest.nodeWithId(idValue, onNodeFound);
     76};
     77
     78InspectorTest.selectNode = function(node, callback)
     79{
    5880    callback = InspectorTest.safeWrap(callback);
    59     function mycallback(node)
    60     {
    61         if (node)
    62             WebInspector.updateFocusedNode(node.id);
    63         InspectorTest.runAfterPendingDispatches(callback.bind(null, node));
    64     }
    65     InspectorTest.nodeWithId(idValue, mycallback);
    66 };
     81    if (node)
     82        WebInspector.updateFocusedNode(node.id);
     83    InspectorTest.runAfterPendingDispatches(callback.bind(null, node));
     84}
    6785
    6886InspectorTest.dumpSelectedElementStyles = function(excludeComputed, excludeMatched, omitLonghands)
     
    193211    }
    194212
    195     function mycallback()
     213    function onAllNodesAvailable()
    196214    {
    197215        WebInspector.panels.elements.updateModifiedNodes();
     
    199217        callback();
    200218    }
    201     InspectorTest.nodeWithId(/nonstring/, mycallback);
     219    InspectorTest.findNode(function() { return false; }, onAllNodesAvailable);
    202220};
    203221
Note: See TracChangeset for help on using the changeset viewer.