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

Side by Side Diff: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineTest.java

Issue 29435570: Issue 5205 - Add Subscription.isDisabled() (Closed)
Patch Set: removed one more [unnecessary] casting Created May 26, 2017, 5:50 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 | « no previous file | libadblockplus-android-webview/src/org/adblockplus/libadblockplus/android/webview/AdblockWebView.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 List<Subscription> listedSubscriptions = filterEngine.getListedSubscriptions (); 418 List<Subscription> listedSubscriptions = filterEngine.getListedSubscriptions ();
419 for (Subscription eachSubscription : listedSubscriptions) 419 for (Subscription eachSubscription : listedSubscriptions)
420 { 420 {
421 if (eachSubscription.isAcceptableAds()) 421 if (eachSubscription.isAcceptableAds())
422 { 422 {
423 return; 423 return;
424 } 424 }
425 } 425 }
426 fail("AA subscription not found in listed subscriptions when enabled"); 426 fail("AA subscription not found in listed subscriptions when enabled");
427 } 427 }
428
429 @Test
430 public void testSubscriptionsAreNotDisabled()
431 {
432 if (!filterEngine.isAcceptableAdsEnabled())
433 {
434 filterEngine.setAcceptableAdsEnabled(true);
435 }
436 assertTrue(filterEngine.isAcceptableAdsEnabled());
437
438 List<Subscription> listedSubscriptions = filterEngine.getListedSubscriptions ();
439 for (Subscription eachSubscription : listedSubscriptions)
440 {
441 assertFalse(eachSubscription.isDisabled());
442 }
443 }
444
445 @Test
446 public void testSubscriptionsSetDisabled()
447 {
448 List<Subscription> listedSubscriptions = filterEngine.getListedSubscriptions ();
449 Subscription subscription = listedSubscriptions.get(0);
450 boolean originalDisabled = subscription.isDisabled();
451
452 subscription.setDisabled(!originalDisabled);
453 assertEquals(!originalDisabled, subscription.isDisabled());
454
455 subscription.setDisabled(originalDisabled);
456 assertEquals(originalDisabled, subscription.isDisabled());
457 }
458
459 @Test
460 public void testDisableEnableAcceptableAdsSubscription()
461 {
462 if (filterEngine.isAcceptableAdsEnabled())
463 {
464 filterEngine.setAcceptableAdsEnabled(false);
465 }
466 assertFalse(filterEngine.isAcceptableAdsEnabled());
467
468 List<Subscription> listedSubscriptions = filterEngine.getListedSubscriptions ();
469 for (Subscription eachSubscription : listedSubscriptions)
470 {
471 if (eachSubscription.isAcceptableAds())
472 {
473 assertTrue(eachSubscription.isDisabled());
474 }
475 }
476
477 filterEngine.setAcceptableAdsEnabled(true);
478 listedSubscriptions = filterEngine.getListedSubscriptions();
479 for (Subscription eachSubscription : listedSubscriptions)
480 {
481 if (eachSubscription.isAcceptableAds())
482 {
483 assertFalse(eachSubscription.isDisabled());
484 }
485 }
486 }
428 } 487 }
OLDNEW
« no previous file with comments | « no previous file | libadblockplus-android-webview/src/org/adblockplus/libadblockplus/android/webview/AdblockWebView.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld