Changeset 65799 in webkit


Ignore:
Timestamp:
Aug 23, 2010 2:49:29 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-08-23 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: add DOM breakpoints test
https://bugs.webkit.org/show_bug.cgi?id=44251

  • http/tests/inspector/debugger-test2.js: Added. (initialize_DebuggerTest.InspectorTest.startDebuggerTest.startTest): (initialize_DebuggerTest.InspectorTest.startDebuggerTest): (initialize_DebuggerTest.InspectorTest.completeDebuggerTest.completeTest): (initialize_DebuggerTest.InspectorTest.completeDebuggerTest): (initialize_DebuggerTest.InspectorTest.waitUntilPaused): (initialize_DebuggerTest.InspectorTest.resumeExecution): (initialize_DebuggerTest.InspectorTest.showScriptSource): (initialize_DebuggerTest.InspectorTest._scriptsAreParsed): (initialize_DebuggerTest.InspectorTest._showScriptSource): (initialize_DebuggerTest):
  • http/tests/inspector/inspector-test2.js: (initialize_InspectorTest): (initialize_InspectorTest.): (runTest.runTestInFrontend): (runTest):
  • inspector/debugger-breakpoints-not-activated-on-reload.html:
  • inspector/dom-breakpoints-expected.txt: Added.
  • inspector/dom-breakpoints.html: Added.
  • platform/gtk/Skipped:
  • platform/mac/Skipped:
  • platform/qt/Skipped:
  • platform/win/Skipped:
