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

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

Issue 29347192: Issue 4181 - Fix FilterEngineTest tests (Closed)
Patch Set: Created July 1, 2016, 1:41 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
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-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
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.util.Log;
21 import org.adblockplus.libadblockplus.Filter; 20 import org.adblockplus.libadblockplus.Filter;
22 import org.adblockplus.libadblockplus.FilterEngine; 21 import org.adblockplus.libadblockplus.FilterEngine;
23 import org.adblockplus.libadblockplus.MockFilterChangeCallback; 22 import org.adblockplus.libadblockplus.MockFilterChangeCallback;
24 import org.adblockplus.libadblockplus.Subscription; 23 import org.adblockplus.libadblockplus.Subscription;
25 24
26 import org.junit.Test; 25 import org.junit.Test;
27 26
28 public class FilterEngineTest extends FilterEngineGenericTest 27 public class FilterEngineTest extends FilterEngineGenericTest
29 { 28 {
30 @Test 29 @Test
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 "http://example.org/", 313 "http://example.org/",
315 "http://example.com/" 314 "http://example.com/"
316 }); 315 });
317 assertNotNull(match5); 316 assertNotNull(match5);
318 assertEquals(Filter.Type.EXCEPTION, match5.getType()); 317 assertEquals(Filter.Type.EXCEPTION, match5.getType());
319 } 318 }
320 319
321 @Test 320 @Test
322 public void testFirstRunFlag() 321 public void testFirstRunFlag()
323 { 322 {
324 assertFalse(filterEngine.isFirstRun()); 323 assertTrue(filterEngine.isFirstRun());
325 } 324 }
326 325
327 @Test 326 @Test
328 public void testSetRemoveFilterChangeCallback() 327 public void testSetRemoveFilterChangeCallback()
329 { 328 {
330 MockFilterChangeCallback mockFilterChangeCallback = new MockFilterChange Callback(0); 329 MockFilterChangeCallback mockFilterChangeCallback = new MockFilterChange Callback(0);
331 330
332 filterEngine.setFilterChangeCallback(mockFilterChangeCallback); 331 filterEngine.setFilterChangeCallback(mockFilterChangeCallback);
333 filterEngine.getFilter("foo").addToList(); 332 filterEngine.getFilter("foo").addToList();
334 assertEquals(1, mockFilterChangeCallback.getTimesCalled()); 333 assertEquals(1, mockFilterChangeCallback.getTimesCalled());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 assertFalse(filterEngine.isElemhideWhitelisted("http://example.com", emp tyArray)); 374 assertFalse(filterEngine.isElemhideWhitelisted("http://example.com", emp tyArray));
376 375
377 String[] documentUrls1 = new String[] 376 String[] documentUrls1 = new String[]
378 { 377 {
379 "http://example.de" 378 "http://example.de"
380 }; 379 };
381 assertTrue(filterEngine.isElemhideWhitelisted("http://example.com", docu mentUrls1)); 380 assertTrue(filterEngine.isElemhideWhitelisted("http://example.com", docu mentUrls1));
382 assertFalse(filterEngine.isElemhideWhitelisted("http://example.co.uk", d ocumentUrls1)); 381 assertFalse(filterEngine.isElemhideWhitelisted("http://example.co.uk", d ocumentUrls1));
383 } 382 }
384 } 383 }
OLDNEW

Powered by Google App Engine
This is Rietveld