Blacklist versions as part of Rollback along with unittests.
This CL adds version blacklisting as part of AU Rollback. A few additional
things:
1) Since this pref must persist across rollback I have introduced a
powerwash_safe_prefs as part of system_state that will persist across
powerwashes.
2) Fixed bug where we needed to read the device policy (which is read during an
update_check before Rollback would work).
3) Some refactoring to move pref constants to constants.
4) Passing keepimg into our powerwash command so we don't wipe the old
partitions.
BUG=chromium:252589 chromium:254217
TEST=Unittests + test on device + using rollback with and without powerwash
checking preserve state.
Change-Id: I991fad944594944425fd9941e10b30a919f2b83b
Reviewed-on: https://gerrit.chromium.org/gerrit/59518
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
diff --git a/mock_system_state.h b/mock_system_state.h
index e03546e..8b04f7e 100644
--- a/mock_system_state.h
+++ b/mock_system_state.h
@@ -52,6 +52,10 @@
return prefs_;
}
+ inline virtual PrefsInterface* powerwash_safe_prefs() {
+ return powerwash_safe_prefs_;
+ }
+
inline virtual PayloadStateInterface* payload_state() {
return &mock_payload_state_;
}
@@ -83,10 +87,18 @@
prefs_ = prefs;
}
+ inline void set_powerwash_safe_prefs(PrefsInterface* prefs) {
+ powerwash_safe_prefs_ = prefs;
+ }
+
inline testing::NiceMock<PrefsMock> *mock_prefs() {
return &mock_prefs_;
}
+ inline testing::NiceMock<PrefsMock> *mock_powerwash_safe_prefs() {
+ return &mock_powerwash_safe_prefs_;
+ }
+
inline MockPayloadState* mock_payload_state() {
return &mock_payload_state_;
}
@@ -99,6 +111,7 @@
// These are Mock objects or objects we own.
testing::NiceMock<MetricsLibraryMock> mock_metrics_lib_;
testing::NiceMock<PrefsMock> mock_prefs_;
+ testing::NiceMock<PrefsMock> mock_powerwash_safe_prefs_;
testing::NiceMock<MockPayloadState> mock_payload_state_;
testing::NiceMock<MockGpioHandler>* mock_gpio_handler_;
testing::NiceMock<UpdateAttempterMock>* mock_update_attempter_;
@@ -111,6 +124,7 @@
// These are pointers to objects which caller can override.
ClockInterface* clock_;
PrefsInterface* prefs_;
+ PrefsInterface* powerwash_safe_prefs_;
ConnectionManager* connection_manager_;
OmahaRequestParams* request_params_;
};