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

Side by Side Diff: libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/NotificationTest.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
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 org.adblockplus.libadblockplus.FilterEngine; 20 import org.adblockplus.libadblockplus.FilterEngine;
21 import org.adblockplus.libadblockplus.LazyWebRequest; 21 import org.adblockplus.libadblockplus.LazyWebRequest;
22 import org.adblockplus.libadblockplus.Notification; 22 import org.adblockplus.libadblockplus.Notification;
23 import org.adblockplus.libadblockplus.ShowNotificationCallback; 23 import org.adblockplus.libadblockplus.ShowNotificationCallback;
24 import org.adblockplus.libadblockplus.WebRequest;
24 25
25 import org.junit.Test; 26 import org.junit.Test;
26 27
27 public class NotificationTest extends BaseJsTest 28 public class NotificationTest extends BaseJsTest
28 { 29 {
29 protected FilterEngine filterEngine; 30 protected FilterEngine filterEngine;
30 31
31 @Override 32 @Override
32 protected void setUp() throws Exception 33 protected void setUp() throws Exception
33 { 34 {
34 super.setUp(); 35 super.setUp();
36 filterEngine = new FilterEngine(jsEngine);
37 }
35 38
36 jsEngine.setWebRequest(new LazyWebRequest()); 39 @Override
37 filterEngine = new FilterEngine(jsEngine); 40 protected WebRequest createWebRequest()
41 {
42 return new LazyWebRequest();
38 } 43 }
39 44
40 protected void addNotification(String notification) 45 protected void addNotification(String notification)
41 { 46 {
42 jsEngine.evaluate( 47 jsEngine.evaluate(
43 "(function()\n" + 48 "(function()\n" +
44 "{\n" + 49 "{\n" +
45 "require('notification').Notification.addNotification(" + notification + " );\n" + 50 "require('notification').Notification.addNotification(" + notification + " );\n" +
46 "})();"); 51 "})();");
47 } 52 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 126
122 Notification notification = peekNotification(""); 127 Notification notification = peekNotification("");
123 assertNotNull(notification); 128 assertNotNull(notification);
124 129
125 Thread.sleep(1000); 130 Thread.sleep(1000);
126 notification.markAsShown(); 131 notification.markAsShown();
127 132
128 assertNull(peekNotification("")); 133 assertNull(peekNotification(""));
129 } 134 }
130 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld