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

Delta Between Two Patch Sets: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineTest.java

Issue 29405564: Issue 5121 - Use Acceptable Ads API in libadblockplus (Closed)
Left Patch Set: changed tests after AA in getListedSubscriptions discussion Created April 7, 2017, 10 a.m.
Right Patch Set: minor cleanup suggestions by Serge Created May 4, 2017, 6:17 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « dependencies ('k') | libadblockplus-android/jni/JniFilterEngine.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld