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

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

Issue 6309214725079040: Issue 1409 - Fix some errors in adblockplustest (Closed)
Patch Set: Created Sept. 19, 2014, 10:35 a.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 | « chrome/content/httpd.js ('k') | chrome/content/tests/matcher.js » ('j') | 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 module("Filter storage", { 3 module("Filter storage", {
4 setup: function() 4 setup: function()
5 { 5 {
6 prepareFilterComponents.call(this); 6 prepareFilterComponents.call(this);
7 preparePrefs.call(this); 7 preparePrefs.call(this);
8 Prefs.savestats = true; 8 Prefs.savestats = true;
9 }, 9 },
10 teardown: function() 10 teardown: function()
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 let filter1 = Filter.fromText("filter1"); 362 let filter1 = Filter.fromText("filter1");
363 let filter2 = Filter.fromText("filter2"); 363 let filter2 = Filter.fromText("filter2");
364 364
365 FilterStorage.addFilter(filter1); 365 FilterStorage.addFilter(filter1);
366 366
367 equal(filter1.hitCount, 0, "filter1 initial hit count"); 367 equal(filter1.hitCount, 0, "filter1 initial hit count");
368 equal(filter2.hitCount, 0, "filter2 initial hit count"); 368 equal(filter2.hitCount, 0, "filter2 initial hit count");
369 equal(filter1.lastHit, 0, "filter1 initial last hit"); 369 equal(filter1.lastHit, 0, "filter1 initial last hit");
370 equal(filter2.lastHit, 0, "filter2 initial last hit"); 370 equal(filter2.lastHit, 0, "filter2 initial last hit");
371 371
372 let changes = []; 372 changes = [];
373 FilterStorage.increaseHitCount(filter1); 373 FilterStorage.increaseHitCount(filter1);
374 equal(filter1.hitCount, 1, "Hit count after increase (filter in list)"); 374 equal(filter1.hitCount, 1, "Hit count after increase (filter in list)");
375 ok(filter1.lastHit > 0, "Last hit changed after increase"); 375 ok(filter1.lastHit > 0, "Last hit changed after increase");
376 deepEqual(changes, ["filter.hitCount filter1", "filter.lastHit filter1"], "R eceived changes"); 376 deepEqual(changes, ["filter.hitCount filter1", "filter.lastHit filter1"], "R eceived changes");
377 377
378 let changes = []; 378 changes = [];
379 FilterStorage.increaseHitCount(filter2); 379 FilterStorage.increaseHitCount(filter2);
380 equal(filter2.hitCount, 1, "Hit count after increase (filter not in list)"); 380 equal(filter2.hitCount, 1, "Hit count after increase (filter not in list)");
381 ok(filter2.lastHit > 0, "Last hit changed after increase"); 381 ok(filter2.lastHit > 0, "Last hit changed after increase");
382 deepEqual(changes, ["filter.hitCount filter2", "filter.lastHit filter2"], "R eceived changes"); 382 deepEqual(changes, ["filter.hitCount filter2", "filter.lastHit filter2"], "R eceived changes");
383 383
384 let changes = []; 384 changes = [];
385 FilterStorage.resetHitCounts([filter1]); 385 FilterStorage.resetHitCounts([filter1]);
386 equal(filter1.hitCount, 0, "Hit count after reset"); 386 equal(filter1.hitCount, 0, "Hit count after reset");
387 equal(filter1.lastHit, 0, "Last hit after reset"); 387 equal(filter1.lastHit, 0, "Last hit after reset");
388 deepEqual(changes, ["filter.hitCount filter1", "filter.lastHit filter1"], "R eceived changes"); 388 deepEqual(changes, ["filter.hitCount filter1", "filter.lastHit filter1"], "R eceived changes");
389 389
390 let changes = []; 390 changes = [];
391 FilterStorage.resetHitCounts(null); 391 FilterStorage.resetHitCounts(null);
392 equal(filter2.hitCount, 0, "Hit count after complete reset"); 392 equal(filter2.hitCount, 0, "Hit count after complete reset");
393 equal(filter2.lastHit, 0, "Last hit after complete reset"); 393 equal(filter2.lastHit, 0, "Last hit after complete reset");
394 deepEqual(changes, ["filter.hitCount filter2", "filter.lastHit filter2"], "R eceived changes"); 394 deepEqual(changes, ["filter.hitCount filter2", "filter.lastHit filter2"], "R eceived changes");
395 }); 395 });
396 396
397 test("Filter/subscription relationship", function() 397 test("Filter/subscription relationship", function()
398 { 398 {
399 let filter1 = Filter.fromText("filter1"); 399 let filter1 = Filter.fromText("filter1");
400 let filter2 = Filter.fromText("filter2"); 400 let filter2 = Filter.fromText("filter2");
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 compareFilterSubscriptions("filter2 subscriptions after updating http://test 3/ filters", filter2, [subscription2, subscription3]); 449 compareFilterSubscriptions("filter2 subscriptions after updating http://test 3/ filters", filter2, [subscription2, subscription3]);
450 compareFilterSubscriptions("filter3 subscriptions after updating http://test 3/ filters", filter3, [subscription2]); 450 compareFilterSubscriptions("filter3 subscriptions after updating http://test 3/ filters", filter3, [subscription2]);
451 451
452 FilterStorage.removeSubscription(subscription3); 452 FilterStorage.removeSubscription(subscription3);
453 453
454 compareFilterSubscriptions("filter1 subscriptions after removing http://test 3/", filter1, []); 454 compareFilterSubscriptions("filter1 subscriptions after removing http://test 3/", filter1, []);
455 compareFilterSubscriptions("filter2 subscriptions after removing http://test 3/", filter2, [subscription2]); 455 compareFilterSubscriptions("filter2 subscriptions after removing http://test 3/", filter2, [subscription2]);
456 compareFilterSubscriptions("filter3 subscriptions after removing http://test 3/", filter3, [subscription2]); 456 compareFilterSubscriptions("filter3 subscriptions after removing http://test 3/", filter3, [subscription2]);
457 }); 457 });
458 })(); 458 })();
OLDNEW
« no previous file with comments | « chrome/content/httpd.js ('k') | chrome/content/tests/matcher.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld