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

Issue 29424615: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)

Created:
April 28, 2017, 8:24 a.m. by anton
Modified:
Oct. 29, 2018, 5:39 p.m.
Reviewers:
sergei, diegocarloslima
CC:
René Jeschke
Visibility:
Public.

Description

Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback This is a new code review instead of old one (https://codereview.adblockplus.org/29347315/) - 9 months passed

Patch Set 1 #

Patch Set 2 : fixed typo #

Total comments: 1

Patch Set 3 : using method from c++ utils #

Total comments: 33

Patch Set 4 : now using smart_ptr, changed impl for reading file as string, minor changes #

Total comments: 7

Patch Set 5 : changed impl for reading file as bytes array, modified test. AndroidFileSystem now does not resolve… #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+1229 lines, -9 lines) Patch
M libadblockplus-android-tests/src/org/adblockplus/libadblockplus/MockFilterChangeCallback.java View 1 2 3 4 2 chunks +8 lines, -1 line 0 comments Download
A libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java View 1 2 3 4 1 chunk +432 lines, -0 lines 0 comments Download
M libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineGenericTest.java View 1 2 3 4 3 chunks +70 lines, -0 lines 0 comments Download
M libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/FilterEngineTest.java View 1 2 3 4 2 chunks +7 lines, -0 lines 0 comments Download
M libadblockplus-android/jni/Android.mk View 1 chunk +1 line, -1 line 0 comments Download
M libadblockplus-android/jni/JniCallbacks.h View 1 2 3 4 2 chunks +13 lines, -1 line 1 comment Download
M libadblockplus-android/jni/JniCallbacks.cpp View 1 2 3 4 1 chunk +4 lines, -1 line 1 comment Download
A + libadblockplus-android/jni/JniFileSystem.h View 1 chunk +5 lines, -5 lines 0 comments Download
A libadblockplus-android/jni/JniFileSystem.cpp View 1 2 3 4 1 chunk +228 lines, -0 lines 3 comments Download
M libadblockplus-android/jni/JniJsEngine.cpp View 1 2 3 2 chunks +13 lines, -0 lines 0 comments Download
M libadblockplus-android/jni/JniLibrary.cpp View 3 chunks +3 lines, -0 lines 0 comments Download
M libadblockplus-android/jni/Utils.h View 1 2 3 1 chunk +8 lines, -0 lines 1 comment Download
A libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java View 1 2 3 4 1 chunk +155 lines, -0 lines 0 comments Download
A libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystemUtils.java View 1 2 3 4 1 chunk +135 lines, -0 lines 0 comments Download
M libadblockplus-android/src/org/adblockplus/libadblockplus/JsEngine.java View 2 chunks +7 lines, -0 lines 0 comments Download
A libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java View 1 2 3 4 1 chunk +140 lines, -0 lines 2 comments Download

Messages

Total messages: 17
anton
April 28, 2017, 8:27 a.m. (2017-04-28 08:27:57 UTC) #1
sergei
I would recommend to firstly finish with updating of libadblockplus. It will eliminate some changes ...
April 28, 2017, 9:12 a.m. (2017-04-28 09:12:09 UTC) #2
sergei
On 2017/04/28 09:12:09, sergei wrote: > I would recommend to firstly finish with updating of ...
April 28, 2017, 9:14 a.m. (2017-04-28 09:14:06 UTC) #3
sergei
I have not taken a look on the rest yet. https://codereview.adblockplus.org/29424615/diff/29424631/libadblockplus-android/jni/Utils.cpp File libadblockplus-android/jni/Utils.cpp (right): https://codereview.adblockplus.org/29424615/diff/29424631/libadblockplus-android/jni/Utils.cpp#newcode103 ...
April 28, 2017, 9:24 a.m. (2017-04-28 09:24:49 UTC) #4
anton
On 2017/04/28 09:24:49, sergei wrote: > I have not taken a look on the rest ...
April 28, 2017, 10:45 a.m. (2017-04-28 10:45:50 UTC) #5
diegocarloslima
https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java File libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java (right): https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java#newcode123 libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java:123: private final static class DisposeWrapper implements Disposable By our ...
April 28, 2017, 1:23 p.m. (2017-04-28 13:23:54 UTC) #6
anton
https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java File libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java (right): https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java#newcode123 libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystem.java:123: private final static class DisposeWrapper implements Disposable On 2017/04/28 ...
April 28, 2017, 1:25 p.m. (2017-04-28 13:25:35 UTC) #7
sergei
https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java File libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java (right): https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java#newcode107 libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java:107: final String singleLineData = DATA.replace("\n", ""); DATA is 12345qwerty, ...
May 22, 2017, 12:09 p.m. (2017-05-22 12:09:07 UTC) #8
anton
uploaded new patch set https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java File libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java (right): https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java#newcode107 libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java:107: final String singleLineData = DATA.replace("\n", ...
May 22, 2017, 1:04 p.m. (2017-05-22 13:04:38 UTC) #9
sergei
https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java File libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java (right): https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java#newcode107 libadblockplus-android-tests/src/org/adblockplus/libadblockplus/tests/AndroidFileSystemTest.java:107: final String singleLineData = DATA.replace("\n", ""); On 2017/05/22 13:04:37, ...
May 22, 2017, 1:51 p.m. (2017-05-22 13:51:04 UTC) #10
anton
https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java File libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java (right): https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java#newcode149 libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java:149: } On 2017/05/22 13:51:04, sergei wrote: > On 2017/05/22 ...
May 23, 2017, 5:46 a.m. (2017-05-23 05:46:48 UTC) #11
sergei
https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java File libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java (right): https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java#newcode149 libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java:149: } On 2017/05/23 05:46:47, anton wrote: > On 2017/05/22 ...
May 23, 2017, 8:08 a.m. (2017-05-23 08:08:20 UTC) #12
sergei
https://codereview.adblockplus.org/29424615/diff/29445621/libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystemUtils.java File libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystemUtils.java (right): https://codereview.adblockplus.org/29424615/diff/29445621/libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystemUtils.java#newcode35 libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystemUtils.java:35: private static String readStream(InputStream inputStream, int bufferSize) throws IOException ...
May 23, 2017, 8:17 a.m. (2017-05-23 08:17:51 UTC) #13
anton
https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java File libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java (right): https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java#newcode149 libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java:149: } On 2017/05/23 08:08:19, sergei wrote: > On 2017/05/23 ...
May 23, 2017, 11:11 a.m. (2017-05-23 11:11:19 UTC) #14
sergei
https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java File libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java (right): https://codereview.adblockplus.org/29424615/diff/29424666/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java#newcode149 libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidFileSystem.java:149: } On 2017/05/23 11:11:18, anton wrote: > On 2017/05/23 ...
May 23, 2017, 1 p.m. (2017-05-23 13:00:38 UTC) #15
anton
https://codereview.adblockplus.org/29424615/diff/29445621/libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystemUtils.java File libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystemUtils.java (right): https://codereview.adblockplus.org/29424615/diff/29445621/libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystemUtils.java#newcode35 libadblockplus-android/src/org/adblockplus/libadblockplus/FileSystemUtils.java:35: private static String readStream(InputStream inputStream, int bufferSize) throws IOException ...
May 29, 2017, 11:30 a.m. (2017-05-29 11:30:04 UTC) #16
sergei
Aug. 7, 2017, 12:50 p.m. (2017-08-07 12:50:01 UTC) #17
https://codereview.adblockplus.org/29424615/diff/29450591/libadblockplus-andr...
File libadblockplus-android/jni/JniCallbacks.cpp (right):

https://codereview.adblockplus.org/29424615/diff/29450591/libadblockplus-andr...
libadblockplus-android/jni/JniCallbacks.cpp:58: bool
JniCallbackBase::CheckAndLogJavaException(JNIEnv* env) const
Is it an unrelated change?

https://codereview.adblockplus.org/29424615/diff/29450591/libadblockplus-andr...
File libadblockplus-android/jni/JniCallbacks.h (right):

https://codereview.adblockplus.org/29424615/diff/29450591/libadblockplus-andr...
libadblockplus-android/jni/JniCallbacks.h:87: class JniFileSystemCallback :
public JniCallbackBase, public AdblockPlus::FileSystem
FileSystem interface is removed in the recent libadblockplus, one should use
IFileSystem instead, though I'm not sure whether it makes sense to do it as a
part of this codereview, can be done later.

https://codereview.adblockplus.org/29424615/diff/29450591/libadblockplus-andr...
File libadblockplus-android/jni/JniFileSystem.cpp (right):

https://codereview.adblockplus.org/29424615/diff/29450591/libadblockplus-andr...
libadblockplus-android/jni/JniFileSystem.cpp:45: };
All these things should be in the anonymous namespace, however fortunately all
these C++ streams will go away after rabasing.

