michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests if functions inside a single animation frame are recorded and stored michael@0: * for a canvas context. michael@0: */ michael@0: michael@0: function ifTestingSupported() { michael@0: let [target, debuggee, front] = yield initCanavsDebuggerBackend(SIMPLE_CANVAS_URL); michael@0: michael@0: let navigated = once(target, "navigate"); michael@0: michael@0: yield front.setup({ reload: true }); michael@0: ok(true, "The front was setup up successfully."); michael@0: michael@0: yield navigated; michael@0: ok(true, "Target automatically navigated when the front was set up."); michael@0: michael@0: let snapshotActor = yield front.recordAnimationFrame(); michael@0: ok(snapshotActor, michael@0: "A snapshot actor was sent after recording."); michael@0: michael@0: let animationOverview = yield snapshotActor.getOverview(); michael@0: ok(snapshotActor, michael@0: "An animation overview could be retrieved after recording."); michael@0: michael@0: let functionCalls = animationOverview.calls; michael@0: ok(functionCalls, michael@0: "An array of function call actors was sent after recording."); michael@0: is(functionCalls.length, 8, michael@0: "The number of function call actors is correct."); michael@0: michael@0: is(functionCalls[0].type, CallWatcherFront.METHOD_FUNCTION, michael@0: "The first called function is correctly identified as a method."); michael@0: is(functionCalls[0].name, "clearRect", michael@0: "The first called function's name is correct."); michael@0: is(functionCalls[0].file, SIMPLE_CANVAS_URL, michael@0: "The first called function's file is correct."); michael@0: is(functionCalls[0].line, 25, michael@0: "The first called function's line is correct."); michael@0: is(functionCalls[0].argsPreview, "0, 0, 128, 128", michael@0: "The first called function's args preview is correct."); michael@0: is(functionCalls[0].callerPreview, "ctx", michael@0: "The first called function's caller preview is correct."); michael@0: michael@0: is(functionCalls[6].type, CallWatcherFront.METHOD_FUNCTION, michael@0: "The penultimate called function is correctly identified as a method."); michael@0: is(functionCalls[6].name, "fillRect", michael@0: "The penultimate called function's name is correct."); michael@0: is(functionCalls[6].file, SIMPLE_CANVAS_URL, michael@0: "The penultimate called function's file is correct."); michael@0: is(functionCalls[6].line, 21, michael@0: "The penultimate called function's line is correct."); michael@0: is(functionCalls[6].argsPreview, "10, 10, 55, 50", michael@0: "The penultimate called function's args preview is correct."); michael@0: is(functionCalls[6].callerPreview, "ctx", michael@0: "The penultimate called function's caller preview is correct."); michael@0: michael@0: is(functionCalls[7].type, CallWatcherFront.METHOD_FUNCTION, michael@0: "The last called function is correctly identified as a method."); michael@0: is(functionCalls[7].name, "requestAnimationFrame", michael@0: "The last called function's name is correct."); michael@0: is(functionCalls[7].file, SIMPLE_CANVAS_URL, michael@0: "The last called function's file is correct."); michael@0: is(functionCalls[7].line, 30, michael@0: "The last called function's line is correct."); michael@0: ok(functionCalls[7].argsPreview.contains("Function"), michael@0: "The last called function's args preview is correct."); michael@0: is(functionCalls[7].callerPreview, "", michael@0: "The last called function's caller preview is correct."); michael@0: michael@0: yield removeTab(target.tab); michael@0: finish(); michael@0: }