Prefs: Implement and use Prefs::GetBoolean/SetBoolean.
Adds a pair of functions GetBoolean/SetBoolean to the list Prefs
class to read and write persisted boolean values. The stored
values are not compatible with the SetInt64 and will return
false when attempting to get or set a value of the other type.
These functions are now used to store the update over cellular
user setting.
BUG=chromium:213401
TEST=sudo ./update_engine_unittests
Change-Id: I44107e33f8e81ae900671d9ba6a4f5779c2353db
Reviewed-on: https://gerrit.chromium.org/gerrit/61352
Reviewed-by: Joy Chen <joychen@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/connection_manager_unittest.cc b/connection_manager_unittest.cc
index 724061b..5271ee1 100644
--- a/connection_manager_unittest.cc
+++ b/connection_manager_unittest.cc
@@ -306,18 +306,18 @@
EXPECT_CALL(*prefs, Exists(kPrefsUpdateOverCellularPermission))
.Times(1)
.WillOnce(Return(true));
- EXPECT_CALL(*prefs, GetInt64(kPrefsUpdateOverCellularPermission, _))
+ EXPECT_CALL(*prefs, GetBoolean(kPrefsUpdateOverCellularPermission, _))
.Times(1)
- .WillOnce(DoAll(SetArgumentPointee<1>(1), Return(true)));
+ .WillOnce(DoAll(SetArgumentPointee<1>(true), Return(true)));
EXPECT_TRUE(cmut_.IsUpdateAllowedOver(kNetCellular));
// Block per user pref.
EXPECT_CALL(*prefs, Exists(kPrefsUpdateOverCellularPermission))
.Times(1)
.WillOnce(Return(true));
- EXPECT_CALL(*prefs, GetInt64(kPrefsUpdateOverCellularPermission, _))
+ EXPECT_CALL(*prefs, GetBoolean(kPrefsUpdateOverCellularPermission, _))
.Times(1)
- .WillOnce(DoAll(SetArgumentPointee<1>(0), Return(true)));
+ .WillOnce(DoAll(SetArgumentPointee<1>(false), Return(true)));
EXPECT_FALSE(cmut_.IsUpdateAllowedOver(kNetCellular));
}