https://codereview.adblockplus.org/29424615/diff/29450591/libadblockplus-andr...
libadblockplus-android/jni/JniFileSystem.cpp:68: statResultClass = NULL;
nullptr?

https://codereview.adblockplus.org/29424615/diff/29450591/libadblockplus-andr...
libadblockplus-android/jni/JniFileSystem.cpp:72: static jlong JNICALL
JniCtor(JNIEnv* env, jclass clazz, jobject callbackObject)
I think that it should be done a little bit differently. JniFileSystemCallback
inherits JniCallbackBase which holds a strong reference to a corresponding Java
class, the lifetime of JniFileSystemCallback is managed by JsEngine and there
are no calls from Java class of methods of JniFileSystemCallback. So, there is
no need to have a pointer to C++ class in Java, instead there should be an
interface in Java which is passed into some Java JsEngine.SetFileSystem (BTW, it
will reduce the number of further changes if it's done in the constructor of
JsEngine) and finally as jobject into some JniJsEngine.cpp::JniSetFileSystem (or
in JniCtor). In JniSetFileSystem we simply create JniFileSystemCallback
accepting jobject and holding it. The implementation of methods of
AdblockPlus::FileSystem should simply call corresponding methods of the stored
Java interface.
In addition the most recent changes don't use a std::shared_ptr<FileSystem>, the
ownership is passed to a corresponding class via std::unique_ptr what basically
implies and forces the described above approach.

https://codereview.adblockplus.org/29424615/diff/29450591/libadblockplus-andr...
File libadblockplus-android/jni/Utils.h (right):

https://codereview.adblockplus.org/29424615/diff/29450591/libadblockplus-andr...
libadblockplus-android/jni/Utils.h:34: namespace AdblockPlus
This will be removed after rabasing.

Powered by Google App Engine
This is Rietveld