Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5583)

Unified Diff: chrome/common/metrics/metrics_log_manager_unittest.cc

Issue 26646003: MetricsService: Send a hash of the UMA log in a header. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/metrics/metrics_log_manager_unittest.cc
===================================================================
--- chrome/common/metrics/metrics_log_manager_unittest.cc (revision 228712)
+++ chrome/common/metrics/metrics_log_manager_unittest.cc (working copy)
@@ -18,13 +18,15 @@
// Dummy serializer that just stores logs in memory.
class DummyLogSerializer : public MetricsLogManager::LogSerializer {
public:
- virtual void SerializeLogs(const std::vector<std::string>& logs,
- MetricsLogManager::LogType log_type) OVERRIDE {
+ virtual void SerializeLogs(
+ const std::vector<MetricsLogManager::SerializedLog>& logs,
+ MetricsLogManager::LogType log_type) OVERRIDE {
persisted_logs_[log_type] = logs;
}
- virtual void DeserializeLogs(MetricsLogManager::LogType log_type,
- std::vector<std::string>* logs) OVERRIDE {
+ virtual void DeserializeLogs(
+ MetricsLogManager::LogType log_type,
+ std::vector<MetricsLogManager::SerializedLog>* logs) OVERRIDE {
ASSERT_NE(static_cast<void*>(NULL), logs);
*logs = persisted_logs_[log_type];
}
@@ -35,7 +37,7 @@
}
// In-memory "persitent storage".
- std::vector<std::string> persisted_logs_[2];
+ std::vector<MetricsLogManager::SerializedLog> persisted_logs_[2];
};
} // namespace
@@ -139,8 +141,8 @@
}
TEST(MetricsLogManagerTest, StoreAndLoad) {
- std::vector<std::string> initial_logs;
- std::vector<std::string> ongoing_logs;
+ std::vector<MetricsLogManager::SerializedLog> initial_logs;
+ std::vector<MetricsLogManager::SerializedLog> ongoing_logs;
// Set up some in-progress logging in a scoped log manager simulating the
// leadup to quitting, then persist as would be done on quit.
@@ -149,7 +151,8 @@
DummyLogSerializer* serializer = new DummyLogSerializer;
log_manager.set_log_serializer(serializer);
// Simulate a log having already been unsent from a previous session.
- std::string log = "proto";
+ MetricsLogManager::SerializedLog log;
+ log.SetLogText("proto");
serializer->persisted_logs_[MetricsLogManager::ONGOING_LOG].push_back(log);
EXPECT_FALSE(log_manager.has_unsent_logs());
log_manager.LoadPersistedUnsentLogs();
« chrome/common/metrics/metrics_log_manager.h ('K') | « chrome/common/metrics/metrics_log_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698