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 thumbnails. |
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 thumbnails = animationOverview.thumbnails; |
michael@0 | 29 | ok(thumbnails, |
michael@0 | 30 | "An array of thumbnails was sent after recording."); |
michael@0 | 31 | is(thumbnails.length, 4, |
michael@0 | 32 | "The number of thumbnails is correct."); |
michael@0 | 33 | |
michael@0 | 34 | is(thumbnails[0].index, 0, |
michael@0 | 35 | "The first thumbnail's index is correct."); |
michael@0 | 36 | is(thumbnails[0].width, 50, |
michael@0 | 37 | "The first thumbnail's width is correct."); |
michael@0 | 38 | is(thumbnails[0].height, 50, |
michael@0 | 39 | "The first thumbnail's height is correct."); |
michael@0 | 40 | is(thumbnails[0].flipped, false, |
michael@0 | 41 | "The first thumbnail's flipped flag is correct."); |
michael@0 | 42 | is([].find.call(thumbnails[0].pixels, e => e > 0), undefined, |
michael@0 | 43 | "The first thumbnail's pixels seem to be completely transparent."); |
michael@0 | 44 | |
michael@0 | 45 | is(thumbnails[1].index, 2, |
michael@0 | 46 | "The second thumbnail's index is correct."); |
michael@0 | 47 | is(thumbnails[1].width, 50, |
michael@0 | 48 | "The second thumbnail's width is correct."); |
michael@0 | 49 | is(thumbnails[1].height, 50, |
michael@0 | 50 | "The second thumbnail's height is correct."); |
michael@0 | 51 | is(thumbnails[1].flipped, false, |
michael@0 | 52 | "The second thumbnail's flipped flag is correct."); |
michael@0 | 53 | is([].find.call(thumbnails[1].pixels, e => e > 0), 4290822336, |
michael@0 | 54 | "The second thumbnail's pixels seem to not be completely transparent."); |
michael@0 | 55 | |
michael@0 | 56 | is(thumbnails[2].index, 4, |
michael@0 | 57 | "The third thumbnail's index is correct."); |
michael@0 | 58 | is(thumbnails[2].width, 50, |
michael@0 | 59 | "The third thumbnail's width is correct."); |
michael@0 | 60 | is(thumbnails[2].height, 50, |
michael@0 | 61 | "The third thumbnail's height is correct."); |
michael@0 | 62 | is(thumbnails[2].flipped, false, |
michael@0 | 63 | "The third thumbnail's flipped flag is correct."); |
michael@0 | 64 | is([].find.call(thumbnails[2].pixels, e => e > 0), 4290822336, |
michael@0 | 65 | "The third thumbnail's pixels seem to not be completely transparent."); |
michael@0 | 66 | |
michael@0 | 67 | is(thumbnails[3].index, 6, |
michael@0 | 68 | "The fourth thumbnail's index is correct."); |
michael@0 | 69 | is(thumbnails[3].width, 50, |
michael@0 | 70 | "The fourth thumbnail's width is correct."); |
michael@0 | 71 | is(thumbnails[3].height, 50, |
michael@0 | 72 | "The fourth thumbnail's height is correct."); |
michael@0 | 73 | is(thumbnails[3].flipped, false, |
michael@0 | 74 | "The fourth thumbnail's flipped flag is correct."); |
michael@0 | 75 | is([].find.call(thumbnails[3].pixels, e => e > 0), 4290822336, |
michael@0 | 76 | "The fourth thumbnail's pixels seem to not be completely transparent."); |
michael@0 | 77 | |
michael@0 | 78 | yield removeTab(target.tab); |
michael@0 | 79 | finish(); |
michael@0 | 80 | } |