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

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

Issue 29819555: Fix libadblockplus-android tests
Left Patch Set: Added missing files, removed a whitespace Created Aug. 16, 2018, 12:27 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | adblock-android-tests/src/org/adblockplus/libadblockplus/BaseJsEngineTest.java » ('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-present eyeo GmbH 3 * Copyright (C) 2006-present 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 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/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 package org.adblockplus.libadblockplus; 18 package org.adblockplus.libadblockplus;
anton 2018/08/24 12:25:03 Why is it moved from `tests` package? Same about a
René Jeschke 2018/08/27 20:02:14 Yes, it was intentionally. Those four classes don'
19 19
20 import android.os.SystemClock; 20 import android.os.SystemClock;
21 import android.util.Log;
21 22
22 import java.util.List; 23 import java.util.List;
23 24
24 public abstract class BaseFilterEngineTest extends BaseJsEngineTest 25 public abstract class BaseFilterEngineTest extends BaseJsEngineTest
25 { 26 {
27 private final static String TAG = BaseFilterEngineTest.class.getSimpleName();
26 protected final static int UPDATE_SUBSCRIPTIONS_WAIT_DELAY_MS = 5 * 1000; 28 protected final static int UPDATE_SUBSCRIPTIONS_WAIT_DELAY_MS = 5 * 1000;
27 protected final static int UPDATE_SUBSCRIPTIONS_WAIT_CHUNKS = 50; 29 protected final static int UPDATE_SUBSCRIPTIONS_WAIT_CHUNKS = 50;
28 30
29 @Override 31 @Override
30 protected void setUp() throws Exception 32 protected void setUp() throws Exception
31 { 33 {
32 super.setUp(); 34 super.setUp();
33 this.setupFilterEngine(); 35 this.setupFilterEngine();
34 } 36 }
35 37
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 if (getUpdateRequestCount() - init >= num) 70 if (getUpdateRequestCount() - init >= num)
69 { 71 {
70 break; 72 break;
71 } 73 }
72 SystemClock.sleep(UPDATE_SUBSCRIPTIONS_WAIT_DELAY_MS / UPDATE_SUBSCRIPTI ONS_WAIT_CHUNKS); 74 SystemClock.sleep(UPDATE_SUBSCRIPTIONS_WAIT_DELAY_MS / UPDATE_SUBSCRIPTI ONS_WAIT_CHUNKS);
73 } 75 }
74 } 76 }
75 77
76 return num; 78 return num;
77 } 79 }
80
81 public boolean removeListedSubscriptions()
82 {
83 while (filterEngine.getListedSubscriptions().size() > 0)
84 {
85 int prev = filterEngine.getListedSubscriptions().size();
86 filterEngine.getListedSubscriptions().get(0).removeFromList();
anton 2018/09/17 06:55:13 isn't it better to return `boolean` for `removeFro
87 if (prev == filterEngine.getListedSubscriptions().size())
anton 2018/10/16 13:24:55 this still looks suspicious. sergey: "removing sho
88 {
89 Log.e(TAG, "Failed to clear listed subscriptions.");
90 return false;
91 }
92 }
93 return true;
94 }
78 } 95 }
anton 2018/10/18 11:40:13 the file does not correspond to last revision of f
LEFTRIGHT

Powered by Google App Engine
This is Rietveld