Chromium Code Reviews| Index: components/metrics/metrics_log_unittest.cc |
| diff --git a/components/metrics/metrics_log_unittest.cc b/components/metrics/metrics_log_unittest.cc |
| index f1a7792f85d45bb5996b2eb9ee808ddde54bf286..bb163d6541a92686487a43659102e3324807227c 100644 |
| --- a/components/metrics/metrics_log_unittest.cc |
| +++ b/components/metrics/metrics_log_unittest.cc |
| @@ -413,4 +413,20 @@ TEST_F(MetricsLogTest, ProductSetIfNotDefault) { |
| EXPECT_EQ(kTestProduct, log.uma_proto().product()); |
| } |
| +TEST_F(MetricsLogTest, TruncateEvents) { |
| + TestMetricsServiceClient client; |
| + TestMetricsLog log(kClientId, kSessionId, MetricsLog::ONGOING_LOG, &client, |
| + &prefs_); |
| + |
| + for (int i = 0; i < internal::kUserActionEventLimit * 2; ++i) { |
| + log.RecordUserAction("BasicAction"); |
| + EXPECT_EQ(i + 1, log.uma_proto().user_action_event_size()); |
| + } |
| + |
| + // Truncate, and check that the current size is the limit. |
| + log.TruncateEvents(); |
| + EXPECT_EQ(internal::kUserActionEventLimit, |
| + log.uma_proto().user_action_event_size()); |
| +} |
|
Alexei Svitkine (slow)
2017/05/30 21:57:00
Nit: Add one for omnibox events too. You can just
rkaplow
2017/05/31 15:17:06
Done.
|
| + |
| } // namespace metrics |