LEFT | RIGHT |
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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 filterEngine.setAcceptableAdsEnabled(isAA); | 402 filterEngine.setAcceptableAdsEnabled(isAA); |
403 assertEquals(isAA, filterEngine.isAcceptableAdsEnabled()); | 403 assertEquals(isAA, filterEngine.isAcceptableAdsEnabled()); |
404 isAA = !isAA; | 404 isAA = !isAA; |
405 filterEngine.setAcceptableAdsEnabled(isAA); | 405 filterEngine.setAcceptableAdsEnabled(isAA); |
406 assertEquals(isAA, filterEngine.isAcceptableAdsEnabled()); | 406 assertEquals(isAA, filterEngine.isAcceptableAdsEnabled()); |
407 } | 407 } |
408 | 408 |
409 @Test | 409 @Test |
410 public void testIsAcceptableAdsIfEnabled() | 410 public void testIsAcceptableAdsIfEnabled() |
411 { | 411 { |
412 // `.setAcceptableAdsEnabled(true)` is not required, as we're having | |
413 // AA subscription listed even if AA is disabled with `filterEngine.setAccep
tableAdsEnabled(false);` | |
414 if (!filterEngine.isAcceptableAdsEnabled()) | 412 if (!filterEngine.isAcceptableAdsEnabled()) |
415 { | 413 { |
416 filterEngine.setAcceptableAdsEnabled(true); | 414 filterEngine.setAcceptableAdsEnabled(true); |
417 } | 415 } |
418 assertTrue(filterEngine.isAcceptableAdsEnabled()); | 416 assertTrue(filterEngine.isAcceptableAdsEnabled()); |
419 | 417 |
420 List<Subscription> listedSubscriptions = filterEngine.getListedSubscriptions
(); | 418 List<Subscription> listedSubscriptions = filterEngine.getListedSubscriptions
(); |
421 for (Subscription eachSubscription : listedSubscriptions) | 419 for (Subscription eachSubscription : listedSubscriptions) |
422 { | 420 { |
423 if (eachSubscription.isAcceptableAds()) | 421 if (eachSubscription.isAcceptableAds()) |
424 { | 422 { |
425 return; | 423 return; |
426 } | 424 } |
427 } | 425 } |
428 fail("AA subscription not found in listed subscriptions when enabled"); | 426 fail("AA subscription not found in listed subscriptions when enabled"); |
429 } | 427 } |
430 } | 428 } |
LEFT | RIGHT |