Merge "Adding correct task formed test"
This commit is contained in:
commit
62a73c395c
1 changed files with 15 additions and 0 deletions
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "task.h"
|
||||
#include "fastboot.h"
|
||||
#include "fastboot_driver_mock.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <fstream>
|
||||
|
|
@ -24,6 +25,7 @@
|
|||
#include <unordered_map>
|
||||
#include "android-base/strings.h"
|
||||
using android::base::Split;
|
||||
using testing::_;
|
||||
|
||||
class ParseTest : public ::testing ::Test {
|
||||
protected:
|
||||
|
|
@ -121,3 +123,16 @@ TEST_F(ParseTest, BAD_FASTBOOT_INFO_INPUT) {
|
|||
ASSERT_EQ(ParseCommand(fp.get(), "erase dtbo dtbo"), nullptr);
|
||||
ASSERT_EQ(ParseCommand(fp.get(), "wipe this"), nullptr);
|
||||
}
|
||||
|
||||
TEST_F(ParseTest, CORRECT_TASK_FORMED) {
|
||||
std::vector<std::string> commands = {"flash dtbo", "flash --slot-other system system_other.img",
|
||||
"reboot bootloader", "update-super", "erase cache"};
|
||||
std::vector<std::unique_ptr<Task>> tasks = collectTasks(fp.get(), commands);
|
||||
|
||||
ASSERT_TRUE(tasks[0]->AsFlashTask());
|
||||
ASSERT_TRUE(tasks[0]->AsFlashTask());
|
||||
ASSERT_TRUE(tasks[1]->AsFlashTask());
|
||||
ASSERT_TRUE(tasks[2]->AsRebootTask());
|
||||
ASSERT_TRUE(tasks[3]->AsUpdateSuperTask());
|
||||
ASSERT_TRUE(tasks[4]->AsWipeTask());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue