test_profiler_getfeatures.js 897 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. "use strict";
  4. /**
  5. * Tests whether the profiler responds to "getFeatures" adequately.
  6. */
  7. const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler);
  8. function run_test()
  9. {
  10. get_chrome_actors((client, form) => {
  11. let actor = form.profilerActor;
  12. test_getfeatures(client, actor, () => {
  13. client.close().then(() => {
  14. do_test_finished();
  15. });
  16. });
  17. });
  18. do_test_pending();
  19. }
  20. function test_getfeatures(client, actor, callback)
  21. {
  22. client.request({ to: actor, type: "getFeatures" }, response => {
  23. do_check_eq(typeof response.features, "object");
  24. do_check_true(response.features.length >= 1);
  25. do_check_eq(typeof response.features[0], "string");
  26. do_check_true(response.features.indexOf("js") != -1);
  27. callback();
  28. });
  29. }