tests: Add tests for ScreenRecoveryUI.

In order to support that, this CL adds Paths::set_resource_dir() to
override the default resource dir ("/res/images/") that's only available
under recovery. Note that since there're external modules depending on
libminui, it adds a separate function of res_set_resource_dir(), instead
of requiring the dependency on libotautil for everyone.

Test: mmma -j bootable/recovery
Test: Run recovery_unit_test on marlin.
Change-Id: I0a7dcf4476808bea9e634eaffc9676f6cbaf92b7
This commit is contained in:
Tao Bao
2018-05-08 15:53:56 -07:00
parent 1f3a9c0a43
commit 6cd816859e
10 changed files with 205 additions and 15 deletions
+4 -2
View File
@@ -41,9 +41,10 @@
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <minui/minui.h>
#include "device.h"
#include "minui/minui.h"
#include "otautil/paths.h"
#include "ui.h"
// Return the current time as a double (including fractions of a second).
@@ -754,7 +755,8 @@ std::string ScreenRecoveryUI::GetLocale() {
}
void ScreenRecoveryUI::LoadAnimation() {
std::unique_ptr<DIR, decltype(&closedir)> dir(opendir("/res/images"), closedir);
std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(Paths::Get().resource_dir().c_str()),
closedir);
dirent* de;
std::vector<std::string> intro_frame_names;
std::vector<std::string> loop_frame_names;