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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/debugger-test.js

Issue 2526013002: [DevTools] Added inline breakpoints (Closed)
Patch Set: addressed comments Created 4 years 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 function scheduleTestFunction() 1 function scheduleTestFunction()
2 { 2 {
3 setTimeout(testFunction, 0); 3 setTimeout(testFunction, 0);
4 } 4 }
5 5
6 var initialize_DebuggerTest = function() { 6 var initialize_DebuggerTest = function() {
7 7
8 InspectorTest.preloadPanel("sources"); 8 InspectorTest.preloadPanel("sources");
9 9
10 InspectorTest.startDebuggerTest = function(callback, quiet) 10 InspectorTest.startDebuggerTest = function(callback, quiet)
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 { 628 {
629 return new Promise(succ => InspectorTest.debuggerModel.evaluateOnSelectedCal lFrame(code, "console", false, true, false, false, InspectorTest.safeWrap(succ)) ); 629 return new Promise(succ => InspectorTest.debuggerModel.evaluateOnSelectedCal lFrame(code, "console", false, true, false, false, InspectorTest.safeWrap(succ)) );
630 } 630 }
631 631
632 InspectorTest.waitJavaScriptSourceFrameBreakpoints = function(sourceFrame) 632 InspectorTest.waitJavaScriptSourceFrameBreakpoints = function(sourceFrame)
633 { 633 {
634 return new Promise(resolve => InspectorTest.addSniffer(sourceFrame.__proto__ , "_breakpointDecorationsUpdatedForTest", resolveIfAllBreakpointsResolved.bind(n ull, resolve))); 634 return new Promise(resolve => InspectorTest.addSniffer(sourceFrame.__proto__ , "_breakpointDecorationsUpdatedForTest", resolveIfAllBreakpointsResolved.bind(n ull, resolve)));
635 635
636 function resolveIfAllBreakpointsResolved(resolve) 636 function resolveIfAllBreakpointsResolved(resolve)
637 { 637 {
638 if (sourceFrame._waitForInlineDecorationsForTest) {
639 InspectorTest.addSniffer(sourceFrame.__proto__, "_breakpointDecorati onsUpdatedForTest", resolveIfAllBreakpointsResolved.bind(null, resolve));
640 return;
641 }
638 for (var breakpoint of Bindings.breakpointManager._allBreakpoints()) { 642 for (var breakpoint of Bindings.breakpointManager._allBreakpoints()) {
639 if (breakpoint._fakePrimaryLocation && breakpoint.enabled()) { 643 if (breakpoint._fakePrimaryLocation && breakpoint.enabled()) {
640 InspectorTest.addSniffer(sourceFrame.__proto__, "_breakpointDeco rationsUpdatedForTest", resolveIfAllBreakpointsResolved.bind(null, resolve)); 644 InspectorTest.addSniffer(sourceFrame.__proto__, "_breakpointDeco rationsUpdatedForTest", resolveIfAllBreakpointsResolved.bind(null, resolve));
641 return; 645 return;
642 } 646 }
643 } 647 }
644 resolve(); 648 resolve();
645 } 649 }
646 } 650 }
647 651
648 InspectorTest.dumpJavaScriptSourceFrameBreakpoints = function(sourceFrame) 652 InspectorTest.dumpJavaScriptSourceFrameBreakpoints = function(sourceFrame)
649 { 653 {
650 var textEditor = sourceFrame._textEditor; 654 var textEditor = sourceFrame._textEditor;
651 for (var lineNumber = 0; lineNumber < textEditor.linesCount; ++lineNumber) { 655 for (var lineNumber = 0; lineNumber < textEditor.linesCount; ++lineNumber) {
652 if (!textEditor.hasLineClass(lineNumber, "cm-breakpoint")) 656 if (!textEditor.hasLineClass(lineNumber, "cm-breakpoint"))
653 continue; 657 continue;
654 var disabled = textEditor.hasLineClass(lineNumber, "cm-breakpoint-disabl ed"); 658 var disabled = textEditor.hasLineClass(lineNumber, "cm-breakpoint-disabl ed");
655 var conditional = textEditor.hasLineClass(lineNumber, "cm-breakpoint-con ditional") 659 var conditional = textEditor.hasLineClass(lineNumber, "cm-breakpoint-con ditional")
656 InspectorTest.addResult("breakpoint at " + lineNumber + (disabled ? " di sabled" : "") + (conditional ? " conditional" : "")); 660 InspectorTest.addResult("breakpoint at " + lineNumber + (disabled ? " di sabled" : "") + (conditional ? " conditional" : ""));
657 } 661 }
662 var bookmarks = textEditor.bookmarks(textEditor.fullRange(), Sources.JavaScr iptSourceFrame.BreakpointDecoration._bookmarkSymbol);
663 bookmarks = bookmarks.filter(bookmark => !!bookmark.position());
664 bookmarks.sort((bookmark1, bookmark2) => bookmark1.position().startColumn - bookmark2.position().startColumn);
665 for (var bookmark of bookmarks) {
666 var position = bookmark.position();
667 var element = bookmark[Sources.JavaScriptSourceFrame.BreakpointDecoratio n._elementSymbolForTest];
668 var disabled = element.classList.contains("cm-inline-disabled");
669 var conditional = element.classList.contains("cm-inline-conditional");
670 InspectorTest.addResult(" inline breakpoint at (" + position.startLine + ", " + position.startColumn + ")" + (disabled ? " disabled" : "") + (condition al ? " conditional" : ""));
671 }
672 }
673
674 InspectorTest.clickJavaScriptSourceFrameBreakpoint = function(sourceFrame, lineN umber, index)
675 {
676 var textEditor = sourceFrame._textEditor;
677 var lineLength = textEditor.line(lineNumber).length;
678 var lineRange = new Common.TextRange(lineNumber, 0, lineNumber, lineLength);
679 var bookmarks = textEditor.bookmarks(lineRange, Sources.JavaScriptSourceFram e.BreakpointDecoration._bookmarkSymbol);
680 bookmarks.sort((bookmark1, bookmark2) => bookmark1.position().startColumn - bookmark2.position().startColumn);
681 bookmarks[index][Sources.JavaScriptSourceFrame.BreakpointDecoration._element SymbolForTest].click();
658 } 682 }
659 683
660 }; 684 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698