browser_cmd_cookie.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /* Any copyright is dedicated to the Public Domain.
  2. * http://creativecommons.org/publicdomain/zero/1.0/ */
  3. // Tests that the cookie commands works as they should
  4. const TEST_URI = "http://example.com/browser/devtools/client/commandline/" +
  5. "test/browser_cmd_cookie.html";
  6. function test() {
  7. helpers.addTabWithToolbar(TEST_URI, function (options) {
  8. return helpers.audit(options, [
  9. {
  10. setup: "cookie",
  11. check: {
  12. input: "cookie",
  13. hints: " list",
  14. markup: "IIIIII",
  15. status: "ERROR"
  16. },
  17. },
  18. {
  19. setup: "cookie lis",
  20. check: {
  21. input: "cookie lis",
  22. hints: "t",
  23. markup: "IIIIIIVIII",
  24. status: "ERROR"
  25. },
  26. },
  27. {
  28. setup: "cookie list",
  29. check: {
  30. input: "cookie list",
  31. hints: "",
  32. markup: "VVVVVVVVVVV",
  33. status: "VALID"
  34. },
  35. },
  36. {
  37. setup: "cookie remove",
  38. check: {
  39. input: "cookie remove",
  40. hints: " <name>",
  41. markup: "VVVVVVVVVVVVV",
  42. status: "ERROR"
  43. },
  44. },
  45. {
  46. setup: "cookie set",
  47. check: {
  48. input: "cookie set",
  49. hints: " <name> <value> [options]",
  50. markup: "VVVVVVVVVV",
  51. status: "ERROR"
  52. },
  53. },
  54. {
  55. setup: "cookie set fruit",
  56. check: {
  57. input: "cookie set fruit",
  58. hints: " <value> [options]",
  59. markup: "VVVVVVVVVVVVVVVV",
  60. status: "ERROR"
  61. },
  62. },
  63. {
  64. setup: "cookie set fruit ban",
  65. check: {
  66. input: "cookie set fruit ban",
  67. hints: " [options]",
  68. markup: "VVVVVVVVVVVVVVVVVVVV",
  69. status: "VALID",
  70. args: {
  71. name: { value: "fruit" },
  72. value: { value: "ban" },
  73. secure: { value: false },
  74. }
  75. },
  76. },
  77. {
  78. setup: 'cookie set fruit ban --path ""',
  79. check: {
  80. input: 'cookie set fruit ban --path ""',
  81. hints: " [options]",
  82. markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
  83. status: "VALID",
  84. args: {
  85. name: { value: "fruit" },
  86. value: { value: "ban" },
  87. path: { value: "" },
  88. secure: { value: false },
  89. }
  90. },
  91. },
  92. {
  93. setup: "cookie list",
  94. exec: {
  95. output: [ /zap=zep/, /zip=zop/, /Edit/ ]
  96. }
  97. },
  98. {
  99. setup: "cookie set zup banana",
  100. check: {
  101. args: {
  102. name: { value: "zup" },
  103. value: { value: "banana" },
  104. }
  105. },
  106. exec: {
  107. output: ""
  108. }
  109. },
  110. {
  111. setup: "cookie list",
  112. exec: {
  113. output: [ /zap=zep/, /zip=zop/, /zup=banana/, /Edit/ ]
  114. }
  115. },
  116. {
  117. setup: "cookie remove zip",
  118. exec: { },
  119. },
  120. {
  121. setup: "cookie list",
  122. exec: {
  123. output: [ /zap=zep/, /zup=banana/, /Edit/ ]
  124. },
  125. post: function (output, text) {
  126. ok(!text.includes("zip"), "");
  127. ok(!text.includes("zop"), "");
  128. }
  129. },
  130. {
  131. setup: "cookie remove zap",
  132. exec: { },
  133. },
  134. {
  135. setup: "cookie list",
  136. exec: {
  137. output: [ /zup=banana/, /Edit/ ]
  138. },
  139. post: function (output, text) {
  140. ok(!text.includes("zap"), "");
  141. ok(!text.includes("zep"), "");
  142. ok(!text.includes("zip"), "");
  143. ok(!text.includes("zop"), "");
  144. }
  145. },
  146. {
  147. setup: "cookie remove zup",
  148. exec: { }
  149. },
  150. {
  151. setup: "cookie list",
  152. exec: {
  153. output: "No cookies found for host example.com"
  154. },
  155. post: function (output, text) {
  156. ok(!text.includes("zap"), "");
  157. ok(!text.includes("zep"), "");
  158. ok(!text.includes("zip"), "");
  159. ok(!text.includes("zop"), "");
  160. ok(!text.includes("zup"), "");
  161. ok(!text.includes("banana"), "");
  162. ok(!text.includes("Edit"), "");
  163. }
  164. },
  165. ]);
  166. }).then(finish, helpers.handleError);
  167. }