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

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

Issue 11127037: Notifications: implemented better target checks - unit tests (Closed)
Patch Set: Better pair generation Created July 25, 2013, 11:11 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
@@ -203,25 +203,23 @@
registerHandler([information]);
testRunner.runScheduledTasks(1);
let expected = (result ? information : null);
deepEqual(Notification.getNextToShow(), expected, "Selected notification for " + JSON.stringify(information.targets));
deepEqual(Notification.getNextToShow(), null, "No notification on second call");
}
- function allPairs(array)
+ function pairs(array)
{
- var pairs = [];
- for (var i = 0; i < array.length - 1; i++)
- for (var j = i + 1; j < array.length; j++)
- pairs.push([array[i], array[j]]);
- return pairs;
+ for each (let element1 in array)
+ for each (let element2 in array)
+ yield [element1, element2];
}
- for each (let [[propName1, value1, result1], [propName2, value2, result2]] in allPairs(targets))
+ for (let [[propName1, value1, result1], [propName2, value2, result2]] in pairs(targets))
{
let targetInfo1 = {};
targetInfo1[propName1] = value1;
let targetInfo2 = {};
targetInfo2[propName2] = value2;
let information = fixConstructors({
id: 1,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld