| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/offline_pages/core/offline_event_logger.h" | 5 #include "components/offline_pages/core/offline_event_logger.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace offline_pages { | 9 namespace offline_pages { |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 EventLoggerTestClient client; | 38 EventLoggerTestClient client; |
| 39 logger.SetClient(&client); | 39 logger.SetClient(&client); |
| 40 | 40 |
| 41 logger.SetIsLogging(true); | 41 logger.SetIsLogging(true); |
| 42 for (size_t i = 0; i < kMaxLogCount + 1; ++i) | 42 for (size_t i = 0; i < kMaxLogCount + 1; ++i) |
| 43 logger.RecordActivity(kMessage + std::to_string(i)); | 43 logger.RecordActivity(kMessage + std::to_string(i)); |
| 44 std::vector<std::string> log; | 44 std::vector<std::string> log; |
| 45 logger.GetLogs(&log); | 45 logger.GetLogs(&log); |
| 46 | 46 |
| 47 EXPECT_EQ(kMaxLogCount, log.size()); | 47 EXPECT_EQ(kMaxLogCount, log.size()); |
| 48 EXPECT_EQ(client.last_log_message(), log[0]); | 48 EXPECT_EQ(client.last_log_message(), log[0].substr(kTimeLength)); |
| 49 EXPECT_EQ(std::string(kMessage) + std::to_string(kMaxLogCount), | 49 EXPECT_EQ(std::string(kMessage) + std::to_string(kMaxLogCount), |
| 50 client.last_log_message().substr(kTimeLength)); | 50 client.last_log_message()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace offline_pages | 53 } // namespace offline_pages |
| OLD | NEW |