Don't allow rollback when we are enterprise enrolled.
As stated (and verified) by the device_policy protobuf, we can determine
whether a device is enterprise enrolled by checking if GetOwner is empty.
We use this knowledge to not allow rollback when powerwash is also requested (
the default).
As part of this CL I've figured out how to unittest Rollback and added tests
for both enterprise and non-enterprise rollback.
BUG=chromium:254829
TEST=Tested on both an enrolled and non-enrolled device. Verified only the
latter actually did a powerwash while the other aborted correctly. Also ran
new unittests
Change-Id: Idfe6bfef88819fe1bab7da6b31854faf7642c9ce
Reviewed-on: https://gerrit.chromium.org/gerrit/61645
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
diff --git a/update_attempter.h b/update_attempter.h
index d6015ee..423fb88 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -147,8 +147,9 @@
// This is the internal entry point for going through a rollback. This will
// attempt to run the postinstall on the non-active partition and set it as
// the partition to boot from. If |powerwash| is True, perform a powerwash
- // as part of rollback. Returns True on success.
- bool Rollback(bool powerwash);
+ // as part of rollback. If |install_path| is set, use this value to determine
+ // the partitions to roll back to (used in testing). Returns True on success.
+ bool Rollback(bool powerwash, std::string* install_path);
// Initiates a reboot if the current state is
// UPDATED_NEED_REBOOT. Returns true on sucess, false otherwise.