browser_responsive_cmd.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /* Any copyright is dedicated to the Public Domain.
  2. * http://creativecommons.org/publicdomain/zero/1.0/ */
  3. "use strict";
  4. //
  5. // Whitelisting this test.
  6. // As part of bug 1077403, the leaking uncaught rejection should be fixed.
  7. //
  8. thisTestLeaksUncaughtRejectionsAndShouldBeFixed("destroy");
  9. function test() {
  10. let manager = ResponsiveUIManager;
  11. let done;
  12. function isOpen() {
  13. return gBrowser.getBrowserContainer(gBrowser.selectedBrowser)
  14. .hasAttribute("responsivemode");
  15. }
  16. helpers.addTabWithToolbar("data:text/html;charset=utf-8,hi", (options) => {
  17. return helpers.audit(options, [
  18. {
  19. setup() {
  20. done = once(manager, "on");
  21. return helpers.setInput(options, "resize toggle");
  22. },
  23. check: {
  24. input: "resize toggle",
  25. hints: "",
  26. markup: "VVVVVVVVVVVVV",
  27. status: "VALID"
  28. },
  29. exec: {
  30. output: ""
  31. },
  32. post: Task.async(function* () {
  33. yield done;
  34. ok(isOpen(), "responsive mode is open");
  35. }),
  36. },
  37. {
  38. setup() {
  39. done = once(manager, "off");
  40. return helpers.setInput(options, "resize toggle");
  41. },
  42. check: {
  43. input: "resize toggle",
  44. hints: "",
  45. markup: "VVVVVVVVVVVVV",
  46. status: "VALID"
  47. },
  48. exec: {
  49. output: ""
  50. },
  51. post: Task.async(function* () {
  52. yield done;
  53. ok(!isOpen(), "responsive mode is closed");
  54. }),
  55. },
  56. {
  57. setup() {
  58. done = once(manager, "on");
  59. return helpers.setInput(options, "resize on");
  60. },
  61. check: {
  62. input: "resize on",
  63. hints: "",
  64. markup: "VVVVVVVVV",
  65. status: "VALID"
  66. },
  67. exec: {
  68. output: ""
  69. },
  70. post: Task.async(function* () {
  71. yield done;
  72. ok(isOpen(), "responsive mode is open");
  73. }),
  74. },
  75. {
  76. setup() {
  77. done = once(manager, "off");
  78. return helpers.setInput(options, "resize off");
  79. },
  80. check: {
  81. input: "resize off",
  82. hints: "",
  83. markup: "VVVVVVVVVV",
  84. status: "VALID"
  85. },
  86. exec: {
  87. output: ""
  88. },
  89. post: Task.async(function* () {
  90. yield done;
  91. ok(!isOpen(), "responsive mode is closed");
  92. }),
  93. },
  94. {
  95. setup() {
  96. done = once(manager, "on");
  97. return helpers.setInput(options, "resize to 400 400");
  98. },
  99. check: {
  100. input: "resize to 400 400",
  101. hints: "",
  102. markup: "VVVVVVVVVVVVVVVVV",
  103. status: "VALID",
  104. args: {
  105. width: { value: 400 },
  106. height: { value: 400 },
  107. }
  108. },
  109. exec: {
  110. output: ""
  111. },
  112. post: Task.async(function* () {
  113. yield done;
  114. ok(isOpen(), "responsive mode is open");
  115. }),
  116. },
  117. {
  118. setup() {
  119. done = once(manager, "off");
  120. return helpers.setInput(options, "resize off");
  121. },
  122. check: {
  123. input: "resize off",
  124. hints: "",
  125. markup: "VVVVVVVVVV",
  126. status: "VALID"
  127. },
  128. exec: {
  129. output: ""
  130. },
  131. post: Task.async(function* () {
  132. yield done;
  133. ok(!isOpen(), "responsive mode is closed");
  134. }),
  135. },
  136. ]);
  137. }).then(finish);
  138. }