Merge "Added Mock function call tests" am: 71c918aa59
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2530985 Change-Id: I08f20227925e58e7d920ffdd69d903c164cb17e5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
a6d6714d3d
2 changed files with 17 additions and 2 deletions
|
|
@ -22,8 +22,7 @@ namespace fastboot {
|
|||
|
||||
class MockFastbootDriver : public IFastBootDriver {
|
||||
public:
|
||||
MOCK_METHOD(RetCode, FlashPartition,
|
||||
(const std::string& partition, android::base::borrowed_fd fd, uint32_t sz),
|
||||
MOCK_METHOD(RetCode, FlashPartition, (const std::string&, android::base::borrowed_fd, uint32_t),
|
||||
(override));
|
||||
MOCK_METHOD(RetCode, DeletePartition, (const std::string&), (override));
|
||||
MOCK_METHOD(RetCode, Reboot, (std::string*, std::vector<std::string>*), (override));
|
||||
|
|
|
|||
|
|
@ -136,3 +136,19 @@ TEST_F(ParseTest, CorrectTaskFormed) {
|
|||
ASSERT_TRUE(tasks[3]->AsUpdateSuperTask());
|
||||
ASSERT_TRUE(tasks[4]->AsWipeTask());
|
||||
}
|
||||
|
||||
TEST_F(ParseTest, CorrectDriverCalls) {
|
||||
fastboot::MockFastbootDriver fb;
|
||||
fp->fb = &fb;
|
||||
|
||||
EXPECT_CALL(fb, RebootTo(_, _, _)).Times(1);
|
||||
EXPECT_CALL(fb, Reboot(_, _)).Times(1);
|
||||
EXPECT_CALL(fb, WaitForDisconnect()).Times(2);
|
||||
|
||||
std::vector<std::string> commands = {"reboot bootloader", "reboot"};
|
||||
std::vector<std::unique_ptr<Task>> tasks = collectTasks(fp.get(), commands);
|
||||
|
||||
for (auto& task : tasks) {
|
||||
task->Run();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue