services/sync/tests/unit/test_notifications.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:03810a44b444
1 Cu.import("resource://services-sync/notifications.js");
2
3 function run_test() {
4 var logStats = initTestLogging("Info");
5
6 var blah = 0;
7
8 function callback(i) {
9 blah = i;
10 }
11
12 let button = new NotificationButton("label", "accessKey", callback);
13
14 button.callback(5);
15
16 do_check_eq(blah, 5);
17 do_check_eq(logStats.errorsLogged, 0);
18
19 function badCallback() {
20 throw new Error("oops");
21 }
22
23 button = new NotificationButton("label", "accessKey", badCallback);
24
25 try {
26 button.callback();
27 } catch (e) {
28 do_check_eq(e.message, "oops");
29 }
30
31 do_check_eq(logStats.errorsLogged, 1);
32 }

mercurial