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

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

Issue 29819555: Fix libadblockplus-android tests
Left Patch Set: Created July 1, 2018, 9:20 p.m.
Right Patch Set: Fixed indentation issues. Created Aug. 27, 2018, 8:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 package org.adblockplus.libadblockplus.tests;
19
20 import org.adblockplus.libadblockplus.AppInfo;
21 import org.adblockplus.libadblockplus.BaseFilterEngineTest;
22 import org.adblockplus.libadblockplus.Subscription;
23 import org.junit.Test;
24
25 import java.util.List;
26
27 public class FilterEngineFirstRunTest extends BaseFilterEngineTest
28 {
29 @Override
30 protected void setUp() throws Exception
31 {
32 setAppInfo(AppInfo.builder().setLocale("zh").build());
33 super.setUp();
34 }
35
36 @Test
37 public void testFirstRunSetWithoutData()
38 {
39 assertTrue(filterEngine.isFirstRun());
40 }
41
42 @Test
43 public void testFirstRunClearWithData()
44 {
45 assertTrue(filterEngine.isFirstRun());
46 disposeEngines();
47 setupFilterEngine();
48 assertFalse(filterEngine.isFirstRun());
49 }
50
51 @Test
52 public void testLangAndAASubscriptionsAreChosenOnFirstRun()
53 {
54 assertTrue(filterEngine.isFirstRun());
55
56 final String langUrl = "https://easylist-downloads.adblockplus.org/easylistc hina+easylist.txt";
57
58 List<Subscription> subscriptions = filterEngine.getListedSubscriptions();
59 assertEquals(2, subscriptions.size());
60
61 Subscription aaSubscription, langSubscription;
62 final int aaIdx = subscriptions.get(0).isAcceptableAds() ? 0 : 1;
63 aaSubscription = subscriptions.get(aaIdx);
64 langSubscription = subscriptions.get(1 - aaIdx);
65
66 assertTrue(aaSubscription.isAcceptableAds());
67 assertEquals(langUrl, langSubscription.getProperty("url").asString());
68 assertTrue(filterEngine.isAcceptableAdsEnabled());
69 }
70 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld