browser_cmd_inject.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* Any copyright is dedicated to the Public Domain.
  2. * http://creativecommons.org/publicdomain/zero/1.0/ */
  3. // Tests that the inject commands works as they should
  4. const TEST_URI = "http://example.com/browser/devtools/client/commandline/" +
  5. "test/browser_cmd_inject.html";
  6. function test() {
  7. helpers.addTabWithToolbar(TEST_URI, function (options) {
  8. return helpers.audit(options, [
  9. {
  10. setup: "inject",
  11. check: {
  12. input: "inject",
  13. markup: "VVVVVV",
  14. hints: " <library>",
  15. status: "ERROR"
  16. },
  17. },
  18. {
  19. setup: "inject j",
  20. check: {
  21. input: "inject j",
  22. markup: "VVVVVVVI",
  23. hints: "Query",
  24. status: "ERROR"
  25. },
  26. },
  27. {
  28. setup: "inject notauri",
  29. check: {
  30. input: "inject notauri",
  31. hints: " -> http://notauri/",
  32. markup: "VVVVVVVIIIIIII",
  33. status: "ERROR",
  34. args: {
  35. library: {
  36. value: undefined,
  37. status: "INCOMPLETE"
  38. }
  39. }
  40. }
  41. },
  42. {
  43. setup: "inject http://example.com/browser/devtools/client/commandline/test/browser_cmd_inject.js",
  44. check: {
  45. input: "inject http://example.com/browser/devtools/client/commandline/test/browser_cmd_inject.js",
  46. markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
  47. hints: "",
  48. status: "VALID",
  49. args: {
  50. library: {
  51. value: function (library) {
  52. is(library.type, "url", "inject type name");
  53. is(library.url.origin, "http://example.com", "inject url hostname");
  54. ok(library.url.pathname.indexOf("_inject.js") != -1, "inject url path");
  55. },
  56. status: "VALID"
  57. }
  58. }
  59. },
  60. exec: {
  61. output: [ /http:\/\/example.com\/browser\/devtools\/client\/commandline\/test\/browser_cmd_inject.js loaded/ ]
  62. }
  63. }
  64. ]);
  65. }).then(finish, helpers.handleError);
  66. }