browser_cmd_pref1.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /* Any copyright is dedicated to the Public Domain.
  2. * http://creativecommons.org/publicdomain/zero/1.0/ */
  3. // Tests that the pref commands work
  4. var prefBranch = Cc["@mozilla.org/preferences-service;1"]
  5. .getService(Ci.nsIPrefService).getBranch(null)
  6. .QueryInterface(Ci.nsIPrefBranch2);
  7. const TEST_URI = "data:text/html;charset=utf-8,gcli-pref1";
  8. function test() {
  9. return Task.spawn(spawnTest).then(finish, helpers.handleError);
  10. }
  11. function* spawnTest() {
  12. let options = yield helpers.openTab(TEST_URI);
  13. yield helpers.openToolbar(options);
  14. let netmonEnabledOrig = prefBranch.getBoolPref("devtools.netmonitor.enabled");
  15. info("originally: devtools.netmonitor.enabled = " + netmonEnabledOrig);
  16. yield helpers.audit(options, [
  17. {
  18. setup: "pref",
  19. check: {
  20. input: "pref",
  21. hints: " reset",
  22. markup: "IIII",
  23. status: "ERROR"
  24. },
  25. },
  26. {
  27. setup: "pref s",
  28. check: {
  29. input: "pref s",
  30. hints: "et",
  31. markup: "IIIIVI",
  32. status: "ERROR"
  33. },
  34. },
  35. {
  36. setup: "pref sh",
  37. check: {
  38. input: "pref sh",
  39. hints: "ow",
  40. markup: "IIIIVII",
  41. status: "ERROR"
  42. },
  43. },
  44. {
  45. setup: "pref show ",
  46. check: {
  47. input: "pref show ",
  48. markup: "VVVVVVVVVV",
  49. status: "ERROR"
  50. },
  51. },
  52. {
  53. setup: "pref show usetexttospeech",
  54. check: {
  55. input: "pref show usetexttospeech",
  56. hints: " -> accessibility.usetexttospeech",
  57. markup: "VVVVVVVVVVIIIIIIIIIIIIIII",
  58. status: "ERROR"
  59. },
  60. },
  61. {
  62. setup: "pref show devtools.netmoni",
  63. check: {
  64. input: "pref show devtools.netmoni",
  65. hints: "tor.enabled",
  66. markup: "VVVVVVVVVVIIIIIIIIIIIIIIII",
  67. status: "ERROR",
  68. tooltipState: "true:importantFieldFlag",
  69. args: {
  70. setting: { value: undefined, status: "INCOMPLETE" },
  71. }
  72. },
  73. },
  74. {
  75. setup: "pref reset devtools.netmonitor.enabled",
  76. check: {
  77. input: "pref reset devtools.netmonitor.enabled",
  78. hints: "",
  79. markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
  80. status: "VALID"
  81. },
  82. },
  83. {
  84. setup: "pref show devtools.netmonitor.enabled 4",
  85. check: {
  86. input: "pref show devtools.netmonitor.enabled 4",
  87. hints: "",
  88. markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE",
  89. status: "ERROR"
  90. },
  91. },
  92. {
  93. setup: "pref set devtools.netmonitor.enabled 4",
  94. check: {
  95. input: "pref set devtools.netmonitor.enabled 4",
  96. hints: "",
  97. markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVE",
  98. status: "ERROR",
  99. args: {
  100. setting: { arg: " devtools.netmonitor.enabled" },
  101. value: { status: "ERROR", message: "Can\u2019t use \u20184\u2019." },
  102. }
  103. },
  104. },
  105. {
  106. setup: "pref set devtools.editor.tabsize 4",
  107. check: {
  108. input: "pref set devtools.editor.tabsize 4",
  109. hints: "",
  110. markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",
  111. status: "VALID",
  112. args: {
  113. setting: { arg: " devtools.editor.tabsize" },
  114. value: { value: 4 },
  115. }
  116. },
  117. },
  118. {
  119. setup: "pref list",
  120. check: {
  121. input: "pref list",
  122. hints: " -> pref set",
  123. markup: "IIIIVIIII",
  124. status: "ERROR"
  125. },
  126. },
  127. {
  128. setup: "pref show devtools.netmonitor.enabled",
  129. check: {
  130. args: {
  131. setting: {
  132. value: options.requisition.system.settings.get("devtools.netmonitor.enabled")
  133. }
  134. },
  135. },
  136. exec: {
  137. output: "devtools.netmonitor.enabled: " + netmonEnabledOrig,
  138. },
  139. post: function () {
  140. prefBranch.setBoolPref("devtools.netmonitor.enabled", netmonEnabledOrig);
  141. }
  142. },
  143. ]);
  144. yield helpers.closeToolbar(options);
  145. yield helpers.closeTab(options);
  146. }