browser_canvas-frontend-call-search.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Tests if filtering the items in the call list works properly.
  5. */
  6. function* ifTestingSupported() {
  7. let { target, panel } = yield initCanvasDebuggerFrontend(SIMPLE_CANVAS_URL);
  8. let { window, $, EVENTS, SnapshotsListView, CallsListView } = panel.panelWin;
  9. let searchbox = $("#calls-searchbox");
  10. yield reload(target);
  11. let firstRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
  12. let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
  13. SnapshotsListView._onRecordButtonClick();
  14. yield promise.all([firstRecordingFinished, callListPopulated]);
  15. is(searchbox.value, "",
  16. "The searchbox should be initially empty.");
  17. is(CallsListView.visibleItems.length, 8,
  18. "All the items should be initially visible in the calls list.");
  19. searchbox.focus();
  20. EventUtils.sendString("clear", window);
  21. is(searchbox.value, "clear",
  22. "The searchbox should now contain the 'clear' string.");
  23. is(CallsListView.visibleItems.length, 1,
  24. "Only one item should now be visible in the calls list.");
  25. is(CallsListView.visibleItems[0].attachment.actor.type, CallWatcherFront.METHOD_FUNCTION,
  26. "The visible item's type has the expected value.");
  27. is(CallsListView.visibleItems[0].attachment.actor.name, "clearRect",
  28. "The visible item's name has the expected value.");
  29. is(CallsListView.visibleItems[0].attachment.actor.file, SIMPLE_CANVAS_URL,
  30. "The visible item's file has the expected value.");
  31. is(CallsListView.visibleItems[0].attachment.actor.line, 25,
  32. "The visible item's line has the expected value.");
  33. is(CallsListView.visibleItems[0].attachment.actor.argsPreview, "0, 0, 128, 128",
  34. "The visible item's args have the expected value.");
  35. is(CallsListView.visibleItems[0].attachment.actor.callerPreview, "Object",
  36. "The visible item's caller has the expected value.");
  37. let secondRecordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
  38. callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
  39. SnapshotsListView._onRecordButtonClick();
  40. yield secondRecordingFinished;
  41. SnapshotsListView.selectedIndex = 1;
  42. yield callListPopulated;
  43. is(searchbox.value, "clear",
  44. "The searchbox should still contain the 'clear' string.");
  45. is(CallsListView.visibleItems.length, 1,
  46. "Only one item should still be visible in the calls list.");
  47. for (let i = 0; i < 5; i++) {
  48. searchbox.focus();
  49. EventUtils.sendKey("BACK_SPACE", window);
  50. }
  51. is(searchbox.value, "",
  52. "The searchbox should now be emptied.");
  53. is(CallsListView.visibleItems.length, 8,
  54. "All the items should be initially visible again in the calls list.");
  55. yield teardown(panel);
  56. finish();
  57. }