Add unittest for set next op index
In order to add this unittest, we need to ensure that a checkpoint is
saved after each InstallOp. However, current logic throttles checkpoint
by time, it also skips checkpoint if buffer offset is the same. To
address these issues,
1. Add a ShouldCheckpoint() to control whether to throttle
checkpoint based on time, unittest overrides this and just
return true
2. Modify logic to only skip a checkpoint if operation_index
hasn't changed. For SOURCE_COPY operations, buffer offset won't
be advanced but operation index will.
Test: treehugger
Change-Id: Ib81bfe0c4ecb7200096b4b22390fb1f2fcff1581
diff --git a/payload_consumer/partition_writer.h b/payload_consumer/partition_writer.h
index 4b420d2..82e557a 100644
--- a/payload_consumer/partition_writer.h
+++ b/payload_consumer/partition_writer.h
@@ -29,6 +29,7 @@
#include "update_engine/payload_consumer/file_descriptor.h"
#include "update_engine/payload_consumer/install_plan.h"
#include "update_engine/update_metadata.pb.h"
+
namespace chromeos_update_engine {
class PartitionWriter {
public: