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

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

Issue 2526013002: [DevTools] Added inline breakpoints (Closed)
Patch Set: rebased test 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/live-edit.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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 var threadsPane = self.runtime.sharedInstance(Sources.ThreadsSidebarPane); 636 var threadsPane = self.runtime.sharedInstance(Sources.ThreadsSidebarPane);
637 var listItem = threadsPane._listItemForTarget(target); 637 var listItem = threadsPane._listItemForTarget(target);
638 threadsPane._onListItemClick(listItem); 638 threadsPane._onListItemClick(listItem);
639 } 639 }
640 640
641 InspectorTest.evaluateOnCurrentCallFrame = function(code) 641 InspectorTest.evaluateOnCurrentCallFrame = function(code)
642 { 642 {
643 return new Promise(succ => InspectorTest.debuggerModel.evaluateOnSelectedCal lFrame(code, "console", false, true, false, false, InspectorTest.safeWrap(succ)) ); 643 return new Promise(succ => InspectorTest.debuggerModel.evaluateOnSelectedCal lFrame(code, "console", false, true, false, false, InspectorTest.safeWrap(succ)) );
644 } 644 }
645 645
646 InspectorTest.waitJavaScriptSourceFrameBreakpoints = function(sourceFrame) 646 InspectorTest.prepareSourceFrameForBreakpointTest = function(sourceFrame)
647 { 647 {
648 return new Promise(resolve => InspectorTest.addSniffer(sourceFrame.__proto__ , "_breakpointDecorationsUpdatedForTest", resolveIfAllBreakpointsResolved.bind(n ull, resolve))); 648 var symbol = Symbol('waitedDecorations');
649 sourceFrame[symbol] = 0;
650 InspectorTest.addSniffer(sourceFrame.__proto__, "_willAddInlineDecorationsFo rTest", () => sourceFrame[symbol]++, true);
651 InspectorTest.addSniffer(sourceFrame.__proto__, "_didAddInlineDecorationsFor Test", (updateWasScheduled) => {
652 sourceFrame[symbol]--;
653 if (!updateWasScheduled)
654 sourceFrame._breakpointDecorationsUpdatedForTest();
655 }, true);
656 sourceFrame._waitingForPossibleLocationsForTest = () => !!sourceFrame[symbol ];
657 }
649 658
650 function resolveIfAllBreakpointsResolved(resolve) 659 InspectorTest.waitJavaScriptSourceFrameBreakpoints = function(sourceFrame, inlin e)
660 {
661 if (!sourceFrame._waitingForPossibleLocationsForTest) {
662 InspectorTest.addResult("Error: source frame should be prepared with Ins pectorTest.prepareSourceFrameForBreakpointTest function.");
663 InspectorTest.completeTest();
664 return;
665 }
666 return waitUpdate().then(checkIfReady);
667 function waitUpdate()
651 { 668 {
669 return new Promise(resolve => InspectorTest.addSniffer(sourceFrame.__pro to__, "_breakpointDecorationsUpdatedForTest", resolve));
670 }
671 function checkIfReady()
672 {
673 if (sourceFrame._waitingForPossibleLocationsForTest())
674 return waitUpdate().then(checkIfReady);
652 for (var breakpoint of Bindings.breakpointManager._allBreakpoints()) { 675 for (var breakpoint of Bindings.breakpointManager._allBreakpoints()) {
653 if (breakpoint._fakePrimaryLocation && breakpoint.enabled()) { 676 if (breakpoint._fakePrimaryLocation && breakpoint.enabled())
654 InspectorTest.addSniffer(sourceFrame.__proto__, "_breakpointDeco rationsUpdatedForTest", resolveIfAllBreakpointsResolved.bind(null, resolve)); 677 return waitUpdate().then(checkIfReady);
655 return;
656 }
657 } 678 }
658 resolve(); 679 return Promise.resolve();
659 } 680 }
660 } 681 }
661 682
662 InspectorTest.dumpJavaScriptSourceFrameBreakpoints = function(sourceFrame) 683 InspectorTest.dumpJavaScriptSourceFrameBreakpoints = function(sourceFrame)
663 { 684 {
664 var textEditor = sourceFrame._textEditor; 685 var textEditor = sourceFrame._textEditor;
665 for (var lineNumber = 0; lineNumber < textEditor.linesCount; ++lineNumber) { 686 for (var lineNumber = 0; lineNumber < textEditor.linesCount; ++lineNumber) {
666 if (!textEditor.hasLineClass(lineNumber, "cm-breakpoint")) 687 if (!textEditor.hasLineClass(lineNumber, "cm-breakpoint"))
667 continue; 688 continue;
668 var disabled = textEditor.hasLineClass(lineNumber, "cm-breakpoint-disabl ed"); 689 var disabled = textEditor.hasLineClass(lineNumber, "cm-breakpoint-disabl ed");
669 var conditional = textEditor.hasLineClass(lineNumber, "cm-breakpoint-con ditional") 690 var conditional = textEditor.hasLineClass(lineNumber, "cm-breakpoint-con ditional")
670 InspectorTest.addResult("breakpoint at " + lineNumber + (disabled ? " di sabled" : "") + (conditional ? " conditional" : "")); 691 InspectorTest.addResult("breakpoint at " + lineNumber + (disabled ? " di sabled" : "") + (conditional ? " conditional" : ""));
671 } 692 }
693 var bookmarks = textEditor.bookmarks(textEditor.fullRange(), Sources.JavaScr iptSourceFrame.BreakpointDecoration._bookmarkSymbol);
694 bookmarks = bookmarks.filter(bookmark => !!bookmark.position());
695 bookmarks.sort((bookmark1, bookmark2) => bookmark1.position().startColumn - bookmark2.position().startColumn);
696 for (var bookmark of bookmarks) {
697 var position = bookmark.position();
698 var element = bookmark[Sources.JavaScriptSourceFrame.BreakpointDecoratio n._elementSymbolForTest];
699 var disabled = element.classList.contains("cm-inline-disabled");
700 var conditional = element.classList.contains("cm-inline-conditional");
701 InspectorTest.addResult(" inline breakpoint at (" + position.startLine + ", " + position.startColumn + ")" + (disabled ? " disabled" : "") + (condition al ? " conditional" : ""));
702 }
703 }
704
705 InspectorTest.clickJavaScriptSourceFrameBreakpoint = function(sourceFrame, lineN umber, index)
706 {
707 var textEditor = sourceFrame._textEditor;
708 var lineLength = textEditor.line(lineNumber).length;
709 var lineRange = new Common.TextRange(lineNumber, 0, lineNumber, lineLength);
710 var bookmarks = textEditor.bookmarks(lineRange, Sources.JavaScriptSourceFram e.BreakpointDecoration._bookmarkSymbol);
711 bookmarks.sort((bookmark1, bookmark2) => bookmark1.position().startColumn - bookmark2.position().startColumn);
712 bookmarks[index][Sources.JavaScriptSourceFrame.BreakpointDecoration._element SymbolForTest].click();
672 } 713 }
673 714
674 }; 715 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/sources/debugger/live-edit.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698