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.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Tests if all the function calls associated with an animation frame snapshot
6 * are properly displayed in the UI.
7 */
9 function ifTestingSupported() {
10 let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL);
11 let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
13 yield reload(target);
15 let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
16 let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
17 SnapshotsListView._onRecordButtonClick();
18 yield promise.all([recordingFinished, callListPopulated]);
20 is(CallsListView.itemCount, 8,
21 "All the function calls should now be displayed in the UI.");
23 testItem(CallsListView.getItemAtIndex(0),
24 "1", "ctx", "clearRect", "(0, 0, 128, 128)", "doc_simple-canvas.html:25");
26 testItem(CallsListView.getItemAtIndex(1),
27 "2", "ctx", "fillStyle", " = rgb(192, 192, 192)", "doc_simple-canvas.html:20");
28 testItem(CallsListView.getItemAtIndex(2),
29 "3", "ctx", "fillRect", "(0, 0, 128, 128)", "doc_simple-canvas.html:21");
31 testItem(CallsListView.getItemAtIndex(3),
32 "4", "ctx", "fillStyle", " = rgba(0, 0, 192, 0.5)", "doc_simple-canvas.html:20");
33 testItem(CallsListView.getItemAtIndex(4),
34 "5", "ctx", "fillRect", "(30, 30, 55, 50)", "doc_simple-canvas.html:21");
36 testItem(CallsListView.getItemAtIndex(5),
37 "6", "ctx", "fillStyle", " = rgba(192, 0, 0, 0.5)", "doc_simple-canvas.html:20");
38 testItem(CallsListView.getItemAtIndex(6),
39 "7", "ctx", "fillRect", "(10, 10, 55, 50)", "doc_simple-canvas.html:21");
41 testItem(CallsListView.getItemAtIndex(7),
42 "8", "", "requestAnimationFrame", "(Function)", "doc_simple-canvas.html:30");
44 function testItem(item, index, context, name, args, location) {
45 let i = CallsListView.indexOfItem(item);
46 is(i, index - 1,
47 "The item at index " + index + " is correctly displayed in the UI.");
49 is($(".call-item-index", item.target).getAttribute("value"), index,
50 "The item's gutter label has the correct text.");
52 if (context) {
53 is($(".call-item-context", item.target).getAttribute("value"), context,
54 "The item's context label has the correct text.");
55 } else {
56 is($(".call-item-context", item.target), null,
57 "The item's context label should not be available.");
58 }
60 is($(".call-item-name", item.target).getAttribute("value"), name,
61 "The item's name label has the correct text.");
62 is($(".call-item-args", item.target).getAttribute("value"), args,
63 "The item's args label has the correct text.");
64 is($(".call-item-location", item.target).getAttribute("value"), location,
65 "The item's location label has the correct text.");
66 }
68 yield teardown(panel);
69 finish();
70 }