| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/ukm/ukm_service.h" | 5 #include "components/ukm/ukm_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/test/test_simple_task_runner.h" | 10 #include "base/test/test_simple_task_runner.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 Report GetPersistedReport() { | 43 Report GetPersistedReport() { |
| 44 EXPECT_GE(GetPersistedLogCount(), 1); | 44 EXPECT_GE(GetPersistedLogCount(), 1); |
| 45 metrics::PersistedLogs result_persisted_logs( | 45 metrics::PersistedLogs result_persisted_logs( |
| 46 base::MakeUnique<ukm::PersistedLogsMetricsImpl>(), &prefs_, | 46 base::MakeUnique<ukm::PersistedLogsMetricsImpl>(), &prefs_, |
| 47 prefs::kUkmPersistedLogs, | 47 prefs::kUkmPersistedLogs, |
| 48 3, // log count limit | 48 3, // log count limit |
| 49 1000, // byte limit | 49 1000, // byte limit |
| 50 0); | 50 0); |
| 51 | 51 |
| 52 result_persisted_logs.DeserializeLogs(); | 52 result_persisted_logs.LoadPersistedUnsentLogs(); |
| 53 result_persisted_logs.StageLog(); | 53 result_persisted_logs.StageNextLog(); |
| 54 | 54 |
| 55 std::string uncompressed_log_data; | 55 std::string uncompressed_log_data; |
| 56 EXPECT_TRUE(compression::GzipUncompress(result_persisted_logs.staged_log(), | 56 EXPECT_TRUE(compression::GzipUncompress(result_persisted_logs.staged_log(), |
| 57 &uncompressed_log_data)); | 57 &uncompressed_log_data)); |
| 58 | 58 |
| 59 Report report; | 59 Report report; |
| 60 EXPECT_TRUE(report.ParseFromString(uncompressed_log_data)); | 60 EXPECT_TRUE(report.ParseFromString(uncompressed_log_data)); |
| 61 return report; | 61 return report; |
| 62 } | 62 } |
| 63 | 63 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // Includes a Source, so will persist. | 182 // Includes a Source, so will persist. |
| 183 service.Flush(); | 183 service.Flush(); |
| 184 EXPECT_EQ(GetPersistedLogCount(), 1); | 184 EXPECT_EQ(GetPersistedLogCount(), 1); |
| 185 | 185 |
| 186 // Current log has no Sources. | 186 // Current log has no Sources. |
| 187 service.Flush(); | 187 service.Flush(); |
| 188 EXPECT_EQ(GetPersistedLogCount(), 1); | 188 EXPECT_EQ(GetPersistedLogCount(), 1); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace ukm | 191 } // namespace ukm |
| OLD | NEW |