diff options
author | Tianjie Xu <xunchang@google.com> | 2019-05-22 02:54:23 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-05-22 02:54:23 +0200 |
commit | 3a961fa48cc7ee049a1088cd424c7f76ab116ce1 (patch) | |
tree | 3debddd730b001dc81418f56f17193984008f119 /tests | |
parent | Merge "Add misc_writer." am: 962f7e0c0c am: f9fb4878fc am: 70bc3c40d2 (diff) | |
parent | Merge "Add UpdaterRuntime class" am: e7b3c5698e am: c6d7065880 (diff) | |
download | android_bootable_recovery-3a961fa48cc7ee049a1088cd424c7f76ab116ce1.tar android_bootable_recovery-3a961fa48cc7ee049a1088cd424c7f76ab116ce1.tar.gz android_bootable_recovery-3a961fa48cc7ee049a1088cd424c7f76ab116ce1.tar.bz2 android_bootable_recovery-3a961fa48cc7ee049a1088cd424c7f76ab116ce1.tar.lz android_bootable_recovery-3a961fa48cc7ee049a1088cd424c7f76ab116ce1.tar.xz android_bootable_recovery-3a961fa48cc7ee049a1088cd424c7f76ab116ce1.tar.zst android_bootable_recovery-3a961fa48cc7ee049a1088cd424c7f76ab116ce1.zip |
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/updater_test.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/unit/updater_test.cpp b/tests/unit/updater_test.cpp index 4a8d1e6ff..81229f50a 100644 --- a/tests/unit/updater_test.cpp +++ b/tests/unit/updater_test.cpp @@ -52,13 +52,14 @@ #include "updater/blockimg.h" #include "updater/install.h" #include "updater/updater.h" +#include "updater/updater_runtime.h" using namespace std::string_literals; using PackageEntries = std::unordered_map<std::string, std::string>; static void expect(const char* expected, const std::string& expr_str, CauseCode cause_code, - Updater* updater = nullptr) { + Updater* updater) { std::unique_ptr<Expr> e; int error_count = 0; ASSERT_EQ(0, ParseString(expr_str, &e, &error_count)); @@ -83,6 +84,11 @@ static void expect(const char* expected, const std::string& expr_str, CauseCode ASSERT_EQ(cause_code, state.cause_code); } +static void expect(const char* expected, const std::string& expr_str, CauseCode cause_code) { + Updater updater; + expect(expected, expr_str, cause_code, &updater); +} + static void BuildUpdatePackage(const PackageEntries& entries, int fd) { FILE* zip_file_ptr = fdopen(fd, "wb"); ZipWriter zip_writer(zip_file_ptr); @@ -168,9 +174,9 @@ class UpdaterTestBase { // Set up the handler, command_pipe, patch offset & length. TemporaryFile temp_pipe; - ASSERT_TRUE(updater_.Init(temp_pipe.release(), zip_file.path, false, nullptr)); + ASSERT_TRUE(updater_.Init(temp_pipe.release(), zip_file.path, false)); ASSERT_TRUE(updater_.RunUpdate()); - ASSERT_EQ(result, updater_.result()); + ASSERT_EQ(result, updater_.GetResult()); // Parse the cause code written to the command pipe. int received_cause_code = kNoCause; |