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.

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

mercurial