2011-01-17 Pavel Podivilov <podivilov@chromium.org>
authorpodivilov@chromium.org <podivilov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Jan 2011 15:50:16 +0000 (15:50 +0000)
committerpodivilov@chromium.org <podivilov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Jan 2011 15:50:16 +0000 (15:50 +0000)
        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):
        * inspector/debugger-breakpoints-not-activated-on-reload.html:
        * inspector/debugger-pause-on-breakpoint-expected.txt:
        * inspector/debugger-pause-on-breakpoint.html:

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

LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/debugger-test2.js
LayoutTests/inspector/debugger-breakpoints-not-activated-on-reload.html
LayoutTests/inspector/debugger-pause-on-breakpoint-expected.txt
LayoutTests/inspector/debugger-pause-on-breakpoint.html

index a6df307..e856a5a 100644 (file)
@@ -1,3 +1,16 @@
+2011-01-17  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):
+        * inspector/debugger-breakpoints-not-activated-on-reload.html:
+        * inspector/debugger-pause-on-breakpoint-expected.txt:
+        * inspector/debugger-pause-on-breakpoint.html:
+
 2011-01-17  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         Unreviewed.
index 39a0d55..b89d1b7 100644 (file)
@@ -90,11 +90,16 @@ InspectorTest.captureStackTrace = function(callFrames)
     }
 };
 
-InspectorTest.setBreakpoint = function(url, lineNumber, enabled, condition)
+InspectorTest.setBreakpoint = function(url, lineNumber, enabled, condition, callback)
 {
     var scripts = WebInspector.debuggerModel.scriptsForURL(url);
-    for (var i = 0; i < scripts.length; ++i)
-        WebInspector.debuggerModel.setBreakpoint(scripts[i].sourceID, lineNumber, enabled, condition);
+    if (scripts.length) {
+        WebInspector.debuggerModel.setBreakpoint(scripts[0].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)
index 2fdc9ef..2f98363 100644 (file)
@@ -24,18 +24,22 @@ var test = function()
     function step2()
     {
         InspectorTest.addResult("Main resource was shown.");
-        InspectorTest.setBreakpoint(WebInspector.mainResource.url, 8, true, "");
-        WebInspector.panels.scripts.toggleBreakpointsButton.element.click();
-        InspectorTest.reloadPage(step3);
+        InspectorTest.setBreakpoint(WebInspector.mainResource.url, 8, true, "", step3);
     }
 
     function step3()
     {
-        InspectorTest.showScriptSource(testName, step4);
+        WebInspector.panels.scripts.toggleBreakpointsButton.element.click();
+        InspectorTest.reloadPage(step4);
     }
 
     function step4()
     {
+        InspectorTest.showScriptSource(testName, step5);
+    }
+
+    function step5()
+    {
         InspectorTest.addResult("Main resource was shown.");
         if (!WebInspector.panels.scripts.breakpointsActivated)
             InspectorTest.addResult("Breakpoints are deactivated.");
index 9b9703c..ba3141a 100644 (file)
@@ -1,7 +1,6 @@
 Tests that debugger will stop on breakpoint.
 
 Debugger was enabled.
-Script source was shown.
 Set timer for test function.
 Script execution paused.
 Call stack:
index 43260b2..0e0b9e0 100644 (file)
@@ -16,13 +16,11 @@ var test = function()
 
     function step1()
     {
-        InspectorTest.showScriptSource("debugger-pause-on-breakpoint.html", step2);
+        InspectorTest.setBreakpoint(WebInspector.mainResource.url, 9, true, "", step2);
     }
 
     function step2()
     {
-        InspectorTest.addResult("Script source was shown.");
-        InspectorTest.setBreakpoint(WebInspector.mainResource.url, 9, true, "");
         InspectorTest.runTestFunctionAndWaitUntilPaused(step3);
     }