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 all the function calls associated with an animation frame snapshot michael@0: * are properly displayed in the UI. michael@0: */ michael@0: michael@0: function ifTestingSupported() { michael@0: let [target, debuggee, panel] = yield initCanavsDebuggerFrontend(SIMPLE_CANVAS_URL); michael@0: let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin; michael@0: michael@0: yield reload(target); michael@0: michael@0: let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED); michael@0: let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED); michael@0: SnapshotsListView._onRecordButtonClick(); michael@0: yield promise.all([recordingFinished, callListPopulated]); michael@0: michael@0: is(CallsListView.itemCount, 8, michael@0: "All the function calls should now be displayed in the UI."); michael@0: michael@0: testItem(CallsListView.getItemAtIndex(0), michael@0: "1", "ctx", "clearRect", "(0, 0, 128, 128)", "doc_simple-canvas.html:25"); michael@0: michael@0: testItem(CallsListView.getItemAtIndex(1), michael@0: "2", "ctx", "fillStyle", " = rgb(192, 192, 192)", "doc_simple-canvas.html:20"); michael@0: testItem(CallsListView.getItemAtIndex(2), michael@0: "3", "ctx", "fillRect", "(0, 0, 128, 128)", "doc_simple-canvas.html:21"); michael@0: michael@0: testItem(CallsListView.getItemAtIndex(3), michael@0: "4", "ctx", "fillStyle", " = rgba(0, 0, 192, 0.5)", "doc_simple-canvas.html:20"); michael@0: testItem(CallsListView.getItemAtIndex(4), michael@0: "5", "ctx", "fillRect", "(30, 30, 55, 50)", "doc_simple-canvas.html:21"); michael@0: michael@0: testItem(CallsListView.getItemAtIndex(5), michael@0: "6", "ctx", "fillStyle", " = rgba(192, 0, 0, 0.5)", "doc_simple-canvas.html:20"); michael@0: testItem(CallsListView.getItemAtIndex(6), michael@0: "7", "ctx", "fillRect", "(10, 10, 55, 50)", "doc_simple-canvas.html:21"); michael@0: michael@0: testItem(CallsListView.getItemAtIndex(7), michael@0: "8", "", "requestAnimationFrame", "(Function)", "doc_simple-canvas.html:30"); michael@0: michael@0: function testItem(item, index, context, name, args, location) { michael@0: let i = CallsListView.indexOfItem(item); michael@0: is(i, index - 1, michael@0: "The item at index " + index + " is correctly displayed in the UI."); michael@0: michael@0: is($(".call-item-index", item.target).getAttribute("value"), index, michael@0: "The item's gutter label has the correct text."); michael@0: michael@0: if (context) { michael@0: is($(".call-item-context", item.target).getAttribute("value"), context, michael@0: "The item's context label has the correct text."); michael@0: } else { michael@0: is($(".call-item-context", item.target), null, michael@0: "The item's context label should not be available."); michael@0: } michael@0: michael@0: is($(".call-item-name", item.target).getAttribute("value"), name, michael@0: "The item's name label has the correct text."); michael@0: is($(".call-item-args", item.target).getAttribute("value"), args, michael@0: "The item's args label has the correct text."); michael@0: is($(".call-item-location", item.target).getAttribute("value"), location, michael@0: "The item's location label has the correct text."); michael@0: } michael@0: michael@0: yield teardown(panel); michael@0: finish(); michael@0: }