Commit 599b5bf5 authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[DevTools] fixed frameworks-dom-xhr-breakpoints.js test

.. and migrated it to new test runner as well.

R=chenwilliam@chromium.org

Bug: chromium:667560
Change-Id: I12e8e78304b03ea69abb4b84609eb1ce0d6f27ed
Reviewed-on: https://chromium-review.googlesource.com/767593Reviewed-by: 's avatarWill Chen <chenwilliam@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516132}
parent f7a15bd4
......@@ -6493,7 +6493,6 @@ crbug.com/591099 http/tests/devtools/search/search-in-resource.html [ Failure ]
crbug.com/591099 http/tests/devtools/search/search-in-script.html [ Failure ]
crbug.com/591099 http/tests/devtools/search/search-in-static.html [ Failure ]
crbug.com/591099 http/tests/devtools/sources/autocomplete-hide-on-smart-brace.js [ Failure Pass Timeout ]
crbug.com/591099 http/tests/devtools/sources/debugger-frameworks/frameworks-dom-xhr-event-breakpoints.html [ Failure ]
crbug.com/591099 http/tests/devtools/sources/debugger-pause/debugger-pause-in-internal.js [ Failure ]
crbug.com/591099 http/tests/devtools/sources/debugger-ui/function-generator-details.js [ Failure ]
crbug.com/591099 http/tests/devtools/sources/debugger/properties-special.js [ Failure ]
......
......@@ -1870,9 +1870,6 @@ crbug.com/620432 accessibility/aria-activedescendant.html [ Failure ]
crbug.com/399507 virtual/threaded/http/tests/devtools/tracing/timeline-paint/layer-tree.html [ Skip ]
crbug.com/635909 http/tests/devtools/sources/debugger-frameworks/frameworks-dom-xhr-event-breakpoints.html [ NeedsManualRebaseline Timeout ]
crbug.com/667560 virtual/mojo-loading/http/tests/devtools/sources/debugger-frameworks/frameworks-dom-xhr-event-breakpoints.html [ NeedsManualRebaseline Timeout ]
crbug.com/636424 [ Win7 Debug ] editing/selection/modify_move/move-by-word-visually-crash-test-5.html [ Pass Timeout ]
crbug.com/638618 http/tests/devtools/editor/text-editor-search-switch-editor.js [ Skip ]
crbug.com/667560 virtual/mojo-loading/http/tests/devtools/editor/text-editor-search-switch-editor.js [ Skip ]
......
CONSOLE ERROR: line 21: Uncaught Error: FrameworkException: EXPECTED
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.html:14)
1) appendElement (frameworks-dom-xhr-event-breakpoints.js:21)
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.html:19)
1) sendXHR (frameworks-dom-xhr-event-breakpoints.js:26)
2) (:1)
Paused on XMLHttpRequestfile:///foo?a=b
[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.html:24)
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.js:31)
* 1) Framework_bound (framework.js:105)
* 2) Framework_eventListener (framework.js:86)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.html:37)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.js:44)
4) (:1)
[setTimeout]
0) (:1)
Executing Resume...
Call stack:
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.html:24)
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.js:31)
* 1) Framework_bound (framework.js:105)
* 2) Framework_eventListener (framework.js:86)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.html:43)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.js:50)
4) (:1)
[setTimeout]
0) (:1)
Executing Resume...
Running: testSteppingThroughEventListenerBreakpoint
Executing StepOver...
Call stack:
0) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.html:33)
0) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.js:40)
1) (:1)
[setTimeout]
0) (:1)
Executing StepOver...
Call stack:
0) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.html:34)
0) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.js:41)
1) (:1)
[setTimeout]
0) (:1)
Executing StepOver...
Executing StepOver...
Executing StepOver...
Call stack:
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.html:24)
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.js:31)
* 1) Framework_bound (framework.js:105)
* 2) Framework_eventListener (framework.js:86)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.html:37)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.js:44)
4) (:1)
[setTimeout]
0) (:1)
Executing StepOut...
Executing StepOver...
......@@ -62,70 +74,84 @@ Executing StepOver...
Executing StepOver...
Executing StepOver...
Call stack:
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.html:24)
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.js:31)
* 1) Framework_bound (framework.js:105)
* 2) Framework_eventListener (framework.js:86)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.html:43)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.js:50)
4) (:1)
[setTimeout]
0) (:1)
Executing StepOver...
Executing StepOver...
Executing StepOver...
Call stack:
0) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.html:44)
0) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.js:51)
1) (:1)
[setTimeout]
0) (:1)
Executing Resume...
Running: testSteppingOutOnEventListenerBreakpoint
Executing StepOut...
Call stack:
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.html:24)
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.js:31)
* 1) Framework_bound (framework.js:105)
* 2) Framework_eventListener (framework.js:86)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.html:37)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.js:44)
4) (:1)
[setTimeout]
0) (:1)
Executing StepOut...
Executing StepOut...
Call stack:
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.html:24)
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.js:31)
* 1) Framework_bound (framework.js:105)
* 2) Framework_eventListener (framework.js:86)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.html:43)
3) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.js:50)
4) (:1)
[setTimeout]
0) (:1)
Executing StepOut...
Call stack:
0) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.html:44)
0) addListenerAndClick (frameworks-dom-xhr-event-breakpoints.js:51)
1) (:1)
[setTimeout]
0) (:1)
Executing Resume...
Running: testSteppingOutOnEventListenerBreakpointAllBlackboxedButOne
Executing StepOut...
Call stack:
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.html:50)
0) testElementClicked (frameworks-dom-xhr-event-breakpoints.js:57)
* 1) Framework.safeRun (framework.js:8)
* 2) Framework.safeRun (framework.js:10)
* 3) Framework_bound (framework.js:105)
* 4) Framework_eventListener (framework.js:86)
5) inner (frameworks-dom-xhr-event-breakpoints.html:64)
6) addFewBlackboxedListenersAndClick (frameworks-dom-xhr-event-breakpoints.html:70)
5) inner (frameworks-dom-xhr-event-breakpoints.js:71)
6) addFewBlackboxedListenersAndClick (frameworks-dom-xhr-event-breakpoints.js:77)
7) (:1)
[setTimeout]
0) (:1)
Executing StepOut...
Call stack:
0) inner (frameworks-dom-xhr-event-breakpoints.html:65)
1) addFewBlackboxedListenersAndClick (frameworks-dom-xhr-event-breakpoints.html:70)
0) inner (frameworks-dom-xhr-event-breakpoints.js:72)
1) addFewBlackboxedListenersAndClick (frameworks-dom-xhr-event-breakpoints.js:77)
2) (:1)
[setTimeout]
0) (:1)
Executing StepOut...
Call stack:
0) addFewBlackboxedListenersAndClick (frameworks-dom-xhr-event-breakpoints.html:71)
0) addFewBlackboxedListenersAndClick (frameworks-dom-xhr-event-breakpoints.js:77)
1) (:1)
[setTimeout]
0) (:1)
Executing Resume...
Running: tearDown
<html>
<head>
<script src="../../../inspector/inspector-test.js"></script>
<script src="../../../inspector/elements-test.js"></script>
<script src="../../../inspector/debugger-test.js"></script>
<script src="../debugger/resources/framework.js"></script>
<script>
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;
}
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function() {
TestRunner.addResult(`Tests framework black-boxing on DOM, XHR and Event breakpoints.\n`);
await TestRunner.loadModule('elements_test_runner');
await TestRunner.loadModule('sources_test_runner');
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);
}
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();
}
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();
}
`);
function test() {
var frameworkRegexString = '/framework\\.js$';
Common.settingForTest('skipStackFramesPattern').set(frameworkRegexString);
......@@ -81,23 +88,21 @@ function test() {
ElementsTestRunner.nodeWithId('rootElement', step1);
function step1(node) {
var pane = Components.domBreakpointsSidebarPane;
pane._setBreakpoint(node, Components.DOMBreakpointsSidebarPane.BreakpointTypes.SubtreeModified, true);
TestRunner.domDebuggerModel.setDOMBreakpoint(
node, SDK.DOMDebuggerModel.DOMBreakpoint.Type.SubtreeModified);
TestRunner.evaluateInPageWithTimeout('appendElement(\'rootElement\', \'childElement\')');
SourcesTestRunner.waitUntilPausedAndDumpStackAndResume(next);
}
},
function testXHRBreakpoint(next) {
var pane = self.runtime.sharedInstance(Sources.XHRBreakpointsSidebarPane);
pane._setBreakpoint('foo', true);
TestRunner.evaluateInPageWithTimeout('sendXHR(\'file:///foo?a=b\')');
SDK.domDebuggerManager.addXHRBreakpoint('foo', true);
TestRunner.evaluateInPageWithTimeout('sendXHR(\'resources/foo?xhr\')');
SourcesTestRunner.waitUntilPausedAndDumpStackAndResume(next);
},
function testEventListenerBreakpoint(next) {
var pane = self.runtime.sharedInstance(Sources.EventListenerBreakpointsSidebarPane);
pane._setBreakpoint('listener:click');
SDK.domDebuggerManager.resolveEventListenerBreakpoint({eventName: 'listener:click'}).setEnabled(true);
TestRunner.evaluateInPageWithTimeout('addListenerAndClick(false)');
SourcesTestRunner.waitUntilPausedAndPerformSteppingActions(
[
......@@ -110,8 +115,6 @@ function test() {
},
function testSteppingThroughEventListenerBreakpoint(next) {
var pane = self.runtime.sharedInstance(Sources.EventListenerBreakpointsSidebarPane);
pane._setBreakpoint('listener:click');
TestRunner.evaluateInPageWithTimeout('addListenerAndClick(true)');
SourcesTestRunner.waitUntilPausedAndPerformSteppingActions(
[
......@@ -124,8 +127,6 @@ function test() {
},
function testSteppingOutOnEventListenerBreakpoint(next) {
var pane = self.runtime.sharedInstance(Sources.EventListenerBreakpointsSidebarPane);
pane._setBreakpoint('listener:click');
TestRunner.evaluateInPageWithTimeout('addListenerAndClick(true)');
SourcesTestRunner.waitUntilPausedAndPerformSteppingActions(
[
......@@ -142,8 +143,6 @@ function test() {
},
function testSteppingOutOnEventListenerBreakpointAllBlackboxedButOne(next) {
var pane = self.runtime.sharedInstance(Sources.EventListenerBreakpointsSidebarPane);
pane._setBreakpoint('listener:click');
TestRunner.evaluateInPageWithTimeout('addFewBlackboxedListenersAndClick(true)');
SourcesTestRunner.waitUntilPausedAndPerformSteppingActions(
[
......@@ -156,24 +155,6 @@ function test() {
'Resume',
],
next);
},
function tearDown(next) {
self.runtime.sharedInstance(Sources.XHRBreakpointsSidebarPane)._removeBreakpoint('foo');
self.runtime.sharedInstance(Sources.EventListenerBreakpointsSidebarPane)._removeBreakpoint('listener:click');
next();
}
]);
}
</script>
</head>
<body onload="runTest()">
<p>
Tests framework black-boxing on DOM, XHR and Event breakpoints.
</p>
<div id="rootElement"></div>
<input type=button id="test"></input>
</body>
</html>
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment