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

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

Issue 29536596: Issue 5556 - Update to use libadblockplus revision hg:566f64c8a2a8 (Closed) Base URL: github.com:abby-sergz/libadblockplus-android.git
Patch Set: Created Sept. 5, 2017, 12:21 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/GlobalJsObjectTest.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
(...skipping 24 matching lines...) Expand all
35 { 35 {
36 return new AndroidWebRequest(true, true); 36 return new AndroidWebRequest(true, true);
37 } 37 }
38 38
39 @Test 39 @Test
40 public void testRealWebRequest() 40 public void testRealWebRequest()
41 { 41 {
42 // This URL should redirect to easylist-downloads.adblockplus.org and we 42 // This URL should redirect to easylist-downloads.adblockplus.org and we
43 // should get the actual filter list back. 43 // should get the actual filter list back.
44 jsEngine.evaluate( 44 jsEngine.evaluate(
45 "_webRequest.GET('https://easylist-downloads.adblockplus.org/easylist.txt' , {}, " + 45 "let foo; _webRequest.GET('https://easylist-downloads.adblockplus.org/easy list.txt', {}, " +
46 "function(result) {foo = result;} )"); 46 "function(result) {foo = result;} )");
47 do 47 do
48 { 48 {
49 try 49 try
50 { 50 {
51 Thread.sleep(200); 51 Thread.sleep(200);
52 } 52 }
53 catch (InterruptedException e) 53 catch (InterruptedException e)
54 { 54 {
55 throw new RuntimeException(e); 55 throw new RuntimeException(e);
56 } 56 }
57 } while (jsEngine.evaluate("this.foo").isUndefined()); 57 } while (jsEngine.evaluate("foo").isUndefined());
58 58
59 String response = jsEngine.evaluate("foo.responseText").asString(); 59 String response = jsEngine.evaluate("foo.responseText").asString();
60 assertNotNull(response); 60 assertNotNull(response);
61 assertEquals( 61 assertEquals(
62 ServerResponse.NsStatus.OK.getStatusCode(), 62 ServerResponse.NsStatus.OK.getStatusCode(),
63 jsEngine.evaluate("foo.status").asLong()); 63 jsEngine.evaluate("foo.status").asLong());
64 assertEquals(200l, jsEngine.evaluate("foo.responseStatus").asLong()); 64 assertEquals(200l, jsEngine.evaluate("foo.responseStatus").asLong());
65 assertEquals( 65 assertEquals(
66 "[Adblock Plus ", 66 "[Adblock Plus ",
67 jsEngine.evaluate("foo.responseText.substr(0, 14)").asString()); 67 jsEngine.evaluate("foo.responseText.substr(0, 14)").asString());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 assertFalse(isDocumentWhitelisted); 131 assertFalse(isDocumentWhitelisted);
132 132
133 boolean isElemhideWhitelisted = filterEngine.isElemhideWhitelisted(url, null ); 133 boolean isElemhideWhitelisted = filterEngine.isElemhideWhitelisted(url, null );
134 assertFalse(isElemhideWhitelisted); 134 assertFalse(isElemhideWhitelisted);
135 135
136 List<String> selectors = filterEngine.getElementHidingSelectors(url); 136 List<String> selectors = filterEngine.getElementHidingSelectors(url);
137 assertNotNull(selectors); 137 assertNotNull(selectors);
138 assertTrue(selectors.size() > 0); 138 assertTrue(selectors.size() > 0);
139 } 139 }
140 } 140 }
OLDNEW
« no previous file with comments | « no previous file | libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/GlobalJsObjectTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld