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/main.cc b/main.cc
index 52e9c9e..b96add3 100644
--- a/main.cc
+++ b/main.cc
@@ -16,6 +16,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include "update_engine/certificate_checker.h"
 #include "update_engine/dbus_constants.h"
 #include "update_engine/dbus_interface.h"
 #include "update_engine/dbus_service.h"
@@ -172,6 +173,13 @@
   MetricsLibrary metrics_lib;
   metrics_lib.Init();
 
+  // Sets static members for the certificate checker.
+  chromeos_update_engine::CertificateChecker::set_metrics_lib(&metrics_lib);
+  chromeos_update_engine::CertificateChecker::set_prefs(&prefs);
+  chromeos_update_engine::OpenSSLWrapper openssl_wrapper;
+  chromeos_update_engine::CertificateChecker::set_openssl_wrapper(
+      &openssl_wrapper);
+
   // Create the update attempter:
   chromeos_update_engine::ConcreteDbusGlib dbus;
   chromeos_update_engine::UpdateAttempter update_attempter(&prefs,