| 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();
|
|
|