1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/services/sync/tests/unit/test_notifications.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,32 @@ 1.4 +Cu.import("resource://services-sync/notifications.js"); 1.5 + 1.6 +function run_test() { 1.7 + var logStats = initTestLogging("Info"); 1.8 + 1.9 + var blah = 0; 1.10 + 1.11 + function callback(i) { 1.12 + blah = i; 1.13 + } 1.14 + 1.15 + let button = new NotificationButton("label", "accessKey", callback); 1.16 + 1.17 + button.callback(5); 1.18 + 1.19 + do_check_eq(blah, 5); 1.20 + do_check_eq(logStats.errorsLogged, 0); 1.21 + 1.22 + function badCallback() { 1.23 + throw new Error("oops"); 1.24 + } 1.25 + 1.26 + button = new NotificationButton("label", "accessKey", badCallback); 1.27 + 1.28 + try { 1.29 + button.callback(); 1.30 + } catch (e) { 1.31 + do_check_eq(e.message, "oops"); 1.32 + } 1.33 + 1.34 + do_check_eq(logStats.errorsLogged, 1); 1.35 +}