1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/commandline/test/browser_cmd_media.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,86 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +// Test that screenshot command works properly 1.8 +const TEST_URI = "http://example.com/browser/browser/devtools/commandline/" + 1.9 + "test/browser_cmd_media.html"; 1.10 +let tests = { 1.11 + testInput: function(options) { 1.12 + return helpers.audit(options, [ 1.13 + { 1.14 + setup: "media emulate braille", 1.15 + check: { 1.16 + input: "media emulate braille", 1.17 + markup: "VVVVVVVVVVVVVVVVVVVVV", 1.18 + status: "VALID", 1.19 + args: { 1.20 + type: { value: "braille"}, 1.21 + } 1.22 + }, 1.23 + }, 1.24 + { 1.25 + setup: "media reset", 1.26 + check: { 1.27 + input: "media reset", 1.28 + markup: "VVVVVVVVVVV", 1.29 + status: "VALID", 1.30 + args: { 1.31 + } 1.32 + }, 1.33 + }, 1.34 + ]); 1.35 + }, 1.36 + 1.37 + testEmulateMedia: function(options) { 1.38 + return helpers.audit(options, [ 1.39 + { 1.40 + setup: "media emulate braille", 1.41 + check: { 1.42 + args: { 1.43 + type: { value: "braille"} 1.44 + } 1.45 + }, 1.46 + exec: { 1.47 + output: "" 1.48 + }, 1.49 + post: function() { 1.50 + let body = options.window.document.body; 1.51 + let style = options.window.getComputedStyle(body); 1.52 + is(style.backgroundColor, "rgb(255, 255, 0)", "media correctly emulated"); 1.53 + } 1.54 + } 1.55 + ]); 1.56 + }, 1.57 + 1.58 + testEndMediaEmulation: function(options) { 1.59 + return helpers.audit(options, [ 1.60 + { 1.61 + setup: function() { 1.62 + let mDV = options.browser.markupDocumentViewer; 1.63 + mDV.emulateMedium("embossed"); 1.64 + return helpers.setInput(options, "media reset"); 1.65 + }, 1.66 + exec: { 1.67 + output: "" 1.68 + }, 1.69 + post: function() { 1.70 + let body = options.window.document.body; 1.71 + let style = options.window.getComputedStyle(body); 1.72 + is(style.backgroundColor, "rgb(255, 255, 255)", "media reset"); 1.73 + } 1.74 + } 1.75 + ]); 1.76 + } 1.77 +}; 1.78 + 1.79 +function test() { 1.80 + return Task.spawn(function() { 1.81 + let options = yield helpers.openTab(TEST_URI); 1.82 + yield helpers.openToolbar(options); 1.83 + 1.84 + yield helpers.runTests(options, tests); 1.85 + 1.86 + yield helpers.closeToolbar(options); 1.87 + yield helpers.closeTab(options); 1.88 + }).then(finish, helpers.handleError); 1.89 +}