Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Tests if functions inside a single animation frame are recorded and stored |
michael@0 | 6 | * for a canvas context. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | function ifTestingSupported() { |
michael@0 | 10 | let [target, debuggee, front] = yield initCanavsDebuggerBackend(SIMPLE_CANVAS_URL); |
michael@0 | 11 | |
michael@0 | 12 | let navigated = once(target, "navigate"); |
michael@0 | 13 | |
michael@0 | 14 | yield front.setup({ reload: true }); |
michael@0 | 15 | ok(true, "The front was setup up successfully."); |
michael@0 | 16 | |
michael@0 | 17 | yield navigated; |
michael@0 | 18 | ok(true, "Target automatically navigated when the front was set up."); |
michael@0 | 19 | |
michael@0 | 20 | let snapshotActor = yield front.recordAnimationFrame(); |
michael@0 | 21 | ok(snapshotActor, |
michael@0 | 22 | "A snapshot actor was sent after recording."); |
michael@0 | 23 | |
michael@0 | 24 | let animationOverview = yield snapshotActor.getOverview(); |
michael@0 | 25 | ok(snapshotActor, |
michael@0 | 26 | "An animation overview could be retrieved after recording."); |
michael@0 | 27 | |
michael@0 | 28 | let functionCalls = animationOverview.calls; |
michael@0 | 29 | ok(functionCalls, |
michael@0 | 30 | "An array of function call actors was sent after recording."); |
michael@0 | 31 | is(functionCalls.length, 8, |
michael@0 | 32 | "The number of function call actors is correct."); |
michael@0 | 33 | |
michael@0 | 34 | is(functionCalls[0].type, CallWatcherFront.METHOD_FUNCTION, |
michael@0 | 35 | "The first called function is correctly identified as a method."); |
michael@0 | 36 | is(functionCalls[0].name, "clearRect", |
michael@0 | 37 | "The first called function's name is correct."); |
michael@0 | 38 | is(functionCalls[0].file, SIMPLE_CANVAS_URL, |
michael@0 | 39 | "The first called function's file is correct."); |
michael@0 | 40 | is(functionCalls[0].line, 25, |
michael@0 | 41 | "The first called function's line is correct."); |
michael@0 | 42 | is(functionCalls[0].argsPreview, "0, 0, 128, 128", |
michael@0 | 43 | "The first called function's args preview is correct."); |
michael@0 | 44 | is(functionCalls[0].callerPreview, "ctx", |
michael@0 | 45 | "The first called function's caller preview is correct."); |
michael@0 | 46 | |
michael@0 | 47 | is(functionCalls[6].type, CallWatcherFront.METHOD_FUNCTION, |
michael@0 | 48 | "The penultimate called function is correctly identified as a method."); |
michael@0 | 49 | is(functionCalls[6].name, "fillRect", |
michael@0 | 50 | "The penultimate called function's name is correct."); |
michael@0 | 51 | is(functionCalls[6].file, SIMPLE_CANVAS_URL, |
michael@0 | 52 | "The penultimate called function's file is correct."); |
michael@0 | 53 | is(functionCalls[6].line, 21, |
michael@0 | 54 | "The penultimate called function's line is correct."); |
michael@0 | 55 | is(functionCalls[6].argsPreview, "10, 10, 55, 50", |
michael@0 | 56 | "The penultimate called function's args preview is correct."); |
michael@0 | 57 | is(functionCalls[6].callerPreview, "ctx", |
michael@0 | 58 | "The penultimate called function's caller preview is correct."); |
michael@0 | 59 | |
michael@0 | 60 | is(functionCalls[7].type, CallWatcherFront.METHOD_FUNCTION, |
michael@0 | 61 | "The last called function is correctly identified as a method."); |
michael@0 | 62 | is(functionCalls[7].name, "requestAnimationFrame", |
michael@0 | 63 | "The last called function's name is correct."); |
michael@0 | 64 | is(functionCalls[7].file, SIMPLE_CANVAS_URL, |
michael@0 | 65 | "The last called function's file is correct."); |
michael@0 | 66 | is(functionCalls[7].line, 30, |
michael@0 | 67 | "The last called function's line is correct."); |
michael@0 | 68 | ok(functionCalls[7].argsPreview.contains("Function"), |
michael@0 | 69 | "The last called function's args preview is correct."); |
michael@0 | 70 | is(functionCalls[7].callerPreview, "", |
michael@0 | 71 | "The last called function's caller preview is correct."); |
michael@0 | 72 | |
michael@0 | 73 | yield removeTab(target.tab); |
michael@0 | 74 | finish(); |
michael@0 | 75 | } |