Support for processing multiple URLs in update_engine.
Main changes:
1. Added a new PayloadState class which encapsulates all the persisted
state we use for multiple URLs, back-off (TBD), etc.
2. Added support for handling multiple URLs stored in the OmahaResponse in
OmahaRequestAction and OmahaResponseHandlerAction code.
3. Added support for picking the right URL in OmahaResponseHandlerAction
and putting it in the install_plan. This way, the rest of the code that
uses the install_plan is oblivious to the presence of multiple URLs :-)
4. Added support for advancing to next URL when an update fails. The full
error classification is a new work item (chromium-os:37206). Right now,
it's a basic round-robin on every error.
5. Updated the conditions for determining when hash checks are mandatory.
Previously since there was only one URL, if it was HTTPS, the checks were
waived. Now, even if there's one HTTP URL, we make hash checks mandatory
even if other HTTPS URLs are present.
6. Added new unit tests for PayloadState and the new logic added to other
places.
Noisy changes:
1. Instead of passing PrefsInterface to OmahaRequestAction and
OmahaResponseHandlerAction, we're now passing SystemState which will now
contain PrefsInterface and the newly added PayloadState object that these
actions need to do their work.
2. Renamed a bunch of setters/getters to set_x() and x() instead of SetX()
and GetX() methods - this was pending from Gilad's old CR. As I'm
adding new methods in the correct style, I went ahead and fixed it to
avoid the confusing styles.
3. Updated all existing unit tests to reflect these changes.
BUG=chromium-os:36807
TEST=All Single/Multiple URL scenarios work fine on my ZGB as expected.
TEST=Old and new unit tests run fine.
Change-Id: Id31f9ccb220471f3ec3a475f624dc03c16119144
Reviewed-on: https://gerrit.chromium.org/gerrit/39638
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/update_attempter_mock.h b/update_attempter_mock.h
index d23bdb6..6432cd8 100644
--- a/update_attempter_mock.h
+++ b/update_attempter_mock.h
@@ -8,14 +8,16 @@
#include <gmock/gmock.h>
#include "update_engine/mock_dbus_interface.h"
+#include "update_engine/mock_system_state.h"
#include "update_engine/update_attempter.h"
namespace chromeos_update_engine {
class UpdateAttempterMock : public UpdateAttempter {
public:
- explicit UpdateAttempterMock(MockDbusGlib* dbus)
- : UpdateAttempter(NULL, dbus, NULL, NULL) {}
+ explicit UpdateAttempterMock(MockSystemState* mock_system_state,
+ MockDbusGlib* dbus)
+ : UpdateAttempter(mock_system_state, dbus, NULL) {}
MOCK_METHOD6(Update, void(const std::string& app_version,
const std::string& omaha_url,