Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: LayoutTests/inspector/debugger/skip-pauses-until-reload.html

Issue 60203007: DevTools: Fix disabling all pauses on reload. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/debugger/skip-pauses-until-reload.html
diff --git a/LayoutTests/inspector/debugger/skip-pauses-until-reload.html b/LayoutTests/inspector/debugger/skip-pauses-until-reload.html
new file mode 100644
index 0000000000000000000000000000000000000000..3638ceaa898f86945f6e6ef4aa3e4f4d30c54b5e
--- /dev/null
+++ b/LayoutTests/inspector/debugger/skip-pauses-until-reload.html
@@ -0,0 +1,139 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/elements-test.js"></script>
+<script src="../../http/tests/inspector/debugger-test.js"></script>
+<script>
+
+function testFunction()
+{
+ console.log("Begin");
+ debugger; // Reload follows, nothing below should break.
+ console.log("Middle: Breakpoint 1"); // Breakpoint
+ console.log("Middle: Breakpoint 2"); // Breakpoint
+ console.assert(false, "Assertion failed!");
+ console.error("Some console.error message");
+ debugger; // Should skip this also.
+ var element = document.getElementById("element");
+ var parent = element.parentElement;
+ var child = document.createElement("span");
+ element.setAttribute("foo", "bar"); // DOM breakpoint: AttributeModified
+ element.appendChild(child); // DOM breakpoint: SubtreeModified
+ parent.removeChild(element); // DOM breakpoint: NodeRemoved
+ parent.appendChild(element);
+ element.click(); // Event breakpoint
+ console.log("End");
+ // Should be last.
+ eval("throwException()");
+}
+
+function throwException()
+{
+ function inner()
+ {
+ try {
+ if (window.foo === 1)
+ throw new Error("error message");
+ } finally {
+ ++window.foo;
+ }
+ }
+ try {
+ window.foo = 1;
+ inner();
+ } finally {
+ ++window.foo;
+ }
+}
+
+function test()
+{
+ InspectorTest.startDebuggerTest(step1);
+
+ function step1()
+ {
+ InspectorTest.showScriptSource("skip-pauses-until-reload.html", didShowScriptSource);
+ }
+
+ function didShowScriptSource(sourceFrame)
+ {
+ InspectorTest.addResult("Script source was shown.");
+ InspectorTest.addResult("Set up breakpoints.");
+ InspectorTest.setBreakpoint(sourceFrame, 11, "", true);
+ InspectorTest.setBreakpoint(sourceFrame, 12, "", true);
+ InspectorTest.addResult("Set up to pause on all exceptions.");
+ // FIXME: Test is flaky with PauseOnAllExceptions due to races in debugger.
yurys 2013/11/08 06:38:26 Wouldn't it flake with PauseOnUncaughExceptions, w
aandrey 2013/11/08 09:10:39 Maybe. Let me put DontPauseOnExceptions for now.
yurys 2013/11/13 12:26:01 How come didCommitLoad and didClearWindowObjectInW
aandrey 2013/11/13 13:06:08 I did not know either. As I said it should be inve
+ DebuggerAgent.setPauseOnExceptions(WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions);
+ InspectorTest.nodeWithId("element", didResolveNode);
+ }
+
+ function didResolveNode(node)
+ {
+ WebInspector.showPanel("elements");
+ var pane = WebInspector.domBreakpointsSidebarPane;
+ InspectorTest.addResult("Set up DOM breakpoints.");
+ pane._setBreakpoint(node, pane._breakpointTypes.SubtreeModified, true);
+ pane._setBreakpoint(node, pane._breakpointTypes.AttributeModified, true);
+ pane._setBreakpoint(node, pane._breakpointTypes.NodeRemoved, true);
+ setUpEventBreakpoints();
+ }
+
+ function setUpEventBreakpoints()
+ {
+ WebInspector.showPanel("sources");
+ var pane = WebInspector.panels.sources.sidebarPanes.eventListenerBreakpoints;
+ InspectorTest.addResult("Set up Event breakpoints.");
+ pane._setBreakpoint("listener:click");
+ InspectorTest.runAfterPendingDispatches(didSetUp);
yurys 2013/11/08 06:38:26 Can we listen to the setBreakpoint callback instea
aandrey 2013/11/08 09:10:39 why? this works like a charm and more stable than
+ }
+
+ function didSetUp()
+ {
+ InspectorTest.addResult("Did set up.");
+ InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
+ }
+
+ function didPause(callFrames)
+ {
+ InspectorTest.captureStackTrace(callFrames);
+ DebuggerAgent.setSkipAllPauses(true, true, didSetSkipAllPauses);
+ }
+
+ function didSetSkipAllPauses()
+ {
+ InspectorTest.addResult("Set up to skip all pauses.");
+ doReloadPage();
+ }
+
+ function doReloadPage()
+ {
+ InspectorTest.addResult("Reloading the page...");
+ InspectorTest.waitUntilPaused(didPauseAfterReload, true);
yurys 2013/11/08 06:38:26 I wonder why we need this force argument passed to
aandrey 2013/11/08 09:10:39 - we are paused at this point, thus waitUntilPause
yurys 2013/11/13 12:26:01 I was wondering why not simply resume execution if
+ InspectorTest.reloadPage(didPageReloaded);
+ }
+ function didPageReloaded()
yurys 2013/11/08 06:38:26 didReloadPage
aandrey 2013/11/08 09:10:39 Done.
+ {
+ InspectorTest.addResult("PASS: Reloaded without hitting breakpoints.");
+ InspectorTest.completeDebuggerTest();
+ }
+
+ function didPauseAfterReload(callFrames)
+ {
+ InspectorTest.addResult("FAIL: Should not pause while reloading the page!");
+ InspectorTest.captureStackTrace(callFrames);
+ InspectorTest.waitUntilPaused(didPauseAfterReload, true);
+ InspectorTest.resumeExecution();
+ }
+};
+
+</script>
+
+</head>
+
+<body onload="runTest()">
+<p>Tests that 'skip all pauses' mode blocks breakpoint and gets cancelled right at page reload.
+</p>
+
+<div id="element" onclick="return 0;"></div>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698