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

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

Issue 29321051: Issue 2715 - Speed up notification target tests (Closed)
Patch Set: Created June 24, 2015, 7:06 a.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
@@ -223,13 +223,33 @@
deepEqual(showNotifications(), expected, "Selected notification for " + JSON.stringify(information.targets));
deepEqual(showNotifications(), [], "No notification on second call");
}
+ });
+
+ test("Multiple targets", function()
+ {
+ let targets = [
+ ["extension", "adblockpluschrome", true],
+ ["extension", "adblockplus", false],
+ ["extensionMinVersion", "1.4", true],
+ ["extensionMinVersion", "1.5", false],
+ ["application", "chrome", true],
+ ["application", "firefox", false],
+ ["applicationMinVersion", "27", true],
+ ["applicationMinVersion", "28", false],
+ ["platform", "chromium", true],
+ ["platform", "gecko", false],
+ ["platformMinVersion", "12", true],
+ ["platformMinVersion", "13", false],
+ ];
function pairs(array)
{
for (let element1 of array)
for (let element2 of array)
- yield [element1, element2];
+ if (element1 != element2)
+ yield [element1, element2];
}
+
for (let [[propName1, value1, result1], [propName2, value2, result2]] in pairs(targets))
{
let targetInfo1 = {};
@@ -250,27 +270,6 @@
let expected = (result1 || result2 ? [information] : [])
deepEqual(showNotifications(), expected, "Selected notification for " + JSON.stringify(information.targets));
- deepEqual(showNotifications(), [], "No notification on second call");
-
- information = fixConstructors({
- id: 1,
- type: "information",
- message: {"en-US": "Information"},
- targets: [targetInfo1]
- });
- let critical = fixConstructors({
- id: 2,
- type: "critical",
- message: {"en-US": "Critical"},
- targets: [targetInfo2]
- });
-
- Prefs.notificationdata = {};
- registerHandler([information, critical]);
- testRunner.runScheduledTasks(1);
-
- expected = (result2 ? [critical] : (result1 ? [information] : []));
- deepEqual(showNotifications(), expected, "Selected notification for information with " + JSON.stringify(information.targets) + " and critical with " + JSON.stringify(critical.targets));
}
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld