Added first tests for FilesCtrl.
Fixed an async problem with file library loading

Previously in some cases some files were not loaded before file
library signaled that it had completed reading of files.