| Index: LayoutTests/inspector-protocol/timeline/timeline-raf.html
|
| diff --git a/LayoutTests/inspector-protocol/timeline/timeline-raf.html b/LayoutTests/inspector-protocol/timeline/timeline-raf.html
|
| index af520f1cd33dd9913958b054ca1e9db2c3da21e4..8acb7a0198c1097525b3a9af445800eddabcc18f 100644
|
| --- a/LayoutTests/inspector-protocol/timeline/timeline-raf.html
|
| +++ b/LayoutTests/inspector-protocol/timeline/timeline-raf.html
|
| @@ -1,13 +1,15 @@
|
| <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 performActions(callback)
|
| {
|
| var rafId1 = requestAnimationFrame(function()
|
| {
|
| evaluateInFrontend("InspectorTest.testFunctionRequestAnimationFrame(" + rafId1 + ", " + rafId2 + ")");
|
| + callback();
|
| });
|
|
|
| var rafId2 = requestAnimationFrame(function() { });
|
| @@ -16,9 +18,7 @@ function testFunction()
|
|
|
| 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("performActions", finish);
|
|
|
| var firedRaf;
|
| var canceledRaf;
|
| @@ -27,58 +27,24 @@ function test()
|
| firedRaf = rafId1;
|
| canceledRaf = rafId2;
|
| InspectorTest.log("SUCCESS: testFunctionRequestAnimationFrame");
|
| - InspectorTest.sendCommand("Tracing.end", { }, onStop);
|
| }
|
|
|
| - function onStart(response)
|
| + function finish(devtoolsEvents)
|
| {
|
| - InspectorTest.log("Recording started");
|
| - InspectorTest.sendCommand("Runtime.evaluate", { "expression": "testFunction()" });
|
| - }
|
| -
|
| - 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 hasRafId(id, e) { return e.args.data.id === id}
|
|
|
| - var raf1 = findEvent("RequestAnimationFrame", "I", hasRafId.bind(this, firedRaf));
|
| - var raf2 = findEvent("RequestAnimationFrame", "I", hasRafId.bind(this, canceledRaf));
|
| + var raf1 = InspectorTest.findEvent("RequestAnimationFrame", "I", hasRafId.bind(this, firedRaf));
|
| + var raf2 = InspectorTest.findEvent("RequestAnimationFrame", "I", hasRafId.bind(this, canceledRaf));
|
|
|
| InspectorTest.assert(!!raf1.args.data.frame, "RequestAnimationFrame frame");
|
| InspectorTest.assertEquals(raf1.args.data.frame, raf2.args.data.frame, "RequestAnimationFrame frame match");
|
|
|
| - findEvent("CancelAnimationFrame", "I", hasRafId.bind(this, canceledRaf));
|
| - findEvent("FireAnimationFrame", "X", hasRafId.bind(this, firedRaf));
|
| + InspectorTest.findEvent("CancelAnimationFrame", "I", hasRafId.bind(this, canceledRaf));
|
| + InspectorTest.findEvent("FireAnimationFrame", "X", hasRafId.bind(this, firedRaf));
|
|
|
| InspectorTest.log("SUCCESS: found all expected events.");
|
| InspectorTest.completeTest();
|
| }
|
| -
|
| - function findEvent(name, ph, condition)
|
| - {
|
| - for (var i = 0; i < devtoolsEvents.length; i++) {
|
| - var e = devtoolsEvents[i];
|
| - if (e.name === name && e.ph === ph && (!condition || condition(e)))
|
| - return e;
|
| - }
|
| - throw new Error("Couldn't find event " + name + " / " + ph + "\n\n in " + JSON.stringify(devtoolsEvents, null, 2));
|
| - }
|
| -
|
| - function onStop(response)
|
| - {
|
| - InspectorTest.log("Recording stopped");
|
| - }
|
| }
|
| </script>
|
| </head>
|
|
|