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

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

Issue 29411633: Issue 5136 - Add test for AndroidWebRequestResourceWrapper (Closed)
Patch Set: added "static final" for the test impls Created April 28, 2017, 6:09 a.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
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 public void setListener(Listener listener) 106 public void setListener(Listener listener)
107 { 107 {
108 this.listener = listener; 108 this.listener = listener;
109 } 109 }
110 110
111 @Override 111 @Override
112 public ServerResponse httpGET(String url, List<HeaderEntry> headers) 112 public ServerResponse httpGET(String url, List<HeaderEntry> headers)
113 { 113 {
114 // since parameters may vary we need to ignore them 114 // since parameters may vary we need to ignore them
115 String urlWithoutParams = url.substring(0, url.indexOf("?")); 115 String urlWithoutParams = Utils.getUrlWithoutParams(url);
116 Integer resourceId = urlToResourceIdMap.get(urlWithoutParams); 116 Integer resourceId = urlToResourceIdMap.get(urlWithoutParams);
117 117
118 if (resourceId != null) 118 if (resourceId != null)
119 { 119 {
120 if (!storage.contains(urlWithoutParams)) 120 if (!storage.contains(urlWithoutParams))
121 { 121 {
122 Log.w(TAG, "Intercepting request for " + url + " with resource #" + reso urceId.intValue()); 122 Log.w(TAG, "Intercepting request for " + url + " with resource #" + reso urceId.intValue());
123 ServerResponse response = buildResourceContentResponse(resourceId); 123 ServerResponse response = buildResourceContentResponse(resourceId);
124 storage.put(urlWithoutParams); 124 storage.put(urlWithoutParams);
125 125
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 .commit(); 247 .commit();
248 } 248 }
249 249
250 @Override 250 @Override
251 public synchronized boolean contains(String url) 251 public synchronized boolean contains(String url)
252 { 252 {
253 return urls.contains(url); 253 return urls.contains(url);
254 } 254 }
255 } 255 }
256 } 256 }
OLDNEW

Powered by Google App Engine
This is Rietveld