Report Enum metrics from CertificateChecker.
The certificate checker was reporting a "user action" whenever an
update check HTTPS connection or HTTPS payload download had an invalid
HTTPS certificate or a valid one that was changed since the last
connection to the same server.
This patch sends an Enum metric for every HTTPS connection to check for
and update or download the payload with one of the three options: an
invalid certificate, a valid one already seen or a valid but different
certificate.
This patch also moves these metrics to the metrics.{h,cc} module, where
all the other metrics are reported, using an observer pattern in the
CertificateChecker, needed to remove the dependency on the metrics
library from the libpayload_consumer.
Bug: 25818567
TEST=FEATURES=test emerge-link update_engine; mma;
Change-Id: Ia1b6eb799e13b439b520ba14549d8973e18bcbfa
diff --git a/common/mock_http_fetcher.h b/common/mock_http_fetcher.h
index 16d0504..90d34dd 100644
--- a/common/mock_http_fetcher.h
+++ b/common/mock_http_fetcher.h
@@ -24,8 +24,6 @@
#include <brillo/message_loops/message_loop.h>
#include "update_engine/common/http_fetcher.h"
-#include "update_engine/fake_system_state.h"
-#include "update_engine/mock_connection_manager.h"
// This is a mock implementation of HttpFetcher which is useful for testing.
// All data must be passed into the ctor. When started, MockHttpFetcher will
@@ -46,13 +44,12 @@
MockHttpFetcher(const uint8_t* data,
size_t size,
ProxyResolver* proxy_resolver)
- : HttpFetcher(proxy_resolver, &fake_system_state_),
+ : HttpFetcher(proxy_resolver),
sent_size_(0),
timeout_id_(brillo::MessageLoop::kTaskIdNull),
paused_(false),
fail_transfer_(false),
never_use_(false) {
- fake_system_state_.set_connection_manager(&mock_connection_manager_);
data_.insert(data_.end(), data, data + size);
}
@@ -141,9 +138,6 @@
// Set to true if BeginTransfer should EXPECT fail.
bool never_use_;
- FakeSystemState fake_system_state_;
- MockConnectionManager mock_connection_manager_;
-
DISALLOW_COPY_AND_ASSIGN(MockHttpFetcher);
};