browser_canvas-frontend-call-highlight.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Tests if certain function calls are properly highlighted in the UI.
  5. */
  6. function* ifTestingSupported() {
  7. let { target, panel } = yield initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
  8. let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
  9. yield reload(target);
  10. let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
  11. let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
  12. SnapshotsListView._onRecordButtonClick();
  13. yield promise.all([recordingFinished, callListPopulated]);
  14. is(CallsListView.itemCount, 8,
  15. "All the function calls should now be displayed in the UI.");
  16. is($(".call-item-view", CallsListView.getItemAtIndex(0).target).hasAttribute("draw-call"), true,
  17. "The first item's node should have a draw-call attribute.");
  18. is($(".call-item-view", CallsListView.getItemAtIndex(1).target).hasAttribute("draw-call"), false,
  19. "The second item's node should not have a draw-call attribute.");
  20. is($(".call-item-view", CallsListView.getItemAtIndex(2).target).hasAttribute("draw-call"), true,
  21. "The third item's node should have a draw-call attribute.");
  22. is($(".call-item-view", CallsListView.getItemAtIndex(3).target).hasAttribute("draw-call"), false,
  23. "The fourth item's node should not have a draw-call attribute.");
  24. is($(".call-item-view", CallsListView.getItemAtIndex(4).target).hasAttribute("draw-call"), true,
  25. "The fifth item's node should have a draw-call attribute.");
  26. is($(".call-item-view", CallsListView.getItemAtIndex(5).target).hasAttribute("draw-call"), false,
  27. "The sixth item's node should not have a draw-call attribute.");
  28. is($(".call-item-view", CallsListView.getItemAtIndex(6).target).hasAttribute("draw-call"), true,
  29. "The seventh item's node should have a draw-call attribute.");
  30. is($(".call-item-view", CallsListView.getItemAtIndex(7).target).hasAttribute("draw-call"), false,
  31. "The eigth item's node should not have a draw-call attribute.");
  32. yield teardown(panel);
  33. finish();
  34. }