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

Side by Side Diff: chrome/content/tests/notification.js

Issue 4848713646211072: Issue 537 - Consider changes made for marking first few downloads (Closed)
Patch Set: Created Nov. 11, 2014, 6:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 (function() 1 (function()
2 { 2 {
3 let testRunner = null; 3 let testRunner = null;
4 let randomResult = 0.5; 4 let randomResult = 0.5;
5 5
6 let originalInfo; 6 let originalInfo;
7 let info = require("info"); 7 let info = require("info");
8 8
9 module("Notification handling", 9 module("Notification handling",
10 { 10 {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 }; 257 };
258 258
259 let parameters = null; 259 let parameters = null;
260 registerHandler([], function(metadata) 260 registerHandler([], function(metadata)
261 { 261 {
262 parameters = decodeURI(metadata.queryString); 262 parameters = decodeURI(metadata.queryString);
263 }); 263 });
264 testRunner.runScheduledTasks(1); 264 testRunner.runScheduledTasks(1);
265 265
266 equal(parameters, 266 equal(parameters,
267 "addonName=adblockpluschrome&addonVersion=1.4.1&application=chrome&app licationVersion=27.0&platform=chromium&platformVersion=12.0&lastVersion=3", 267 "addonName=adblockpluschrome&addonVersion=1.4.1&application=chrome&app licationVersion=27.0&platform=chromium&platformVersion=12.0&lastVersion=3&downlo adCount=0",
268 "The correct parameters are sent to the server"); 268 "The correct parameters are sent to the server");
269 }); 269 });
270 270
271 test("Expiration interval", function() 271 test("Expiration interval", function()
272 { 272 {
273 let tests = [ 273 let tests = [
274 { 274 {
275 randomResult: 0.5, 275 randomResult: 0.5,
276 requests: [0.2, 24.2, 48.2] 276 requests: [0.2, 24.2, 48.2]
277 }, 277 },
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 let notification = Prefs.notificationdata.data.notifications[0]; 334 let notification = Prefs.notificationdata.data.notifications[0];
335 ok(!("severity" in notification), "Severity property was removed"); 335 ok(!("severity" in notification), "Severity property was removed");
336 ok("type" in notification, "Type property was added"); 336 ok("type" in notification, "Type property was added");
337 equal(notification.type, severityNotification.severity, "Type property has correct value"); 337 equal(notification.type, severityNotification.severity, "Type property has correct value");
338 } 338 }
339 Prefs.addListener(listener); 339 Prefs.addListener(listener);
340 340
341 let responseText = JSON.stringify({ 341 let responseText = JSON.stringify({
342 notifications: [severityNotification] 342 notifications: [severityNotification]
343 }); 343 });
344 Notification._onDownloadSuccess(null, responseText, function() {}, function( ) {}); 344 Notification._onDownloadSuccess({}, responseText, function() {}, function() {});
345 }); 345 });
346 346
347 test("URL-specific notification", function() 347 test("URL-specific notification", function()
348 { 348 {
349 let withURLFilterFoo = fixConstructors({ 349 let withURLFilterFoo = fixConstructors({
350 id: 1, 350 id: 1,
351 urlFilters: ["foo.com"] 351 urlFilters: ["foo.com"]
352 }); 352 });
353 let withoutURLFilter = fixConstructors({ 353 let withoutURLFilter = fixConstructors({
354 id: 2 354 id: 2
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 equal(texts.message, "fr"); 403 equal(texts.message, "fr");
404 }); 404 });
405 405
406 test("Missing translation", function() 406 test("Missing translation", function()
407 { 407 {
408 let notification = {message: {"en-US": "en-US"}}; 408 let notification = {message: {"en-US": "en-US"}};
409 let texts = Notification.getLocalizedTexts(notification, "fr"); 409 let texts = Notification.getLocalizedTexts(notification, "fr");
410 equal(texts.message, "en-US"); 410 equal(texts.message, "en-US");
411 }); 411 });
412 })(); 412 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld