Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/tests/notification.js

Issue 5654617534758912: Issue 2237 - Added unit tests for notification opt-out (Closed)
Patch Set: Created April 13, 2015, 3:55 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/tests/notification.js
===================================================================
--- a/chrome/content/tests/notification.js
+++ b/chrome/content/tests/notification.js
@@ -33,6 +33,7 @@
Prefs.notificationurl = "http://example.com/notification.json";
Prefs.notificationdata = {};
+ Prefs.notifications_ignoredcategories = [];
// Replace Math.random() function
let DownloaderGlobal = Cu.getGlobalForObject(getModuleGlobal("downloader"));
@@ -376,6 +377,35 @@
deepEqual(Notification.getNextToShow("http://www.example.com"), subdomainURLFilter, "URL-specific notification matches subdomain");
});
+ test("Global opt-out", function()
+ {
+ Prefs.notifications_showui = false;
+
+ Notification.toggleIgnoreCategory("*", true);
+
+ ok(Prefs.notifications_showui, "Opt-out UI will be shown after opt-out");
+
+ let information = fixConstructors({
+ id: 1,
+ type: "information"
+ });
+ let critical = fixConstructors({
+ id: 2,
+ type: "critical"
+ });
+
+ registerHandler([information]);
+ testRunner.runScheduledTasks(1);
+
+ deepEqual(Notification.getNextToShow(), null, "Information notifications are ignored");
+
+ Prefs.notificationdata = {};
+ registerHandler([critical]);
+ testRunner.runScheduledTasks(1);
+
+ deepEqual(Notification.getNextToShow(), critical, "Critical notifications are not ignored");
Wladimir Palant 2015/05/26 11:23:19 This test is incomplete. Following scenarios need
Thomas Greiner 2015/05/28 13:24:18 Done, thanks for the additions. Note that the exi
+ });
+
module("Notification localization");
test("Message without localization", function()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld