Commit 37dda3c5 authored by podivilov@chromium.org's avatar podivilov@chromium.org
Browse files

2011-01-18 Pavel Podivilov <podivilov@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: fix flaky debugger tests.
        https://bugs.webkit.org/show_bug.cgi?id=51320

        * http/tests/inspector/debugger-test2.js:
        (initialize_DebuggerTest.InspectorTest.setBreakpoint):
        (initialize_DebuggerTest.InspectorTest.showScriptSource):
        (initialize_DebuggerTest.InspectorTest._showScriptSource):
        * inspector/debugger-pause-on-breakpoint-expected.txt:
        * inspector/debugger-pause-on-breakpoint.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76020 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8e0c8f10
2011-01-18 Pavel Podivilov <podivilov@chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: fix flaky debugger tests.
https://bugs.webkit.org/show_bug.cgi?id=51320
* http/tests/inspector/debugger-test2.js:
(initialize_DebuggerTest.InspectorTest.setBreakpoint):
(initialize_DebuggerTest.InspectorTest.showScriptSource):
(initialize_DebuggerTest.InspectorTest._showScriptSource):
* inspector/debugger-pause-on-breakpoint-expected.txt:
* inspector/debugger-pause-on-breakpoint.html:
2011-01-18 Antti Koivisto <antti@apple.com> 2011-01-18 Antti Koivisto <antti@apple.com>
   
Reviewed by Dave Hyatt. Reviewed by Dave Hyatt.
......
...@@ -93,13 +93,8 @@ InspectorTest.captureStackTrace = function(callFrames) ...@@ -93,13 +93,8 @@ InspectorTest.captureStackTrace = function(callFrames)
InspectorTest.setBreakpoint = function(url, lineNumber, enabled, condition, callback) InspectorTest.setBreakpoint = function(url, lineNumber, enabled, condition, callback)
{ {
var scripts = WebInspector.debuggerModel.scriptsForURL(url); var scripts = WebInspector.debuggerModel.scriptsForURL(url);
if (scripts.length) { for (var i = 0; i < scripts.length; ++i)
WebInspector.debuggerModel.setBreakpoint(scripts[0].sourceID, lineNumber, enabled, condition); WebInspector.debuggerModel.setBreakpoint(scripts[i].sourceID, lineNumber, enabled, condition);
callback();
} else {
var handler = InspectorTest.setBreakpoint.bind(InspectorTest, url, lineNumber, enabled, condition, callback);
InspectorTest._addSniffer(WebInspector.debuggerModel, "_parsedScriptSource", handler);
}
} }
InspectorTest._pausedScript = function(details) InspectorTest._pausedScript = function(details)
...@@ -126,10 +121,9 @@ InspectorTest._resumedScript = function() ...@@ -126,10 +121,9 @@ InspectorTest._resumedScript = function()
InspectorTest.showScriptSource = function(scriptName, callback) InspectorTest.showScriptSource = function(scriptName, callback)
{ {
if (InspectorTest._scriptsAreParsed([scriptName])) { if (InspectorTest._scriptsAreParsed([scriptName]))
var scriptOrResource = InspectorTest._showScriptSource(scriptName); InspectorTest._showScriptSource(scriptName, callback);
callback(scriptOrResource.sourceFrame); else
} else
InspectorTest._addSniffer(WebInspector.debuggerModel, "_parsedScriptSource", InspectorTest.showScriptSource.bind(InspectorTest, scriptName, callback)); InspectorTest._addSniffer(WebInspector.debuggerModel, "_parsedScriptSource", InspectorTest.showScriptSource.bind(InspectorTest, scriptName, callback));
}; };
...@@ -174,7 +168,12 @@ InspectorTest._showScriptSource = function(scriptName, callback) ...@@ -174,7 +168,12 @@ InspectorTest._showScriptSource = function(scriptName, callback)
scriptResource = options[pageScriptIndex].representedObject; scriptResource = options[pageScriptIndex].representedObject;
scriptsPanel._showScriptOrResource(scriptResource); scriptsPanel._showScriptOrResource(scriptResource);
} }
return scriptResource;
var sourceFrame = WebInspector.currentPanel.visibleView.sourceFrame;
if (sourceFrame._content)
callback(sourceFrame);
else
InspectorTest._addSniffer(sourceFrame._textModel, "setText", callback.bind(null, sourceFrame));
}; };
InspectorTest.expandProperties = function(properties, callback) InspectorTest.expandProperties = function(properties, callback)
......
...@@ -24,21 +24,17 @@ var test = function() ...@@ -24,21 +24,17 @@ var test = function()
function step2() function step2()
{ {
InspectorTest.addResult("Main resource was shown."); InspectorTest.addResult("Main resource was shown.");
InspectorTest.setBreakpoint(WebInspector.mainResource.url, 8, true, "", step3); InspectorTest.setBreakpoint(WebInspector.mainResource.url, 8, true, "");
}
function step3()
{
WebInspector.panels.scripts.toggleBreakpointsButton.element.click(); WebInspector.panels.scripts.toggleBreakpointsButton.element.click();
InspectorTest.reloadPage(step4); InspectorTest.reloadPage(step4);
} }
function step4() function step3()
{ {
InspectorTest.showScriptSource(testName, step5); InspectorTest.showScriptSource(testName, step4);
} }
function step5() function step4()
{ {
InspectorTest.addResult("Main resource was shown."); InspectorTest.addResult("Main resource was shown.");
if (!WebInspector.panels.scripts.breakpointsActivated) if (!WebInspector.panels.scripts.breakpointsActivated)
......
Tests that debugger will stop on breakpoint. Tests that debugger will stop on breakpoint.
Debugger was enabled. Debugger was enabled.
Script source was shown.
Set timer for test function. Set timer for test function.
Script execution paused. Script execution paused.
Call stack: Call stack:
......
...@@ -16,11 +16,13 @@ var test = function() ...@@ -16,11 +16,13 @@ var test = function()
function step1() function step1()
{ {
InspectorTest.setBreakpoint(WebInspector.mainResource.url, 9, true, "", step2); InspectorTest.showScriptSource("debugger-pause-on-breakpoint.html", step2);
} }
function step2() function step2()
{ {
InspectorTest.addResult("Script source was shown.");
InspectorTest.setBreakpoint(WebInspector.mainResource.url, 9, true, "");
InspectorTest.runTestFunctionAndWaitUntilPaused(step3); InspectorTest.runTestFunctionAndWaitUntilPaused(step3);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment