Allow null SystemState in the DownloadAction.
The SystemState is only defined in the libupdate_engine library, so
it may not be defined for other users of libpayload_consumer. This
patch allows to pass a nullptr for the SystemState while explicitly
passing the other classes defined in libpayload_consumer upon
construction.
Bug: None
TEST=FEATURES=test emerge-link update_engine
TEST=`mmma system/update_engine` on aosp_arm-eng and edison-eng
Change-Id: I535d0184a85e0a167ac65875f6e7c07832efbf40
diff --git a/payload_consumer/download_action_unittest.cc b/payload_consumer/download_action_unittest.cc
index 08053bf..60cc6f2 100644
--- a/payload_consumer/download_action_unittest.cc
+++ b/payload_consumer/download_action_unittest.cc
@@ -166,7 +166,11 @@
data.size(),
nullptr);
// takes ownership of passed in HttpFetcher
- DownloadAction download_action(&prefs, &fake_system_state, http_fetcher);
+ DownloadAction download_action(&prefs,
+ fake_system_state.boot_control(),
+ fake_system_state.hardware(),
+ &fake_system_state,
+ http_fetcher);
download_action.SetTestFileWriter(&writer);
BondActions(&feeder_action, &download_action);
MockDownloadActionDelegate download_delegate;
@@ -278,10 +282,12 @@
feeder_action.set_obj(install_plan);
FakeSystemState fake_system_state_;
MockPrefs prefs;
- DownloadAction download_action(&prefs, &fake_system_state_,
- new MockHttpFetcher(data.data(),
- data.size(),
- nullptr));
+ DownloadAction download_action(
+ &prefs,
+ fake_system_state_.boot_control(),
+ fake_system_state_.hardware(),
+ &fake_system_state_,
+ new MockHttpFetcher(data.data(), data.size(), nullptr));
download_action.SetTestFileWriter(&writer);
MockDownloadActionDelegate download_delegate;
if (use_download_delegate) {
@@ -381,7 +387,10 @@
feeder_action.set_obj(install_plan);
MockPrefs prefs;
FakeSystemState fake_system_state_;
- DownloadAction download_action(&prefs, &fake_system_state_,
+ DownloadAction download_action(&prefs,
+ fake_system_state_.boot_control(),
+ fake_system_state_.hardware(),
+ &fake_system_state_,
new MockHttpFetcher("x", 1, nullptr));
download_action.SetTestFileWriter(&writer);
@@ -469,7 +478,10 @@
data_.length(),
nullptr);
// Note that DownloadAction takes ownership of the passed in HttpFetcher.
- download_action_.reset(new DownloadAction(&prefs, &fake_system_state_,
+ download_action_.reset(new DownloadAction(&prefs,
+ fake_system_state_.boot_control(),
+ fake_system_state_.hardware(),
+ &fake_system_state_,
http_fetcher_));
download_action_->SetTestFileWriter(&writer);
BondActions(&feeder_action, download_action_.get());