Loading boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp +18 −17 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,8 @@ using ::android::hardware::boot::V1_0::Slot; using ::android::hardware::hidl_string; using ::android::hardware::hidl_string; using ::android::hardware::Return; using ::android::hardware::Return; using ::android::sp; using ::android::sp; using std::string; using std::vector; // The main test class for the Boot HIDL HAL. // The main test class for the Boot HIDL HAL. class BootHidlTest : public ::testing::VtsHalHidlTargetTestBase { class BootHidlTest : public ::testing::VtsHalHidlTargetTestBase { Loading Loading @@ -151,21 +153,20 @@ TEST_F(BootHidlTest, IsSlotMarkedSuccessful) { // Sanity check Boot::getSuffix() on good and bad inputs. // Sanity check Boot::getSuffix() on good and bad inputs. TEST_F(BootHidlTest, GetSuffix) { TEST_F(BootHidlTest, GetSuffix) { const char *suffixPtr; string suffixStr; auto cb = [&](hidl_string suffix) { suffixPtr = suffix.c_str(); }; vector<string> correctSuffixes = {"_a", "_b"}; auto cb = [&](hidl_string suffix) { suffixStr = suffix.c_str(); }; for (Slot i = 0; i < 2; i++) { for (Slot i = 0; i < 2; i++) { CommandResult cr; CommandResult cr; Return<void> result = boot->getSuffix(i, cb); Return<void> result = boot->getSuffix(i, cb); EXPECT_TRUE(result.isOk()); EXPECT_TRUE(result.isOk()); char correctSuffix[3]; ASSERT_EQ(0, suffixStr.compare(correctSuffixes[i])); snprintf(correctSuffix, sizeof(correctSuffix), "_%c", 'a' + i); ASSERT_EQ(0, strcmp(suffixPtr, correctSuffix)); } } { { char emptySuffix[] = ""; string emptySuffix = ""; Return<void> result = boot->getSuffix(boot->getNumberSlots(), cb); Return<void> result = boot->getSuffix(boot->getNumberSlots(), cb); EXPECT_TRUE(result.isOk()); EXPECT_TRUE(result.isOk()); ASSERT_EQ(0, strcmp(emptySuffix, suffixPtr)); ASSERT_EQ(0, suffixStr.compare(emptySuffix)); } } } } Loading Loading
boot/1.0/vts/functional/VtsHalBootV1_0TargetTest.cpp +18 −17 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,8 @@ using ::android::hardware::boot::V1_0::Slot; using ::android::hardware::hidl_string; using ::android::hardware::hidl_string; using ::android::hardware::Return; using ::android::hardware::Return; using ::android::sp; using ::android::sp; using std::string; using std::vector; // The main test class for the Boot HIDL HAL. // The main test class for the Boot HIDL HAL. class BootHidlTest : public ::testing::VtsHalHidlTargetTestBase { class BootHidlTest : public ::testing::VtsHalHidlTargetTestBase { Loading Loading @@ -151,21 +153,20 @@ TEST_F(BootHidlTest, IsSlotMarkedSuccessful) { // Sanity check Boot::getSuffix() on good and bad inputs. // Sanity check Boot::getSuffix() on good and bad inputs. TEST_F(BootHidlTest, GetSuffix) { TEST_F(BootHidlTest, GetSuffix) { const char *suffixPtr; string suffixStr; auto cb = [&](hidl_string suffix) { suffixPtr = suffix.c_str(); }; vector<string> correctSuffixes = {"_a", "_b"}; auto cb = [&](hidl_string suffix) { suffixStr = suffix.c_str(); }; for (Slot i = 0; i < 2; i++) { for (Slot i = 0; i < 2; i++) { CommandResult cr; CommandResult cr; Return<void> result = boot->getSuffix(i, cb); Return<void> result = boot->getSuffix(i, cb); EXPECT_TRUE(result.isOk()); EXPECT_TRUE(result.isOk()); char correctSuffix[3]; ASSERT_EQ(0, suffixStr.compare(correctSuffixes[i])); snprintf(correctSuffix, sizeof(correctSuffix), "_%c", 'a' + i); ASSERT_EQ(0, strcmp(suffixPtr, correctSuffix)); } } { { char emptySuffix[] = ""; string emptySuffix = ""; Return<void> result = boot->getSuffix(boot->getNumberSlots(), cb); Return<void> result = boot->getSuffix(boot->getNumberSlots(), cb); EXPECT_TRUE(result.isOk()); EXPECT_TRUE(result.isOk()); ASSERT_EQ(0, strcmp(emptySuffix, suffixPtr)); ASSERT_EQ(0, suffixStr.compare(emptySuffix)); } } } } Loading