browser_cmd_media.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* Any copyright is dedicated to the Public Domain.
  2. * http://creativecommons.org/publicdomain/zero/1.0/ */
  3. // Test that screenshot command works properly
  4. const TEST_URI = "http://example.com/browser/devtools/client/commandline/" +
  5. "test/browser_cmd_media.html";
  6. var tests = {
  7. testInput: function (options) {
  8. return helpers.audit(options, [
  9. {
  10. setup: "media emulate braille",
  11. check: {
  12. input: "media emulate braille",
  13. markup: "VVVVVVVVVVVVVVVVVVVVV",
  14. status: "VALID",
  15. args: {
  16. type: { value: "braille"},
  17. }
  18. },
  19. },
  20. {
  21. setup: "media reset",
  22. check: {
  23. input: "media reset",
  24. markup: "VVVVVVVVVVV",
  25. status: "VALID",
  26. args: {
  27. }
  28. },
  29. },
  30. ]);
  31. },
  32. testEmulateMedia: function (options) {
  33. return helpers.audit(options, [
  34. {
  35. setup: "media emulate braille",
  36. check: {
  37. args: {
  38. type: { value: "braille"}
  39. }
  40. },
  41. exec: {
  42. output: ""
  43. },
  44. post: Task.async(function* () {
  45. yield ContentTask.spawn(options.browser, {}, function* () {
  46. let color = content.getComputedStyle(content.document.body).backgroundColor;
  47. is(color, "rgb(255, 255, 0)", "media correctly emulated");
  48. });
  49. })
  50. }
  51. ]);
  52. },
  53. testEndMediaEmulation: function (options) {
  54. return helpers.audit(options, [
  55. {
  56. setup: function () {
  57. let mDV = options.browser.markupDocumentViewer;
  58. mDV.emulateMedium("embossed");
  59. return helpers.setInput(options, "media reset");
  60. },
  61. exec: {
  62. output: ""
  63. },
  64. post: Task.async(function* () {
  65. yield ContentTask.spawn(options.browser, {}, function* () {
  66. let color = content.getComputedStyle(content.document.body).backgroundColor;
  67. is(color, "rgb(255, 255, 255)", "media reset");
  68. });
  69. })
  70. }
  71. ]);
  72. }
  73. };
  74. function test() {
  75. return Task.spawn(function* () {
  76. let options = yield helpers.openTab(TEST_URI);
  77. yield helpers.openToolbar(options);
  78. yield helpers.runTests(options, tests);
  79. yield helpers.closeToolbar(options);
  80. yield helpers.closeTab(options);
  81. }).then(finish, helpers.handleError);
  82. }