tests: Clean up the temporary dirs post-run.
TemporaryDir only deletes empty dirs (not done by its dtor because it
tries to keep the temporary files available on error exit).
Also change FreeCacheTest::MockFreeSpaceChecker to be static.
Test: Run recovery_unit_test on marlin. Check /data/local/tmp post-run.
Change-Id: I1bd54eb840e3094b4f22ee84c059eec2998773bf
diff --git a/tests/unit/screen_ui_test.cpp b/tests/unit/screen_ui_test.cpp
index 2f4b7b0..4c0a868 100644
--- a/tests/unit/screen_ui_test.cpp
+++ b/tests/unit/screen_ui_test.cpp
@@ -446,8 +446,9 @@
RETURN_IF_NO_GRAPHICS;
ASSERT_TRUE(ui_->Init(kTestLocale));
- TemporaryDir resource_dir;
- Paths::Get().set_resource_dir(resource_dir.path);
+ // We need a dir that doesn't contain any animation. However, using TemporaryDir will give
+ // leftovers since this is a death test where TemporaryDir::~TemporaryDir() won't be called.
+ Paths::Get().set_resource_dir("/proc/self");
::testing::FLAGS_gtest_death_test_style = "threadsafe";
ASSERT_EXIT(ui_->RunLoadAnimation(), ::testing::KilledBySignal(SIGABRT), "");