Allow UpdateAttempterAndroid to override otacerts path
For unittest to override otacerts on device, provide a small interface
Test: th
Change-Id: I9e156cbf7135f1afd13a9a7aa23a5245898023e5
diff --git a/payload_consumer/delta_performer.h b/payload_consumer/delta_performer.h
index de6f448..dd71467 100644
--- a/payload_consumer/delta_performer.h
+++ b/payload_consumer/delta_performer.h
@@ -65,19 +65,22 @@
static const unsigned kProgressOperationsWeight;
static const uint64_t kCheckpointFrequencySeconds;
- DeltaPerformer(PrefsInterface* prefs,
- BootControlInterface* boot_control,
- HardwareInterface* hardware,
- DownloadActionDelegate* download_delegate,
- InstallPlan* install_plan,
- InstallPlan::Payload* payload,
- bool interactive)
+ DeltaPerformer(
+ PrefsInterface* prefs,
+ BootControlInterface* boot_control,
+ HardwareInterface* hardware,
+ DownloadActionDelegate* download_delegate,
+ InstallPlan* install_plan,
+ InstallPlan::Payload* payload,
+ bool interactive,
+ std::string update_certificates_path = constants::kUpdateCertificatesPath)
: prefs_(prefs),
boot_control_(boot_control),
hardware_(hardware),
download_delegate_(download_delegate),
install_plan_(install_plan),
payload_(payload),
+ update_certificates_path_(std::move(update_certificates_path)),
interactive_(interactive) {
CHECK(install_plan_);
}
@@ -162,11 +165,6 @@
public_key_path_ = public_key_path;
}
- void set_update_certificates_path(
- const std::string& update_certificates_path) {
- update_certificates_path_ = update_certificates_path;
- }
-
// Return true if header parsing is finished and no errors occurred.
bool IsHeaderParsed() const;
@@ -396,7 +394,7 @@
std::string public_key_path_{constants::kUpdatePayloadPublicKeyPath};
// The path to the zip file with X509 certificates.
- std::string update_certificates_path_{constants::kUpdateCertificatesPath};
+ const std::string update_certificates_path_;
// The number of bytes received so far, used for progress tracking.
size_t total_bytes_received_{0};