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

Side by Side Diff: components/metrics/metrics_log_manager_unittest.cc

Issue 2610653003: Remove old-format PersistedLogs support (Closed)
Patch Set: Remove old-format PersistedLogs support Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « components/metrics/metrics_log_manager.cc ('k') | components/metrics/metrics_pref_names.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/metrics/metrics_log_manager.h" 5 #include "components/metrics/metrics_log_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 { 160 {
161 MetricsLogManager log_manager(&pref_service, 0); 161 MetricsLogManager log_manager(&pref_service, 0);
162 log_manager.LoadPersistedUnsentLogs(); 162 log_manager.LoadPersistedUnsentLogs();
163 163
164 // Simulate a log having already been unsent from a previous session. 164 // Simulate a log having already been unsent from a previous session.
165 { 165 {
166 std::string log("proto"); 166 std::string log("proto");
167 PersistedLogs ongoing_logs(std::unique_ptr<PersistedLogsMetricsImpl>( 167 PersistedLogs ongoing_logs(std::unique_ptr<PersistedLogsMetricsImpl>(
168 new PersistedLogsMetricsImpl()), 168 new PersistedLogsMetricsImpl()),
169 &pref_service, prefs::kMetricsOngoingLogs, 169 &pref_service, prefs::kMetricsOngoingLogs,
170 prefs::kDeprecatedMetricsOngoingLogs, 1, 1, 0); 170 1, 1, 0);
171 ongoing_logs.StoreLog(log); 171 ongoing_logs.StoreLog(log);
172 ongoing_logs.SerializeLogs(); 172 ongoing_logs.SerializeLogs();
173 } 173 }
174 EXPECT_EQ(1U, pref_service.TypeCount(MetricsLog::ONGOING_LOG)); 174 EXPECT_EQ(1U, pref_service.TypeCount(MetricsLog::ONGOING_LOG));
175 EXPECT_FALSE(log_manager.has_unsent_logs()); 175 EXPECT_FALSE(log_manager.has_unsent_logs());
176 log_manager.LoadPersistedUnsentLogs(); 176 log_manager.LoadPersistedUnsentLogs();
177 EXPECT_TRUE(log_manager.has_unsent_logs()); 177 EXPECT_TRUE(log_manager.has_unsent_logs());
178 178
179 log_manager.BeginLoggingWithLog(base::MakeUnique<MetricsLog>( 179 log_manager.BeginLoggingWithLog(base::MakeUnique<MetricsLog>(
180 "id", 0, MetricsLog::INITIAL_STABILITY_LOG, &client, &pref_service)); 180 "id", 0, MetricsLog::INITIAL_STABILITY_LOG, &client, &pref_service));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 log_manager.FinishCurrentLog(); 301 log_manager.FinishCurrentLog();
302 log_manager.DiscardStagedLog(); 302 log_manager.DiscardStagedLog();
303 303
304 log_manager.PersistUnsentLogs(); 304 log_manager.PersistUnsentLogs();
305 EXPECT_EQ(0U, pref_service.TypeCount(MetricsLog::INITIAL_STABILITY_LOG)); 305 EXPECT_EQ(0U, pref_service.TypeCount(MetricsLog::INITIAL_STABILITY_LOG));
306 EXPECT_EQ(1U, pref_service.TypeCount(MetricsLog::ONGOING_LOG)); 306 EXPECT_EQ(1U, pref_service.TypeCount(MetricsLog::ONGOING_LOG));
307 } 307 }
308 } 308 }
309 309
310 } // namespace metrics 310 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/metrics_log_manager.cc ('k') | components/metrics/metrics_pref_names.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698