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

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

Issue 29526696: Issue 5556 - remove WebRequest setter (Closed) Base URL: github.com:abby-sergz/libadblockplus-android.git
Patch Set: Created Aug. 24, 2017, 5:24 p.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-tests/src/org/adblockplus/libadblockplus/tests/AndroidWebRequestTest.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-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.tests; 18 package org.adblockplus.libadblockplus.tests;
19 19
20 import android.os.SystemClock; 20 import android.os.SystemClock;
21 21
22 import org.adblockplus.libadblockplus.HeaderEntry; 22 import org.adblockplus.libadblockplus.HeaderEntry;
23 import org.adblockplus.libadblockplus.ServerResponse; 23 import org.adblockplus.libadblockplus.ServerResponse;
24 import org.adblockplus.libadblockplus.Subscription; 24 import org.adblockplus.libadblockplus.Subscription;
25 import org.adblockplus.libadblockplus.WebRequest;
25 import org.adblockplus.libadblockplus.android.AndroidWebRequest; 26 import org.adblockplus.libadblockplus.android.AndroidWebRequest;
26 import org.adblockplus.libadblockplus.android.AndroidWebRequestResourceWrapper; 27 import org.adblockplus.libadblockplus.android.AndroidWebRequestResourceWrapper;
27 import org.adblockplus.libadblockplus.android.Utils; 28 import org.adblockplus.libadblockplus.android.Utils;
28 import org.adblockplus.libadblockplus.tests.test.R; 29 import org.adblockplus.libadblockplus.tests.test.R;
29 import org.junit.Test; 30 import org.junit.Test;
30 31
31 import java.util.Collection; 32 import java.util.Collection;
32 import java.util.HashMap; 33 import java.util.HashMap;
33 import java.util.HashSet; 34 import java.util.HashSet;
34 import java.util.LinkedList; 35 import java.util.LinkedList;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 99
99 private TestRequest request; 100 private TestRequest request;
100 private Map<String, Integer> preloadMap; 101 private Map<String, Integer> preloadMap;
101 private TestStorage storage; 102 private TestStorage storage;
102 private AndroidWebRequestResourceWrapper wrapper; 103 private AndroidWebRequestResourceWrapper wrapper;
103 private TestWrapperListener wrapperListener; 104 private TestWrapperListener wrapperListener;
104 105
105 @Override 106 @Override
106 protected void setUp() throws Exception 107 protected void setUp() throws Exception
107 { 108 {
108 super.setUp();
109 109
110 request = new TestRequest(); 110 request = new TestRequest();
111 preloadMap = new HashMap<String, Integer>(); 111 preloadMap = new HashMap<String, Integer>();
112 storage = new TestStorage(); 112 storage = new TestStorage();
113 wrapper = new AndroidWebRequestResourceWrapper( 113 wrapper = new AndroidWebRequestResourceWrapper(
114 getInstrumentation().getContext(), request, preloadMap, storage); 114 getInstrumentation().getContext(), request, preloadMap, storage);
115 wrapperListener = new TestWrapperListener(); 115 wrapperListener = new TestWrapperListener();
116 wrapper.setListener(wrapperListener); 116 wrapper.setListener(wrapperListener);
117 117
118 jsEngine.setWebRequest(wrapper); 118 super.setUp();
119 }
120
121 @Override
122 protected WebRequest createWebRequest()
123 {
124 return wrapper;
119 } 125 }
120 126
121 private void updateSubscriptions() 127 private void updateSubscriptions()
122 { 128 {
123 for (final Subscription s : this.filterEngine.getListedSubscriptions()) 129 for (final Subscription s : this.filterEngine.getListedSubscriptions())
124 { 130 {
125 try 131 try
126 { 132 {
127 s.updateFilters(); 133 s.updateFilters();
128 } 134 }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 329 }
324 330
325 @Test 331 @Test
326 public void testNotIntercepted_AcceptableAds() 332 public void testNotIntercepted_AcceptableAds()
327 { 333 {
328 testNotIntercepted( 334 testNotIntercepted(
329 AndroidWebRequestResourceWrapper.EASYLIST, R.raw.easylist, 335 AndroidWebRequestResourceWrapper.EASYLIST, R.raw.easylist,
330 AndroidWebRequestResourceWrapper.ACCEPTABLE_ADS); 336 AndroidWebRequestResourceWrapper.ACCEPTABLE_ADS);
331 } 337 }
332 } 338 }
OLDNEW
« no previous file with comments | « no previous file | libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidWebRequestTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld