browser/devtools/commandline/test/browser_cmd_calllog_chrome.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2 * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 // Tests that the calllog commands works as they should
     6 const TEST_URI = "data:text/html;charset=utf-8,cmd-calllog-chrome";
     8 let tests = {};
    10 function test() {
    11   return Task.spawn(function() {
    12     let options = yield helpers.openTab(TEST_URI);
    13     yield helpers.openToolbar(options);
    15     yield helpers.runTests(options, tests);
    17     yield helpers.closeToolbar(options);
    18     yield helpers.closeTab(options);
    19   }).then(finish, helpers.handleError);
    20 }
    22 tests.testCallLogStatus = function(options) {
    23   return helpers.audit(options, [
    24     {
    25       setup: "calllog",
    26       check: {
    27         status: "ERROR",
    28         emptyParameters: [ " " ]
    29       }
    30     },
    31     {
    32       setup: "calllog chromestop",
    33       check: {
    34         status: "VALID",
    35         emptyParameters: [ " " ]
    36       }
    37     },
    38     {
    39       setup: "calllog chromestart content-variable window",
    40       check: {
    41         status: "VALID",
    42         emptyParameters: [ " " ]
    43       }
    44     },
    45     {
    46       setup: "calllog chromestart javascript \"({a1: function() {this.a2()},a2: function() {}});\"",
    47       check: {
    48         status: "VALID",
    49         emptyParameters: [ " " ]
    50       }
    51     },
    52   ]);
    53 };
    55 tests.testCallLogExec = function(options) {
    56   let deferred = promise.defer();
    58   function onWebConsoleOpen(subject) {
    59     Services.obs.removeObserver(onWebConsoleOpen, "web-console-created");
    61     subject.QueryInterface(Ci.nsISupportsString);
    62     let hud = HUDService.getHudReferenceById(subject.data);
    63     ok(hud, "console open");
    65     helpers.audit(options, [
    66       {
    67         setup: "calllog chromestop",
    68         exec: {
    69           output: /Stopped call logging/,
    70         }
    71       },
    72       {
    73         setup: "calllog chromestart javascript XXX",
    74         exec: {
    75           output: /following exception/,
    76         }
    77       },
    78       {
    79         setup: "console clear",
    80         exec: {
    81           output: '',
    82         },
    83         post: function() {
    84           let labels = hud.jsterm.outputNode.querySelectorAll(".webconsole-msg-output");
    85           is(labels.length, 0, "no output in console");
    86         }
    87       },
    88       {
    89         setup: "console close",
    90         exec: {
    91           output: '',
    92         },
    93       },
    94     ]).then(function() {
    95       deferred.resolve();
    96     });
    97   }
    98   Services.obs.addObserver(onWebConsoleOpen, "web-console-created", false);
   100   helpers.audit(options, [
   101     {
   102       setup: "calllog chromestop",
   103       exec: {
   104         output: /No call logging/
   105       }
   106     },
   107     {
   108       setup: "calllog chromestart javascript \"({a1: function() {this.a2()},a2: function() {}});\"",
   109       exec: {
   110         output: /Call logging started/,
   111       }
   112     },
   113   ]);
   115   return deferred.promise;
   116 };

mercurial