Wed, 31 Dec 2014 06:09:35 +0100
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 | // Tests that the calllog commands works as they should |
michael@0 | 5 | |
michael@0 | 6 | const TEST_URI = "data:text/html;charset=utf-8,gcli-calllog"; |
michael@0 | 7 | |
michael@0 | 8 | let tests = {}; |
michael@0 | 9 | |
michael@0 | 10 | function test() { |
michael@0 | 11 | return Task.spawn(function() { |
michael@0 | 12 | let options = yield helpers.openTab(TEST_URI); |
michael@0 | 13 | yield helpers.openToolbar(options); |
michael@0 | 14 | |
michael@0 | 15 | yield helpers.runTests(options, tests); |
michael@0 | 16 | |
michael@0 | 17 | yield helpers.closeToolbar(options); |
michael@0 | 18 | yield helpers.closeTab(options); |
michael@0 | 19 | }).then(finish, helpers.handleError); |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | tests.testCallLogStatus = function(options) { |
michael@0 | 23 | return helpers.audit(options, [ |
michael@0 | 24 | { |
michael@0 | 25 | setup: "calllog", |
michael@0 | 26 | check: { |
michael@0 | 27 | input: 'calllog', |
michael@0 | 28 | hints: '', |
michael@0 | 29 | markup: 'IIIIIII', |
michael@0 | 30 | status: 'ERROR' |
michael@0 | 31 | } |
michael@0 | 32 | }, |
michael@0 | 33 | { |
michael@0 | 34 | setup: "calllog start", |
michael@0 | 35 | check: { |
michael@0 | 36 | input: 'calllog start', |
michael@0 | 37 | hints: '', |
michael@0 | 38 | markup: 'VVVVVVVVVVVVV', |
michael@0 | 39 | status: 'VALID' |
michael@0 | 40 | } |
michael@0 | 41 | }, |
michael@0 | 42 | { |
michael@0 | 43 | setup: "calllog stop", |
michael@0 | 44 | check: { |
michael@0 | 45 | input: 'calllog stop', |
michael@0 | 46 | hints: '', |
michael@0 | 47 | markup: 'VVVVVVVVVVVV', |
michael@0 | 48 | status: 'VALID' |
michael@0 | 49 | } |
michael@0 | 50 | }, |
michael@0 | 51 | ]); |
michael@0 | 52 | }; |
michael@0 | 53 | |
michael@0 | 54 | tests.testCallLogExec = function(options) { |
michael@0 | 55 | var deferred = promise.defer(); |
michael@0 | 56 | |
michael@0 | 57 | var onWebConsoleOpen = function(subject) { |
michael@0 | 58 | Services.obs.removeObserver(onWebConsoleOpen, "web-console-created"); |
michael@0 | 59 | |
michael@0 | 60 | subject.QueryInterface(Ci.nsISupportsString); |
michael@0 | 61 | let hud = HUDService.getHudReferenceById(subject.data); |
michael@0 | 62 | ok(hud, "console open"); |
michael@0 | 63 | |
michael@0 | 64 | helpers.audit(options, [ |
michael@0 | 65 | { |
michael@0 | 66 | setup: "calllog stop", |
michael@0 | 67 | exec: { |
michael@0 | 68 | output: /Stopped call logging/, |
michael@0 | 69 | } |
michael@0 | 70 | }, |
michael@0 | 71 | { |
michael@0 | 72 | setup: "console clear", |
michael@0 | 73 | exec: { |
michael@0 | 74 | output: "", |
michael@0 | 75 | }, |
michael@0 | 76 | post: function() { |
michael@0 | 77 | let labels = hud.outputNode.querySelectorAll(".webconsole-msg-output"); |
michael@0 | 78 | is(labels.length, 0, "no output in console"); |
michael@0 | 79 | } |
michael@0 | 80 | }, |
michael@0 | 81 | { |
michael@0 | 82 | setup: "console close", |
michael@0 | 83 | exec: { |
michael@0 | 84 | output: "", |
michael@0 | 85 | } |
michael@0 | 86 | }, |
michael@0 | 87 | ]).then(function() { |
michael@0 | 88 | deferred.resolve(); |
michael@0 | 89 | }); |
michael@0 | 90 | }; |
michael@0 | 91 | Services.obs.addObserver(onWebConsoleOpen, "web-console-created", false); |
michael@0 | 92 | |
michael@0 | 93 | helpers.audit(options, [ |
michael@0 | 94 | { |
michael@0 | 95 | setup: "calllog stop", |
michael@0 | 96 | exec: { |
michael@0 | 97 | output: /No call logging/, |
michael@0 | 98 | } |
michael@0 | 99 | }, |
michael@0 | 100 | { |
michael@0 | 101 | name: "calllog start", |
michael@0 | 102 | setup: function() { |
michael@0 | 103 | // This test wants to be in a different event |
michael@0 | 104 | var deferred = promise.defer(); |
michael@0 | 105 | executeSoon(function() { |
michael@0 | 106 | helpers.setInput(options, "calllog start").then(() => { |
michael@0 | 107 | deferred.resolve(); |
michael@0 | 108 | }); |
michael@0 | 109 | }); |
michael@0 | 110 | return deferred.promise; |
michael@0 | 111 | }, |
michael@0 | 112 | exec: { |
michael@0 | 113 | output: /Call logging started/, |
michael@0 | 114 | }, |
michael@0 | 115 | }, |
michael@0 | 116 | ]); |
michael@0 | 117 | |
michael@0 | 118 | return deferred.promise; |
michael@0 | 119 | }; |