Add unittest for resume update
Test: treehugger
Bug: 173392916
Change-Id: I4b320685af93b20fc1f4abcdd6a416f1c97731ab
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index c3a321e..be39542 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -1443,7 +1443,14 @@
TEST_AND_RETURN_FALSE(
prefs_->SetInt64(kPrefsUpdateStateNextDataLength, 0));
}
- partition_writer_->CheckpointUpdateProgress(GetPartitionOperationNum());
+ if (partition_writer_) {
+ partition_writer_->CheckpointUpdateProgress(GetPartitionOperationNum());
+ } else {
+ CHECK_EQ(next_operation_num_, num_total_operations_)
+ << "Partition writer is null, we are expected to finish all "
+ "operations: "
+ << next_operation_num_ << "/" << num_total_operations_;
+ }
}
TEST_AND_RETURN_FALSE(
prefs_->SetInt64(kPrefsUpdateStateNextOperation, next_operation_num_));