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

Unified Diff: LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.html

Issue 391413003: DevTools: [Timeline] extract common infrastructure from tracing tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: syntax error was fixed Created 6 years, 5 months 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.html
diff --git a/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.html b/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.html
index 586aad58069f616f3b65641e36fc5e4db02c141c..9386a3a431ed2048cb93a3ffc8e286f9b72d0123 100644
--- a/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.html
+++ b/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.html
@@ -1,9 +1,10 @@
<html>
<head>
<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/tracing-test.js"></script>
<script>
-function testFunction()
+function performAction(callback)
{
var div = document.querySelector("#my-div");
div.addEventListener("click", function(e) { }, false);
@@ -11,39 +12,15 @@ function testFunction()
var iframe = document.createElement("iframe");
div.appendChild(iframe);
+ callback();
}
function test()
{
- InspectorTest.eventHandler["Tracing.dataCollected"] = dataCollected;
- InspectorTest.eventHandler["Tracing.tracingComplete"] = tracingComplete;
- InspectorTest.sendCommand("Tracing.start", { "categories" : "disabled-by-default-devtools.timeline", "type": "" }, onStart);
+ InspectorTest.invokeAsyncWithTracing("performAction", finish);
- function onStart(response)
+ function finish(devtoolsEvents)
{
- InspectorTest.log("Recording started");
- InspectorTest.sendCommand("Runtime.evaluate", { "expression": "testFunction()" }, didEvaluate);
- }
-
- function didEvaluate(response)
- {
- InspectorTest.sendCommand("Tracing.end", { }, onStop);
- }
-
- var devtoolsEvents = [];
- function dataCollected(reply)
- {
- var allEvents = reply.params.value;
- devtoolsEvents = devtoolsEvents.concat(allEvents.filter(function(e)
- {
- return e.cat === "disabled-by-default-devtools.timeline";
- }));
- }
-
- function tracingComplete(event)
- {
- InspectorTest.log("Tracing complete");
-
function windowEventFilter(type, e)
{
return e.name === "EventDispatch" && e.args.data.type === type;
@@ -56,15 +33,14 @@ function test()
if (events.length >= 1) {
InspectorTest.log("SUCCESS: found " + eventName + " event");
} else {
- fail(eventName + " event is missing");
+ fail(eventName + " event is missing", devtoolsEvents);
}
}
InspectorTest.completeTest();
}
-
- function fail(message)
+ function fail(message, devtoolsEvents)
{
var formattedEvents = devtoolsEvents.map(function(e)
{
@@ -72,11 +48,6 @@ function test()
});
InspectorTest.log("FAIL: " + message + " devtools.timeline events: " + JSON.stringify(formattedEvents, null, 2));
}
-
- function onStop(response)
- {
- InspectorTest.log("Recording stopped");
- }
}
</script>
</head>

Powered by Google App Engine
This is Rietveld 408576698