summaryrefslogtreecommitdiffstats
path: root/updater/include/private/commands.h
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-07-09 19:49:07 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-07-09 19:49:07 +0200
commitb450952d6aec60cea05fc2a6728b37a8ba13c57e (patch)
treed17cd00549fddc484bdb926f66287ee76cc692cf /updater/include/private/commands.h
parentMerge "tests: Split unit tests out of component/applypatch_test.cpp." (diff)
parentMerge "updater: Add ABORT command." (diff)
downloadandroid_bootable_recovery-b450952d6aec60cea05fc2a6728b37a8ba13c57e.tar
android_bootable_recovery-b450952d6aec60cea05fc2a6728b37a8ba13c57e.tar.gz
android_bootable_recovery-b450952d6aec60cea05fc2a6728b37a8ba13c57e.tar.bz2
android_bootable_recovery-b450952d6aec60cea05fc2a6728b37a8ba13c57e.tar.lz
android_bootable_recovery-b450952d6aec60cea05fc2a6728b37a8ba13c57e.tar.xz
android_bootable_recovery-b450952d6aec60cea05fc2a6728b37a8ba13c57e.tar.zst
android_bootable_recovery-b450952d6aec60cea05fc2a6728b37a8ba13c57e.zip
Diffstat (limited to 'updater/include/private/commands.h')
-rw-r--r--updater/include/private/commands.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/updater/include/private/commands.h b/updater/include/private/commands.h
index 784892fb5..087d7cfbf 100644
--- a/updater/include/private/commands.h
+++ b/updater/include/private/commands.h
@@ -213,9 +213,13 @@ class PatchInfo {
// - Free the given stash data.
// - Meaningful args: StashInfo
//
+// abort
+// - Abort the current update. Allowed for testing code only.
+//
class Command {
public:
enum class Type {
+ ABORT,
BSDIFF,
ERASE,
FREE,
@@ -280,6 +284,11 @@ class Command {
}
private:
+ friend class ResumableUpdaterTest;
+ friend class UpdaterTest;
+
+ FRIEND_TEST(CommandsTest, Parse_ABORT_Allowed);
+ FRIEND_TEST(CommandsTest, Parse_InvalidNumberOfArgs);
FRIEND_TEST(CommandsTest, ParseTargetInfoAndSourceInfo_InvalidInput);
FRIEND_TEST(CommandsTest, ParseTargetInfoAndSourceInfo_StashesOnly);
FRIEND_TEST(CommandsTest, ParseTargetInfoAndSourceInfo_SourceBlocksAndStashes);
@@ -293,6 +302,9 @@ class Command {
const std::string& src_hash, SourceInfo* source,
std::string* err);
+ // Allows parsing ABORT command, which should be used for testing purpose only.
+ static bool abort_allowed_;
+
// The type of the command.
Type type_{ Type::LAST };
// The index of the Command object, which is specified by the caller.