Collect android metrics for bytes downloaded
Report bytes downloaded for update attempts and successful updates.
Prefs used to help metrics report:
kPrefsCurrentBytesDownloaded
kPrefsTotalBytesDownloaded
Bug: 30989466
Test: unittest pass
Change-Id: I7d213204ee2757551ad914c122a274965dfbff06
diff --git a/common/test_utils.h b/common/test_utils.h
index ba9f5f2..ddb3d34 100644
--- a/common/test_utils.h
+++ b/common/test_utils.h
@@ -31,6 +31,7 @@
#include <base/callback.h>
#include <base/files/file_path.h>
#include <base/files/scoped_temp_dir.h>
+#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "update_engine/common/action.h"
@@ -101,6 +102,11 @@
void FillWithData(brillo::Blob* buffer);
+// Compare the value of native array for download source parameter.
+MATCHER_P(DownloadSourceMatcher, source_array, "") {
+ return std::equal(source_array, source_array + kNumDownloadSources, arg);
+}
+
// Class to unmount FS when object goes out of scope
class ScopedFilesystemUnmounter {
public: