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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/sources/debugger-breakpoints/set-conditional-breakpoint.html

Issue 2776523004: [DevTools] fixed some breakpoints-related tests (Closed)
Patch Set: more tests Created 3 years, 9 months 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 unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script> 4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 5
6 <script> 6 <script>
7 function oneLineTestFunction() { return 0; } 7 function oneLineTestFunction() { return 0; }
8 </script> 8 </script>
9 9
10 <script> 10 <script>
(...skipping 14 matching lines...) Expand all
25 InspectorTest.setQuiet(true); 25 InspectorTest.setQuiet(true);
26 InspectorTest.runDebuggerTestSuite([ 26 InspectorTest.runDebuggerTestSuite([
27 function testSetConditionalBreakpointThatBreaks(next) 27 function testSetConditionalBreakpointThatBreaks(next)
28 { 28 {
29 InspectorTest.showScriptSource("set-conditional-breakpoint.html", di dShowScriptSource); 29 InspectorTest.showScriptSource("set-conditional-breakpoint.html", di dShowScriptSource);
30 30
31 function didShowScriptSource(sourceFrame) 31 function didShowScriptSource(sourceFrame)
32 { 32 {
33 currentSourceFrame = sourceFrame; 33 currentSourceFrame = sourceFrame;
34 InspectorTest.addResult("Script source was shown."); 34 InspectorTest.addResult("Script source was shown.");
35 setBreakpointAndWaitUntilPaused(currentSourceFrame, 16, "true", didPause); 35 InspectorTest.waitUntilPaused(didPause);
36 InspectorTest.runTestFunction(); 36 InspectorTest.createNewBreakpoint(currentSourceFrame, 16, "true" , true)
37 .then(() => InspectorTest.waitBreakpointSidebarPane())
38 .then(() => InspectorTest.runTestFunction());
37 } 39 }
38 40
39 function didPause(callFrames) 41 function didPause(callFrames)
40 { 42 {
41 InspectorTest.addResult("Script execution paused."); 43 InspectorTest.addResult("Script execution paused.");
42 InspectorTest.captureStackTrace(callFrames); 44 InspectorTest.captureStackTrace(callFrames);
43 InspectorTest.dumpBreakpointSidebarPane(); 45 InspectorTest.dumpBreakpointSidebarPane();
44 InspectorTest.waitBreakpointSidebarPane().then(breakpointRemoved ); 46 InspectorTest.waitBreakpointSidebarPane().then(breakpointRemoved );
45 InspectorTest.removeBreakpoint(currentSourceFrame, 16); 47 InspectorTest.removeBreakpoint(currentSourceFrame, 16);
46 } 48 }
(...skipping 12 matching lines...) Expand all
59 }, 61 },
60 62
61 function testSetConditionalBreakpointThatDoesNotBreak(next) 63 function testSetConditionalBreakpointThatDoesNotBreak(next)
62 { 64 {
63 InspectorTest.showScriptSource("set-conditional-breakpoint.html", di dShowScriptSource); 65 InspectorTest.showScriptSource("set-conditional-breakpoint.html", di dShowScriptSource);
64 66
65 function didShowScriptSource(sourceFrame) 67 function didShowScriptSource(sourceFrame)
66 { 68 {
67 currentSourceFrame = sourceFrame; 69 currentSourceFrame = sourceFrame;
68 InspectorTest.addResult("Script source was shown."); 70 InspectorTest.addResult("Script source was shown.");
69 setBreakpoint(currentSourceFrame, 16, "false"); 71 InspectorTest.createNewBreakpoint(currentSourceFrame, 16, "false ", true)
70 InspectorTest.runTestFunction(); 72 .then(() => InspectorTest.waitBreakpointSidebarPane())
71 InspectorTest.waitBreakpointSidebarPane().then(testFunctionFinis hed); 73 .then(() => InspectorTest.runTestFunction())
72 74 .then(testFunctionFinished);
73 } 75 }
74 76
75 function testFunctionFinished(callFrames) 77 function testFunctionFinished(callFrames)
76 { 78 {
77 InspectorTest.addResult("Test function finished."); 79 InspectorTest.addResult("Test function finished.");
78 InspectorTest.dumpBreakpointSidebarPane(); 80 InspectorTest.dumpBreakpointSidebarPane();
79 InspectorTest.waitBreakpointSidebarPane().then(breakpointRemoved ); 81 InspectorTest.waitBreakpointSidebarPane().then(breakpointRemoved );
80 InspectorTest.removeBreakpoint(currentSourceFrame, 16); 82 InspectorTest.removeBreakpoint(currentSourceFrame, 16);
81 } 83 }
82 84
83 function breakpointRemoved() 85 function breakpointRemoved()
84 { 86 {
85 InspectorTest.addResult("Breakpoints removed."); 87 InspectorTest.addResult("Breakpoints removed.");
86 InspectorTest.dumpBreakpointSidebarPane(); 88 InspectorTest.dumpBreakpointSidebarPane();
87 next(); 89 next();
88 } 90 }
89 }, 91 },
90 ]); 92 ]);
91
92 function setBreakpoint(sourceFrame, lineNumber, condition, callback)
93 {
94 var expectedBreakpointId;
95 InspectorTest.addSniffer(Bindings.BreakpointManager.ModelBreakpoint.prot otype, "_didSetBreakpointInDebugger", didSetBreakpointInDebugger);
96 InspectorTest.setBreakpoint(sourceFrame, lineNumber, condition, true);
97
98 function didSetBreakpointInDebugger(breakpointManagerCallback, breakpoin tId)
99 {
100 if (callback)
101 callback(breakpointId);
102 }
103 }
104
105 function setBreakpointAndWaitUntilPaused(sourceFrame, lineNumber, condition, pausedCallback)
106 {
107 setBreakpoint(sourceFrame, lineNumber, condition, didSetBreakpointInDebu gger);
108 var expectedBreakpointId;
109
110 function didSetBreakpointInDebugger(breakpointId)
111 {
112 expectedBreakpointId = breakpointId;
113 InspectorTest.waitUntilPaused(didPause);
114 }
115
116 function didPause(callFrames, reason, breakpointIds)
117 {
118 InspectorTest.assertEquals(breakpointIds.length, 1);
119 InspectorTest.assertEquals(breakpointIds[0], expectedBreakpointId);
120 InspectorTest.assertEquals(reason, "other");
121
122 pausedCallback(callFrames);
123 }
124 }
125 } 93 }
126 94
127 </script> 95 </script>
128 </head> 96 </head>
129 97
130 <body onload="runTest()"> 98 <body onload="runTest()">
131 <p> 99 <p>
132 Tests setting breakpoints. 100 Tests setting breakpoints.
133 </p> 101 </p>
134 102
135 </body> 103 </body>
136 </html> 104 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698