summaryrefslogtreecommitdiff
path: root/libcurl_http_fetcher_unittest.cc
AgeCommit message (Collapse)Author
2020-10-08update_engine: Fix failing unittests on ARMAmin Hassani
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>
2020-07-23Update UE to remove MessageLoop::current()->WatchFileDescriptor.Tianjie
MessageLoop::current()->WatchFileDescriptor is deprecated. And UE should remove usages of it. Test: mma && unittest Change-Id: Ib1ef2e6b6a38ad2a8d07b78bcd72fdb3b7f82226
2020-07-06Merge remote-tracking branch 'aosp/upstream-master' into mergeTianjie
It's a merge from chrome OS with some reverts. 1. the fd watcher change, because the libbrillo version isn't compatible in aosp. commit 6955bcc4ffe4cc9d62a88186b9a7e75d095a7897 commit 493fecb3f48c8478fd3ef244d631d857730dd14d 2. two libcurl unittest. Because the RunOnce() of the fake message loop seems to have different behavior in aosp. commit d3d84218cafbc1a95e7d6bbb775b495d1bebf4d2 Put preprocessor guards to use the old code in aosp. And we can switch to the new code in the other path after adopting the new libbrillo & libchrome. Test: unit tests pass, apply an OTA Change-Id: Id613599834b0f44f92841dbeae6303601db5490d
2019-09-11update_engine: Add internal error codes that used for metrics.Amin Hassani
Whenever we are dealing with some problem that require defining error codes and sending UMA metrics, we need to define a new ErrorCode enum value. These error codes then will be used to send which UMA metric value to send. Some of the UMA metrics seems to have circumvent this process by introducing their own error codes without adding them to the global list of error codes. This CL introduces three new error codes: - kInternalLibCurlError - kUnresolvedHostError - kUnresolvedHostRecovered (Technically not an error code, but fits the description and use case of it.) That are then translated to the UMA metric values we send for DownloadErrorCode. In addition, this CL moves the responsibility of sending these UMA metrics from LibCurlHttpFetcher to OmahaRequestAction which is the more correct place to send it because that's where the operations are completed (success or failure) and we can safely decide on the value of UMA without risking to send overlapping or duplicated metrics. For example, previously we send kInternalLibCurlError in conjunction with the kUnresolvedHostError. But doing this can hide the fact that these two error codes might be related and caused by the same underlying issue. Same goes for kUnresolvedHostError and kUnresolvedHosRecovered. If we send both these metrics at the same time, then we need to subtract the number of kUnresolvedHosRecovered from kUnresolvedHostError to figure out the number of unresolved host errors that did not recover. By exclusively sending one or another. We can see exactly how many are recovered and how many did not. Although this might change the meaning of kUnresolvedHostError metric, in the long term it will not be an issue as all the results will converge to the new behavior. The enum.xml (chrome) is updated in crrev.com/c/1774101 BUG=None TEST=cros_workon_make --board=amd64-generic --test --noreconf update_engine Change-Id: I3c7bb5f6159a0bc3a37d55666572b9cd6730f3cb Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1759544 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2019-07-19update_engine: call res_init and retry one extra time on unresolved hostXiaochu Liu
libcurl error Based on https://curl.haxx.se/docs/todo.html#updated_DNS_server_while_running: "If /etc/resolv.conf gets updated while a program using libcurl is running, it may cause name resolves to fail unless res_init() is called. We should consider calling res_init() + retry once unconditionally on all name resolve failures to mitigate against this." This CL added following behavior: On libcurl returns CURLE_COULDNT_RESOLVE_HOST error code: 1. we increase the max retry count by 1 for the first time it happens in the lifetime of an LibcurlHttpFetcher object. 2. we call res_init unconditionally. We also add UMA metrics to measure whether calling res_init helps mitigate the unresolved host problem. WIP CL: https://chromium-review.googlesource.com/c/chromium/src/+/1698722 BUG=chromium:982813 TEST=FEATURES="test" emerge-kefka update_engine, tested on a device Change-Id: Ia894eae93b3a0adbac1a831e657b75cba835dfa0
2019-07-03update_engine: Attach session ID to HTTP header of binary downloadJae Hoon Kim
In order for Omaha to correlate Omaha Client requests with the actual binary download, the session ID must be attached to the HTTP header of the binary download in the X-Goog-Update-SessionId. Also, remove the HTTP header of X-Goog-Update-SessionId added into the Omaha requests. BUG=chromium:940515 TEST=unittests # new unittests Change-Id: I0759562f2d1c8c003064ad976ca1ae6ce039b960