update_engine: Fix failing unittests on ARM

A few of the unittests fail when running on ARM. Android has already
fixed those problems and protected them with __ANDROID__. We can just
start using them in Chrome OS too.

BUG=b:165005216
TEST=FEATURES=test emerge-gale update_engine

Change-Id: I7f8820c2ba81f23144257d78aa6c0c599f645e6a
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2460235
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
diff --git a/libcurl_http_fetcher.cc b/libcurl_http_fetcher.cc
index bce0920..1599aac 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -458,10 +458,10 @@
     // There's either more work to do or we are paused, so we just keep the
     // file descriptors to watch up to date and exit, until we are done with the
     // work and we are not paused.
-#ifdef __ANDROID__
-    // When there's no base::SingleThreadTaskRunner on current thread, it's not
-    // possible to watch file descriptors. Just poll it later. This usually
-    // happens if brillo::FakeMessageLoop is used.
+    //
+    // When there's no |base::SingleThreadTaskRunner| on current thread, it's
+    // not possible to watch file descriptors. Just poll it later. This usually
+    // happens if |brillo::FakeMessageLoop| is used.
     if (!base::ThreadTaskRunnerHandle::IsSet()) {
       MessageLoop::current()->PostDelayedTask(
           FROM_HERE,
@@ -470,7 +470,6 @@
           TimeDelta::FromSeconds(1));
       return;
     }
-#endif
     SetupMessageLoopSources();
     return;
   }
diff --git a/libcurl_http_fetcher_unittest.cc b/libcurl_http_fetcher_unittest.cc
index 874ef2e..5d67570 100644
--- a/libcurl_http_fetcher_unittest.cc
+++ b/libcurl_http_fetcher_unittest.cc
@@ -100,7 +100,6 @@
 
   libcurl_fetcher_.BeginTransfer("https://An-uNres0lvable-uRl.invalid");
 
-#ifdef __ANDROID__
   // It's slower on Android that libcurl handle may not finish within 1 cycle.
   // Will need to wait for more cycles until it finishes. Original test didn't
   // correctly handle when we need to re-watch libcurl fds.
@@ -108,10 +107,7 @@
          libcurl_fetcher_.GetAuxiliaryErrorCode() == ErrorCode::kSuccess) {
     loop_.RunOnce(true);
   }
-#else
-  // The first time it can't resolve.
-  loop_.RunOnce(true);
-#endif
+
   EXPECT_EQ(libcurl_fetcher_.GetAuxiliaryErrorCode(),
             ErrorCode::kUnresolvedHostError);
 
@@ -141,7 +137,6 @@
   // easier to mock the part that depends on internet connectivity.
   libcurl_fetcher_.BeginTransfer("https://An-uNres0lvable-uRl.invalid");
 
-#ifdef __ANDROID__
   // It's slower on Android that libcurl handle may not finish within 1 cycle.
   // Will need to wait for more cycles until it finishes. Original test didn't
   // correctly handle when we need to re-watch libcurl fds.
@@ -149,10 +144,7 @@
          libcurl_fetcher_.GetAuxiliaryErrorCode() == ErrorCode::kSuccess) {
     loop_.RunOnce(true);
   }
-#else
-  // The first time it can't resolve.
-  loop_.RunOnce(true);
-#endif
+
   EXPECT_EQ(libcurl_fetcher_.GetAuxiliaryErrorCode(),
             ErrorCode::kUnresolvedHostError);
 
@@ -165,7 +157,6 @@
           [this]() { libcurl_fetcher_.http_response_code_ = 0; }));
   libcurl_fetcher_.transfer_size_ = 10;
 
-#ifdef __ANDROID__
   // It's slower on Android that libcurl handle may not finish within 1 cycle.
   // Will need to wait for more cycles until it finishes. Original test didn't
   // correctly handle when we need to re-watch libcurl fds.
@@ -173,11 +164,7 @@
                                      ErrorCode::kUnresolvedHostError) {
     loop_.RunOnce(true);
   }
-#else
-  // This time the host is resolved. But after that again we can't resolve
-  // anymore (See above).
-  loop_.RunOnce(true);
-#endif
+
   EXPECT_EQ(libcurl_fetcher_.GetAuxiliaryErrorCode(),
             ErrorCode::kUnresolvedHostRecovered);