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