Add UMA metrics for detecting and reporting update certificate changes.
LibcurlHttpFetcher checks if the update server certificate has changed
since last update, and stores an eventual report in prefs. UpdateCheckScheduler
submits to UMA reports from the previous update.
BUG=chromium-os:19842
TEST=Included unittest for the new class and tested locally on an Alex device,
since we need to verify against the actual server certificates.
Change-Id: I5bee5d648982cd7618db09b67d5bff377eaa1fc1
Reviewed-on: http://gerrit.chromium.org/gerrit/7565
Reviewed-by: Bruno Pontes Soares Rocha <bpontes@chromium.org>
Tested-by: Bruno Pontes Soares Rocha <bpontes@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index 57ddc66..8953803 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -20,6 +20,7 @@
#include <policy/libpolicy.h>
#include <policy/device_policy.h>
+#include "update_engine/certificate_checker.h"
#include "update_engine/dbus_service.h"
#include "update_engine/download_action.h"
#include "update_engine/filesystem_copier_action.h"
@@ -195,6 +196,7 @@
// Try harder to connect to the network, esp when not interactive.
// See comment in libcurl_http_fetcher.cc.
update_check_fetcher->set_no_network_max_retries(interactive ? 1 : 3);
+ update_check_fetcher->set_check_certificate(CertificateChecker::kUpdate);
shared_ptr<OmahaRequestAction> update_check_action(
new OmahaRequestAction(prefs_,
omaha_request_params_,
@@ -214,9 +216,13 @@
OmahaEvent::kTypeUpdateDownloadStarted),
new LibcurlHttpFetcher(GetProxyResolver()),
false));
+ LibcurlHttpFetcher* download_fetcher =
+ new LibcurlHttpFetcher(GetProxyResolver());
+ download_fetcher->set_check_certificate(CertificateChecker::kDownload);
shared_ptr<DownloadAction> download_action(
- new DownloadAction(prefs_, new MultiRangeHTTPFetcher(
- new LibcurlHttpFetcher(GetProxyResolver()))));
+ new DownloadAction(prefs_,
+ new MultiRangeHTTPFetcher(
+ download_fetcher))); // passes ownership
shared_ptr<OmahaRequestAction> download_finished_action(
new OmahaRequestAction(prefs_,
omaha_request_params_,