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

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

Issue 2526013002: [DevTools] Added inline breakpoints (Closed)
Patch Set: a 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/sources/debugger/source-frame-inline-breakpoint-decorations.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 var threadsPane = self.runtime.sharedInstance(Sources.ThreadsSidebarPane); 622 var threadsPane = self.runtime.sharedInstance(Sources.ThreadsSidebarPane);
623 var listItem = threadsPane._listItemForTarget(target); 623 var listItem = threadsPane._listItemForTarget(target);
624 threadsPane._onListItemClick(listItem); 624 threadsPane._onListItemClick(listItem);
625 } 625 }
626 626
627 InspectorTest.evaluateOnCurrentCallFrame = function(code) 627 InspectorTest.evaluateOnCurrentCallFrame = function(code)
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.prepareJavaScriptSourceFrame = function(sourceFrame)
lushnikov 2016/11/29 21:24:29 prepareSourceFrameForBreakpointTest =
kozy 2016/11/29 22:30:10 Done.
633 { 633 {
634 return new Promise(resolve => InspectorTest.addSniffer(sourceFrame.__proto__ , "_breakpointDecorationsUpdatedForTest", resolveIfAllBreakpointsResolved.bind(n ull, resolve))); 634 var symbol = Symbol('waitedDecorations');
635 sourceFrame[symbol] = 0;
636 InspectorTest.addSniffer(sourceFrame.__proto__, "_willAddInlineDecorationsFo rTest", () => sourceFrame[symbol]++, true);
637 InspectorTest.addSniffer(sourceFrame.__proto__, "_didAddInlineDecorationsFor Test", (updateWasScheduled) => {
638 sourceFrame[symbol]--;
639 if (!updateWasScheduled)
640 sourceFrame._breakpointDecorationsUpdatedForTest();
641 }, true);
642 sourceFrame._waitingForPossibleLocationsForTest = () => !!sourceFrame[symbol ];
643 }
635 644
636 function resolveIfAllBreakpointsResolved(resolve) 645 InspectorTest.waitJavaScriptSourceFrameBreakpoints = function(sourceFrame, inlin e)
646 {
647 return waitUpdate().then(checkIfReady);
lushnikov 2016/11/29 21:24:29 let's that sourceFrame is prepared! if (..) {
kozy 2016/11/29 22:30:10 Done.
648 function waitUpdate()
637 { 649 {
650 return new Promise(resolve => InspectorTest.addSniffer(sourceFrame.__pro to__, "_breakpointDecorationsUpdatedForTest", resolve));
651 }
652 function checkIfReady()
653 {
654 if (sourceFrame._waitingForPossibleLocationsForTest())
655 return waitUpdate().then(checkIfReady);
lushnikov 2016/11/29 21:24:29 this will potentially result in an infinite promis
kozy 2016/11/29 22:30:10 Yes, but all previous promises will be collected a
638 for (var breakpoint of Bindings.breakpointManager._allBreakpoints()) { 656 for (var breakpoint of Bindings.breakpointManager._allBreakpoints()) {
639 if (breakpoint._fakePrimaryLocation && breakpoint.enabled()) { 657 if (breakpoint._fakePrimaryLocation && breakpoint.enabled())
640 InspectorTest.addSniffer(sourceFrame.__proto__, "_breakpointDeco rationsUpdatedForTest", resolveIfAllBreakpointsResolved.bind(null, resolve)); 658 return waitUpdate().then(checkIfReady);
641 return;
642 }
643 } 659 }
644 resolve(); 660 return Promise.resolve();
645 } 661 }
646 } 662 }
647 663
648 InspectorTest.dumpJavaScriptSourceFrameBreakpoints = function(sourceFrame) 664 InspectorTest.dumpJavaScriptSourceFrameBreakpoints = function(sourceFrame)
649 { 665 {
650 var textEditor = sourceFrame._textEditor; 666 var textEditor = sourceFrame._textEditor;
651 for (var lineNumber = 0; lineNumber < textEditor.linesCount; ++lineNumber) { 667 for (var lineNumber = 0; lineNumber < textEditor.linesCount; ++lineNumber) {
652 if (!textEditor.hasLineClass(lineNumber, "cm-breakpoint")) 668 if (!textEditor.hasLineClass(lineNumber, "cm-breakpoint"))
653 continue; 669 continue;
654 var disabled = textEditor.hasLineClass(lineNumber, "cm-breakpoint-disabl ed"); 670 var disabled = textEditor.hasLineClass(lineNumber, "cm-breakpoint-disabl ed");
655 var conditional = textEditor.hasLineClass(lineNumber, "cm-breakpoint-con ditional") 671 var conditional = textEditor.hasLineClass(lineNumber, "cm-breakpoint-con ditional")
656 InspectorTest.addResult("breakpoint at " + lineNumber + (disabled ? " di sabled" : "") + (conditional ? " conditional" : "")); 672 InspectorTest.addResult("breakpoint at " + lineNumber + (disabled ? " di sabled" : "") + (conditional ? " conditional" : ""));
657 } 673 }
674 var bookmarks = textEditor.bookmarks(textEditor.fullRange(), Sources.JavaScr iptSourceFrame.BreakpointDecoration._bookmarkSymbol);
675 bookmarks = bookmarks.filter(bookmark => !!bookmark.position());
676 bookmarks.sort((bookmark1, bookmark2) => bookmark1.position().startColumn - bookmark2.position().startColumn);
677 for (var bookmark of bookmarks) {
678 var position = bookmark.position();
679 var element = bookmark[Sources.JavaScriptSourceFrame.BreakpointDecoratio n._elementSymbolForTest];
680 var disabled = element.classList.contains("cm-inline-disabled");
681 var conditional = element.classList.contains("cm-inline-conditional");
682 InspectorTest.addResult(" inline breakpoint at (" + position.startLine + ", " + position.startColumn + ")" + (disabled ? " disabled" : "") + (condition al ? " conditional" : ""));
683 }
684 }
685
686 InspectorTest.clickJavaScriptSourceFrameBreakpoint = function(sourceFrame, lineN umber, index)
687 {
688 var textEditor = sourceFrame._textEditor;
689 var lineLength = textEditor.line(lineNumber).length;
690 var lineRange = new Common.TextRange(lineNumber, 0, lineNumber, lineLength);
691 var bookmarks = textEditor.bookmarks(lineRange, Sources.JavaScriptSourceFram e.BreakpointDecoration._bookmarkSymbol);
692 bookmarks.sort((bookmark1, bookmark2) => bookmark1.position().startColumn - bookmark2.position().startColumn);
693 bookmarks[index][Sources.JavaScriptSourceFrame.BreakpointDecoration._element SymbolForTest].click();
658 } 694 }
659 695
660 }; 696 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/sources/debugger/source-frame-inline-breakpoint-decorations.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698