summaryrefslogtreecommitdiffstats
path: root/tests/component/sideload_test.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2019-04-15 21:45:50 +0200
committerTao Bao <tbao@google.com>2019-04-26 21:21:38 +0200
commit178cdd4f5c6ae59d5aaae2614f22cd783eba60d8 (patch)
treebc196683e4994ca538ae0317719f264a828dcfb0 /tests/component/sideload_test.cpp
parentAllow entering rescue mode via recovery UI. (diff)
downloadandroid_bootable_recovery-178cdd4f5c6ae59d5aaae2614f22cd783eba60d8.tar
android_bootable_recovery-178cdd4f5c6ae59d5aaae2614f22cd783eba60d8.tar.gz
android_bootable_recovery-178cdd4f5c6ae59d5aaae2614f22cd783eba60d8.tar.bz2
android_bootable_recovery-178cdd4f5c6ae59d5aaae2614f22cd783eba60d8.tar.lz
android_bootable_recovery-178cdd4f5c6ae59d5aaae2614f22cd783eba60d8.tar.xz
android_bootable_recovery-178cdd4f5c6ae59d5aaae2614f22cd783eba60d8.tar.zst
android_bootable_recovery-178cdd4f5c6ae59d5aaae2614f22cd783eba60d8.zip
Diffstat (limited to 'tests/component/sideload_test.cpp')
-rw-r--r--tests/component/sideload_test.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/component/sideload_test.cpp b/tests/component/sideload_test.cpp
index f5981acbd..6add99f41 100644
--- a/tests/component/sideload_test.cpp
+++ b/tests/component/sideload_test.cpp
@@ -22,7 +22,6 @@
#include <android-base/file.h>
#include <android-base/strings.h>
-#include <android-base/unique_fd.h>
#include <gtest/gtest.h>
#include "fuse_provider.h"
@@ -32,17 +31,26 @@ TEST(SideloadTest, fuse_device) {
ASSERT_EQ(0, access("/dev/fuse", R_OK | W_OK));
}
+class FuseTestDataProvider : public FuseDataProvider {
+ public:
+ FuseTestDataProvider(uint64_t file_size, uint32_t block_size)
+ : FuseDataProvider(file_size, block_size) {}
+
+ private:
+ bool ReadBlockAlignedData(uint8_t*, uint32_t, uint32_t) const override {
+ return true;
+ }
+};
+
TEST(SideloadTest, run_fuse_sideload_wrong_parameters) {
- auto provider_small_block =
- std::make_unique<FuseFileDataProvider>(android::base::unique_fd(), 4096, 4095);
+ auto provider_small_block = std::make_unique<FuseTestDataProvider>(4096, 4095);
ASSERT_EQ(-1, run_fuse_sideload(std::move(provider_small_block)));
- auto provider_large_block =
- std::make_unique<FuseFileDataProvider>(android::base::unique_fd(), 4096, (1 << 22) + 1);
+ auto provider_large_block = std::make_unique<FuseTestDataProvider>(4096, (1 << 22) + 1);
ASSERT_EQ(-1, run_fuse_sideload(std::move(provider_large_block)));
- auto provider_too_many_blocks = std::make_unique<FuseFileDataProvider>(
- android::base::unique_fd(), ((1 << 18) + 1) * 4096, 4096);
+ auto provider_too_many_blocks =
+ std::make_unique<FuseTestDataProvider>(((1 << 18) + 1) * 4096, 4096);
ASSERT_EQ(-1, run_fuse_sideload(std::move(provider_too_many_blocks)));
}