Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 16 matching lines...) Expand all Loading... | |
27 import org.adblockplus.libadblockplus.android.AndroidWebRequest; | 27 import org.adblockplus.libadblockplus.android.AndroidWebRequest; |
28 import org.junit.Test; | 28 import org.junit.Test; |
29 | 29 |
30 import java.util.LinkedList; | 30 import java.util.LinkedList; |
31 import java.util.List; | 31 import java.util.List; |
32 | 32 |
33 public class IsAllowedConnectionCallbackTest extends BaseJsTest | 33 public class IsAllowedConnectionCallbackTest extends BaseJsTest |
34 { | 34 { |
35 private static final int UPDATE_SUBSCRIPTIONS_WAIT_DELAY_MS = 5 * 1000; // 5s | 35 private static final int UPDATE_SUBSCRIPTIONS_WAIT_DELAY_MS = 5 * 1000; // 5s |
36 | 36 |
37 private class TestRequest extends AndroidWebRequest | 37 private static final class TestRequest extends AndroidWebRequest |
diegocarloslima
2017/04/27 19:04:58
This inner class can be static
anton
2017/04/28 06:16:23
not sure this is a significant and really required
| |
38 { | 38 { |
39 private List<String> urls = new LinkedList<String>(); | 39 private List<String> urls = new LinkedList<String>(); |
40 | 40 |
41 public List<String> getUrls() | 41 public List<String> getUrls() |
42 { | 42 { |
43 return urls; | 43 return urls; |
44 } | 44 } |
45 | 45 |
46 @Override | 46 @Override |
47 public ServerResponse httpGET(String url, List<HeaderEntry> headers) | 47 public ServerResponse httpGET(String url, List<HeaderEntry> headers) |
48 { | 48 { |
49 urls.add(url); | 49 urls.add(url); |
50 return super.httpGET(url, headers); | 50 return super.httpGET(url, headers); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 private class TestCallback extends IsAllowedConnectionCallback | 54 private static final class TestCallback extends IsAllowedConnectionCallback |
diegocarloslima
2017/04/27 19:04:58
This inner class can be static
anton
2017/04/28 06:16:23
Acknowledged.
| |
55 { | 55 { |
56 private boolean result; | 56 private boolean result; |
57 private boolean invoked; | 57 private boolean invoked; |
58 private String connectionType; | 58 private String connectionType; |
59 | 59 |
60 public boolean isResult() | 60 public boolean isResult() |
61 { | 61 { |
62 return result; | 62 return result; |
63 } | 63 } |
64 | 64 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 updateSubscriptions(); | 150 updateSubscriptions(); |
151 SystemClock.sleep(UPDATE_SUBSCRIPTIONS_WAIT_DELAY_MS); | 151 SystemClock.sleep(UPDATE_SUBSCRIPTIONS_WAIT_DELAY_MS); |
152 | 152 |
153 assertTrue(callback.isInvoked()); | 153 assertTrue(callback.isInvoked()); |
154 assertNotNull(callback.getConnectionType()); | 154 assertNotNull(callback.getConnectionType()); |
155 assertEquals(allowedConnectionType, callback.getConnectionType()); | 155 assertEquals(allowedConnectionType, callback.getConnectionType()); |
156 | 156 |
157 assertEquals(0, request.getUrls().size()); | 157 assertEquals(0, request.getUrls().size()); |
158 } | 158 } |
159 } | 159 } |
LEFT | RIGHT |