Location:
trunk/LayoutTests
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65798 r65799  
     12010-08-23  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: add DOM breakpoints test
     6        https://bugs.webkit.org/show_bug.cgi?id=44251
     7
     8        * http/tests/inspector/debugger-test2.js: Added.
     9        (initialize_DebuggerTest.InspectorTest.startDebuggerTest.startTest):
     10        (initialize_DebuggerTest.InspectorTest.startDebuggerTest):
     11        (initialize_DebuggerTest.InspectorTest.completeDebuggerTest.completeTest):
     12        (initialize_DebuggerTest.InspectorTest.completeDebuggerTest):
     13        (initialize_DebuggerTest.InspectorTest.waitUntilPaused):
     14        (initialize_DebuggerTest.InspectorTest.resumeExecution):
     15        (initialize_DebuggerTest.InspectorTest.showScriptSource):
     16        (initialize_DebuggerTest.InspectorTest._scriptsAreParsed):
     17        (initialize_DebuggerTest.InspectorTest._showScriptSource):
     18        (initialize_DebuggerTest):
     19        * http/tests/inspector/inspector-test2.js:
     20        (initialize_InspectorTest):
     21        (initialize_InspectorTest.):
     22        (runTest.runTestInFrontend):
     23        (runTest):
     24        * inspector/debugger-breakpoints-not-activated-on-reload.html:
     25        * inspector/dom-breakpoints-expected.txt: Added.
     26        * inspector/dom-breakpoints.html: Added.
     27        * platform/gtk/Skipped:
     28        * platform/mac/Skipped:
     29        * platform/qt/Skipped:
     30        * platform/win/Skipped:
     31
    1322010-08-23  Philippe Normand  <pnormand@igalia.com>
    233
  • trunk/LayoutTests/http/tests/inspector/inspector-test2.js

    r65606 r65799  
    1 var initializeInspectorTest = (function(completeTestCallId) {
     1var initialize_InspectorTest = (function() {
    22
    33var results = [];
     
    55InspectorTest.completeTest = function()
    66{
    7     InspectorBackend.didEvaluateForTestInFrontend(completeTestCallId, JSON.stringify(results));
     7    InspectorBackend.didEvaluateForTestInFrontend(InspectorTest.completeTestCallId, JSON.stringify(results));
    88};
    99
     
    1212    WebInspector.console.visible = true;
    1313    WebInspector.console.prompt.text = code;
    14     WebInspector.console.promptElement.dispatchEvent(createKeyEvent("Enter"));
    15 
    16     addSniffer(WebInspector.ConsoleView.prototype, "addMessage",
     14    var event = document.createEvent("KeyboardEvent");
     15    event.initKeyboardEvent("keydown", true, true, null, "Enter", "");
     16    WebInspector.console.promptElement.dispatchEvent(event);
     17    InspectorTest._addSniffer(WebInspector.ConsoleView.prototype, "addMessage",
    1718        function(commandResult) {
    1819            if (callback)
     
    2930{
    3031    InspectorBackend.reloadPage();
    31     addSniffer(WebInspector, "reset", callback);
     32    InspectorTest._addSniffer(WebInspector, "reset", callback);
    3233};
    3334
    34 InspectorTest.ensureDebuggerEnabled = function(callback)
     35InspectorTest.findDOMNode = function(root, filter, callback)
    3536{
    36     if (WebInspector.panels.scripts._debuggerEnabled)
    37         callback();
    38     else {
    39         addSniffer(WebInspector, "debuggerWasEnabled", callback);
    40         WebInspector.panels.scripts._toggleDebugging(false);
     37    var found = false;
     38
     39    if (root)
     40        findDOMNode(root);
     41    else
     42        waitForDocument();
     43
     44    function waitForDocument()
     45    {
     46        root = WebInspector.domAgent.document;
     47        if (root)
     48            findDOMNode(root);
     49        else
     50            InspectorTest._addSniffer(WebInspector, setDocument, waitForDocument);
     51    }
     52
     53    function findDOMNode(node)
     54    {
     55        if (filter(node)) {
     56            callback(node);
     57            found = true;
     58        } else
     59            WebInspector.domAgent.getChildNodesAsync(node, processChildren);
     60
     61        function processChildren(children)
     62        {
     63            for (var i = 0; !found && children && i < children.length; ++i)
     64                findDOMNode(children[i]);
     65            if (!found && node === root)
     66                callback(null);
     67        }
    4168    }
    4269};
    4370
    44 InspectorTest.ensureDebuggerDisabled = function(callback)
    45 {
    46     if (!WebInspector.panels.scripts._debuggerEnabled)
    47         callback();
    48     else {
    49         addSniffer(WebInspector, "debuggerWasDisabled", callback);
    50         WebInspector.panels.scripts._toggleDebugging(false);
    51     }
    52 };
    53 
    54 InspectorTest.showScriptSource = function(scriptName, callback)
    55 {
    56     function waitForAllScripts()
    57     {
    58         if (scriptsAreParsed([scriptName]))
    59             showScriptSource(scriptName, callback);
    60         else
    61             addSniffer(WebInspector, "parsedScriptSource", waitForAllScripts);
    62     }
    63     waitForAllScripts();
    64 };
    65 
    66 function createKeyEvent(keyIdentifier)
    67 {
    68     var evt = document.createEvent("KeyboardEvent");
    69     evt.initKeyboardEvent("keydown", true, true, null, keyIdentifier, "");
    70     return evt;
    71 }
    72 
    73 function addSniffer(receiver, methodName, override, opt_sticky)
     71InspectorTest._addSniffer = function(receiver, methodName, override, opt_sticky)
    7472{
    7573    var original = receiver[methodName];
     
    9391}
    9492
    95 function scriptsAreParsed(scripts)
    96 {
    97     var scriptSelect = document.getElementById("scripts-files");
    98     var options = scriptSelect.options;
    99 
    100     // Check that all the expected scripts are present.
    101     for (var i = 0; i < scripts.length; i++) {
    102         var found = false;
    103         for (var j = 0; j < options.length; j++) {
    104             if (options[j].text === scripts[i]) {
    105                 found = true;
    106                 break;
    107             }
    108         }
    109         if (!found)
    110             return false;
    111     }
    112     return true;
    113 };
    114 
    115 function showScriptSource(scriptName, callback)
    116 {
    117     var scriptSelect = document.getElementById("scripts-files");
    118     var options = scriptSelect.options;
    119     var scriptsPanel = WebInspector.panels.scripts;
    120 
    121     // Select page's script if it's not current option.
    122     var scriptResource;
    123     if (options[scriptSelect.selectedIndex].text === scriptName)
    124         scriptResource = options[scriptSelect.selectedIndex].representedObject;
    125     else {
    126         var pageScriptIndex = -1;
    127         for (var i = 0; i < options.length; i++) {
    128             if (options[i].text === scriptName) {
    129                 pageScriptIndex = i;
    130                 break;
    131             }
    132         }
    133         scriptResource = options[pageScriptIndex].representedObject;
    134         scriptsPanel._showScriptOrResource(scriptResource);
    135     }
    136 
    137     var view = scriptsPanel.visibleView;
    138     callback = callback.bind(null, view);
    139     if (!view.sourceFrame._loaded)
    140         addSniffer(view.sourceFrame, "setContent", callback);
    141     else
    142         callback();
    143 };
    144 
    14593});
    14694
     
    156104    layoutTestController.waitUntilDone();
    157105
    158     var toEvaluate =
    159         "if (!window.InspectorTest) {" +
    160         "    var InspectorTest = {};" +
    161         "    (" + initializeInspectorTest + ")(" + completeTestCallId + ");" +
    162         "    WebInspector.showPanel('elements');" +
    163         "    (" + test + ")();" +
    164         "}";
     106    function runTestInFrontend(initializationFunctions, testFunction, completeTestCallId)
     107    {
     108        if (window.InspectorTest)
     109            return;
     110
     111        InspectorTest = {};
     112        InspectorTest.completeTestCallId = completeTestCallId;
     113
     114        for (var i = 0; i < initializationFunctions.length; ++i)
     115            initializationFunctions[i]();
     116
     117        WebInspector.showPanel("elements");
     118        testFunction();
     119    }
     120
     121    var initializationFunctions = [];
     122    for (var name in window) {
     123        if (name.indexOf("initialize_") === 0 && typeof window[name] === "function")
     124            initializationFunctions.push(window[name].toString());
     125    }
     126    var parameters = ["[" + initializationFunctions + "]", test, completeTestCallId];
     127    var toEvaluate = "(" + runTestInFrontend + ")(" + parameters.join(", ") + ");";
    165128    layoutTestController.evaluateInWebInspector(runTestCallId, toEvaluate);
    166129}
  • trunk/LayoutTests/inspector/debugger-breakpoints-not-activated-on-reload.html

    r65606 r65799  
    22<head>
    33<script src="../http/tests/inspector/inspector-test2.js"></script>
     4<script src="../http/tests/inspector/debugger-test2.js"></script>
    45<script>
    56
     
    1516
    1617    WebInspector.showPanel("scripts");
    17     InspectorTest.ensureDebuggerEnabled(ensureDebuggerEnabledCallback);
     18    InspectorTest.startDebuggerTest(startDebuggerTestCallback);
    1819
    19     function ensureDebuggerEnabledCallback()
     20    function startDebuggerTestCallback()
    2021    {
    21         InspectorTest.addResult("Debugger was enabled.");
    2222        InspectorTest.showScriptSource(testName, showScriptSourceCallback);
    2323    }
     
    4444        else
    4545            InspectorTest.addResult("Error: breakpoints are activated.");
    46         InspectorTest.ensureDebuggerDisabled(ensureDebuggerDisabledCallback);
    47     }
    48 
    49     function ensureDebuggerDisabledCallback()
    50     {
    51         InspectorTest.addResult("Debugger was disabled.");
    52         InspectorTest.completeTest();
     46        InspectorTest.completeDebuggerTest();
    5347    }
    5448};
  • trunk/LayoutTests/platform/gtk/Skipped

    r65798 r65799  
    59185918perf/
    59195919
     5920# https://bugs.webkit.org/show_bug.cgi?id=43332
     5921inspector/dom-breakpoints.html
     5922
    59205923# [GTK] r65681 broke a couple GTK+ a11y tests
    59215924# https://bugs.webkit.org/show_bug.cgi?id=44316
  • trunk/LayoutTests/platform/mac/Skipped

    r65628 r65799  
    290290# https://bugs.webkit.org/show_bug.cgi?id=42821
    291291animations/play-state.html
     292
     293# https://bugs.webkit.org/show_bug.cgi?id=43332
     294inspector/dom-breakpoints.html
  • trunk/LayoutTests/platform/qt/Skipped

    r65783 r65799  
    105105fast/text/hyphenate-character.html
    106106fast/text/hyphens.html
     107
     108# https://bugs.webkit.org/show_bug.cgi?id=43332
     109inspector/dom-breakpoints.html
    107110
    108111# =========================================================================== #
  • trunk/LayoutTests/platform/win/Skipped

    r65628 r65799  
    966966# https://bugs.webkit.org/show_bug.cgi?id=43458
    967967http/tests/appcache/origin-quota.html
     968
     969# https://bugs.webkit.org/show_bug.cgi?id=43332
     970inspector/dom-breakpoints.html
Note: See TracChangeset for help on using the changeset viewer.