Skip to content

Medialibrary stub

Duncan McNamara requested to merge Skantes/vlc-android:tests-rebase into master


This is a work in progress for the medialibrary stub.

VLC-Android can run with the stub, even though there are some things to fix still

Motivation and Context

The goal is the be able to run automated tests on a device / emulated environment that does not have medias.

For that the medialibrary needed to be abstracted to be, at request, replaced by a media datasource with fake medias, and not break the app.

How Has This Been Tested?

This has been tested by running vlc-android with the stub.

Again, this is not completely stable yet. I wanted to publish it, so that it could begin being reviewed, and so that @shivanshs9 could start working with it.

How does it work ?

This abstracts the medialibrary, and all media classes that relied on the native medialibrary.

To choose at run time which implementation to use, there is a ServiceLocator that calls the appropriate implementations' constructor.

Hence instead of calling Folder(...) now you should use ServiceLocator.getAFolder(...) which will return the correct instance.

To set the service locator to return the stub instead of the native medialibrary classes, use:


  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Enhancement (non-breaking change which cleans up / improves existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to change) -> Should not break anything

Still to be done

  • Rename ServiceLocator to MLlocator
  • Add fake medias
  • Fix vlc-android were it will crash without actual media
  • Rename all Aclasses to AbstractClasses
Edited by Geoffrey Métais

Merge request reports