update_engine: Log when EOL date is set + retrieved

autoupdate_EOL autotests seems to fail and return a default EOL date
value of -9999. This logging helps pinpoint whether prefs are the
culprit.

BUG=chromium:1090283
TEST=FEATURES=test emerge-$B update_engine update_engine-client

Change-Id: If2feb4841d2642af89dac94e699a30a7ee2fb002
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2227031
Tested-by: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Auto-Submit: Jae Hoon Kim <kimjae@chromium.org>
Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index 745bcc2..0086dd5 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -2343,6 +2343,7 @@
 
 TEST_F(UpdateAttempterTest, FutureEolTest) {
   EolDate eol_date = std::numeric_limits<int64_t>::max();
+  EXPECT_CALL(*prefs_, Exists(kPrefsOmahaEolDate)).WillOnce(Return(true));
   EXPECT_CALL(*prefs_, GetString(kPrefsOmahaEolDate, _))
       .WillOnce(
           DoAll(SetArgPointee<1>(EolDateToString(eol_date)), Return(true)));
@@ -2354,6 +2355,7 @@
 
 TEST_F(UpdateAttempterTest, PastEolTest) {
   EolDate eol_date = 1;
+  EXPECT_CALL(*prefs_, Exists(kPrefsOmahaEolDate)).WillOnce(Return(true));
   EXPECT_CALL(*prefs_, GetString(kPrefsOmahaEolDate, _))
       .WillOnce(
           DoAll(SetArgPointee<1>(EolDateToString(eol_date)), Return(true)));
@@ -2364,13 +2366,21 @@
 }
 
 TEST_F(UpdateAttempterTest, FailedEolTest) {
-  EolDate eol_date = kEolDateInvalid;
+  EXPECT_CALL(*prefs_, Exists(kPrefsOmahaEolDate)).WillOnce(Return(true));
   EXPECT_CALL(*prefs_, GetString(kPrefsOmahaEolDate, _))
       .WillOnce(Return(false));
 
   UpdateEngineStatus status;
   attempter_.GetStatus(&status);
-  EXPECT_EQ(eol_date, status.eol_date);
+  EXPECT_EQ(kEolDateInvalid, status.eol_date);
+}
+
+TEST_F(UpdateAttempterTest, MissingEolTest) {
+  EXPECT_CALL(*prefs_, Exists(kPrefsOmahaEolDate)).WillOnce(Return(false));
+
+  UpdateEngineStatus status;
+  attempter_.GetStatus(&status);
+  EXPECT_EQ(kEolDateInvalid, status.eol_date);
 }
 
 TEST_F(UpdateAttempterTest, CalculateDlcParamsInstallTest) {