michael@0: Cu.import("resource://services-sync/notifications.js"); michael@0: michael@0: function run_test() { michael@0: var logStats = initTestLogging("Info"); michael@0: michael@0: var blah = 0; michael@0: michael@0: function callback(i) { michael@0: blah = i; michael@0: } michael@0: michael@0: let button = new NotificationButton("label", "accessKey", callback); michael@0: michael@0: button.callback(5); michael@0: michael@0: do_check_eq(blah, 5); michael@0: do_check_eq(logStats.errorsLogged, 0); michael@0: michael@0: function badCallback() { michael@0: throw new Error("oops"); michael@0: } michael@0: michael@0: button = new NotificationButton("label", "accessKey", badCallback); michael@0: michael@0: try { michael@0: button.callback(); michael@0: } catch (e) { michael@0: do_check_eq(e.message, "oops"); michael@0: } michael@0: michael@0: do_check_eq(logStats.errorsLogged, 1); michael@0: }