MockSystemState: Initialize connection_manager_ member.
Turns out this is not initialized so any code using
connection_manager() will get a garbage pointer when using
MockSystemState (unless set_connection_manager() has been used, of
course).
BUG=chromium:358339
TEST=Unit tests pass.
Change-Id: Ib528613b61130c2ad167999b6d084b12b3883c89
Reviewed-on: https://chromium-review.googlesource.com/192863
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
diff --git a/mock_system_state.cc b/mock_system_state.cc
index fa6622b..0ad110b 100644
--- a/mock_system_state.cc
+++ b/mock_system_state.cc
@@ -26,11 +26,14 @@
mock_gpio_handler_ = new testing::NiceMock<MockGpioHandler>();
mock_update_attempter_ = new testing::NiceMock<UpdateAttempterMock>(
this, &dbus_);
+ mock_connection_manager_ = new testing::NiceMock<MockConnectionManager>(this);
+ connection_manager_ = mock_connection_manager_;
fake_policy_manager_.Init(FakeState::Construct());
}
MockSystemState::~MockSystemState() {
delete mock_gpio_handler_;
+ delete mock_connection_manager_;
}
UpdateAttempter* MockSystemState::update_attempter() {
diff --git a/mock_system_state.h b/mock_system_state.h
index 16cf701..33d1b1e 100644
--- a/mock_system_state.h
+++ b/mock_system_state.h
@@ -12,6 +12,7 @@
#include "update_engine/clock.h"
#include "update_engine/fake_hardware.h"
+#include "update_engine/mock_connection_manager.h"
#include "update_engine/mock_dbus_wrapper.h"
#include "update_engine/mock_gpio_handler.h"
#include "update_engine/mock_p2p_manager.h"
@@ -151,6 +152,7 @@
testing::NiceMock<MockPayloadState> mock_payload_state_;
testing::NiceMock<MockGpioHandler>* mock_gpio_handler_;
testing::NiceMock<UpdateAttempterMock>* mock_update_attempter_;
+ testing::NiceMock<MockConnectionManager>* mock_connection_manager_;
MockDBusWrapper dbus_;
// These are the other object we own.