services/sync/tests/unit/test_notifications.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 Cu.import("resource://services-sync/notifications.js");
     3 function run_test() {
     4   var logStats = initTestLogging("Info");
     6   var blah = 0;
     8   function callback(i) {
     9     blah = i;
    10   }
    12   let button = new NotificationButton("label", "accessKey", callback);
    14   button.callback(5);
    16   do_check_eq(blah, 5);
    17   do_check_eq(logStats.errorsLogged, 0);
    19   function badCallback() {
    20     throw new Error("oops");
    21   }
    23   button = new NotificationButton("label", "accessKey", badCallback);
    25   try {
    26     button.callback();
    27   } catch (e) {
    28     do_check_eq(e.message, "oops");
    29   }
    31   do_check_eq(logStats.errorsLogged, 1);
    32 }

mercurial