Bug in BrowserProvider refresh functionality
Description
The dataset of BrowserProvider should contain only the filtered type of Media objects, as per the override-able implementation here: BrowserProvider#L117
Expected behavior
Similarly, the refresh should fetch the media objects such that the dataset remains filtered depending on the implementation of the subclass.
Actual behavior
But that's not the case, as can be seen from here - BrowserProvider#L145. It considers the complete set of media received in the dataset.
Steps to reproduce
I came upon this bug while unit testing the FilePicker mode of BrowserModel. Here's the corresponding Test Suite - FilePickerModelTest. The corresponding stack trace is:
junit.framework.AssertionFailedError:
Expected :5
Actual :7
at org.videolan.vlc.viewmodels.browser.FilePickerModelTest.whenRootHasFilesAndRefreshCalled_getUpdatedListOfDirectories(FilePickerModelTest.kt:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:256)
at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:89)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)