-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The test only times out on debug builds and doesn't reproduce locally. So as a first step we split the test into two files and run 3 test cases each. Locally this reduces running time from ~44 seconds to ~29 seconds. R=jarin@chormium.org Bug: 1455530 Change-Id: Ifac540915c4f25ff1963e05b85a6f8f8aa2309a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4625451 Commit-Queue: Simon Zünd <szuend@chromium.org> Auto-Submit: Simon Zünd <szuend@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Jaroslav Sevcik <jarin@chromium.org> Cr-Commit-Position: refs/heads/main@{#1159509}
- Loading branch information
Showing
4 changed files
with
187 additions
and
89 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
.../devtools/sources/debugger-frameworks/frameworks-dom-xhr-event-breakpoints-1-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Tests framework black-boxing on DOM, XHR and Event breakpoints. | ||
|
||
|
||
Running: testDOMBreakpoint | ||
Call stack: | ||
* 0) Framework.appendChild (framework.js:72) | ||
1) appendElement (frameworks-dom-xhr-event-breakpoints-1.js:26) | ||
2) (:1) | ||
[setTimeout] | ||
0) (:1) | ||
Paused on subtree modificationsdiv#rootElementChild div#rootElement added | ||
|
||
Running: testXHRBreakpoint | ||
Call stack: | ||
* 0) Framework.sendXHR (framework.js:79) | ||
1) sendXHR (frameworks-dom-xhr-event-breakpoints-1.js:31) | ||
2) (:1) | ||
[setTimeout] | ||
0) (:1) | ||
Paused on XHR or fetchhttp://127.0.0.1:8000/devtools/sources/debugger-frameworks/resources/foo?xhr | ||
|
||
Running: testEventListenerBreakpoint | ||
Call stack: | ||
0) testElementClicked (frameworks-dom-xhr-event-breakpoints-1.js:38) | ||
* 1) Framework_bound (framework.js:105) | ||
* 2) Framework_eventListener (framework.js:86) | ||
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints-1.js:49) | ||
4) (:1) | ||
[setTimeout] | ||
0) (:1) | ||
|
||
Executing Resume... | ||
Call stack: | ||
0) testElementClicked (frameworks-dom-xhr-event-breakpoints-1.js:38) | ||
* 1) Framework_bound (framework.js:105) | ||
* 2) Framework_eventListener (framework.js:86) | ||
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints-1.js:55) | ||
4) (:1) | ||
[setTimeout] | ||
0) (:1) | ||
|
||
Executing Resume... | ||
|
125 changes: 125 additions & 0 deletions
125
...http/tests/devtools/sources/debugger-frameworks/frameworks-dom-xhr-event-breakpoints-1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
// Copyright 2017 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import {TestRunner} from 'test_runner'; | ||
import {ElementsTestRunner} from 'elements_test_runner'; | ||
import {SourcesTestRunner} from 'sources_test_runner'; | ||
|
||
(async function() { | ||
TestRunner.addResult( | ||
`Tests framework black-boxing on DOM, XHR and Event breakpoints.\n`); | ||
await TestRunner.loadLegacyModule('elements'); | ||
await TestRunner.loadLegacyModule('sources'); | ||
await TestRunner.showPanel('sources'); | ||
await TestRunner.loadHTML(` | ||
<div id="rootElement"></div> | ||
<input type="button" id="test"> | ||
`); | ||
await TestRunner.addScriptTag('../debugger/resources/framework.js'); | ||
await TestRunner.evaluateInPagePromise(` | ||
function appendElement(parentId, childId) | ||
{ | ||
var child = document.createElement("div"); | ||
child.id = childId; | ||
var parent = document.getElementById(parentId); | ||
Framework.appendChild(parent, child); | ||
} | ||
function sendXHR(url) | ||
{ | ||
Framework.sendXHR(url); | ||
} | ||
function addListenerAndClick(stop) | ||
{ | ||
function testElementClicked() | ||
{ | ||
return 0; | ||
} | ||
var button = document.getElementById("test"); | ||
var remover = Framework.addEventListener(button, "click", Framework.bind(Framework.empty, null), true); // Should be ignored. | ||
if (stop) | ||
debugger; | ||
button.click(); | ||
remover(); | ||
remover = Framework.addEventListener(button, "click", Framework.bind(testElementClicked, null), true); | ||
button.click(); | ||
remover(); | ||
// Test both handlers together. | ||
var remover1 = Framework.addEventListener(button, "click", Framework.bind(Framework.empty, null), true); // Should be ignored. | ||
var remover2 = Framework.addEventListener(button, "click", Framework.bind(testElementClicked, null), true); | ||
button.click(); | ||
remover1(); | ||
remover2(); | ||
} | ||
function addFewBlackboxedListenersAndClick(addNonBlackboxedListener) | ||
{ | ||
function testElementClicked() | ||
{ | ||
return 0; | ||
} | ||
function inner() | ||
{ | ||
var button = document.getElementById("test"); | ||
var remover1 = Framework.addEventListener(button, "click", Framework.empty, true); | ||
var remover2 = Framework.addEventListener(button, "click", Framework.bind(Framework.throwFrameworkException, null, "EXPECTED"), true); | ||
var remover3 = Framework.addEventListener(button, "click", Framework.bind(Framework.safeRun, null, Framework.empty, Framework.empty, Framework.empty), true); | ||
var remover4 = function() {}; | ||
if (addNonBlackboxedListener) | ||
remover4 = Framework.addEventListener(button, "click", Framework.bind(Framework.safeRun, null, Framework.empty, testElementClicked, Framework.empty), true); | ||
debugger; | ||
button.click(); | ||
remover1(); | ||
remover2(); | ||
remover3(); | ||
remover4(); | ||
} | ||
return inner(); | ||
} | ||
`); | ||
|
||
var frameworkRegexString = '/framework\\.js$'; | ||
Common.settingForTest('skipStackFramesPattern').set(frameworkRegexString); | ||
|
||
SourcesTestRunner.setQuiet(true); | ||
|
||
SourcesTestRunner.runDebuggerTestSuite([ | ||
function testDOMBreakpoint(next) { | ||
ElementsTestRunner.nodeWithId('rootElement', step1); | ||
|
||
function step1(node) { | ||
TestRunner.domDebuggerModel.setDOMBreakpoint( | ||
node, Protocol.DOMDebugger.DOMBreakpointType.SubtreeModified); | ||
TestRunner.evaluateInPageWithTimeout( | ||
'appendElement(\'rootElement\', \'childElement\')'); | ||
SourcesTestRunner.waitUntilPausedAndDumpStackAndResume(next); | ||
} | ||
}, | ||
|
||
function testXHRBreakpoint(next) { | ||
SDK.domDebuggerManager.addXHRBreakpoint('foo', true); | ||
TestRunner.evaluateInPageWithTimeout('sendXHR(\'resources/foo?xhr\')'); | ||
SourcesTestRunner.waitUntilPausedAndDumpStackAndResume(next); | ||
}, | ||
|
||
function testEventListenerBreakpoint(next) { | ||
SDK.domDebuggerManager | ||
.resolveEventListenerBreakpoint({eventName: 'listener:click'}) | ||
.setEnabled(true); | ||
TestRunner.evaluateInPageWithTimeout('addListenerAndClick(false)'); | ||
SourcesTestRunner.waitUntilPausedAndPerformSteppingActions( | ||
[ | ||
'Print', | ||
'Resume', | ||
'Print', | ||
'Resume', | ||
], | ||
next); | ||
} | ||
]); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters