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_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);