browser/devtools/commandline/test/browser_cmd_media.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial