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 draw calls inside a single animation frame generate and retrieve |
michael@0 | 6 | * the correct "end result" screenshot. |
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 screenshot = animationOverview.screenshot; |
michael@0 | 29 | ok(screenshot, |
michael@0 | 30 | "A screenshot was sent after recording."); |
michael@0 | 31 | |
michael@0 | 32 | is(screenshot.index, 6, |
michael@0 | 33 | "The screenshot's index is correct."); |
michael@0 | 34 | is(screenshot.width, 128, |
michael@0 | 35 | "The screenshot's width is correct."); |
michael@0 | 36 | is(screenshot.height, 128, |
michael@0 | 37 | "The screenshot's height is correct."); |
michael@0 | 38 | is(screenshot.flipped, false, |
michael@0 | 39 | "The screenshot's flipped flag is correct."); |
michael@0 | 40 | is([].find.call(screenshot.pixels, e => e > 0), 4290822336, |
michael@0 | 41 | "The screenshot's pixels seem to not be completely transparent."); |
michael@0 | 42 | |
michael@0 | 43 | yield removeTab(target.tab); |
michael@0 | 44 | finish(); |
michael@0 | 45 | } |