OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "components/offline_pages/background/request_coordinator_event_logger.h " | |
6 | |
7 #include "testing/gtest/include/gtest/gtest.h" | |
8 | |
9 namespace offline_pages { | |
10 | |
11 namespace { | |
12 | |
13 const char kNamespace[] = "last_n"; | |
14 const char kStatus[] = "pending"; | |
15 const char kId[] = "foo"; | |
16 | |
17 } // namespace | |
fgorski
2016/06/24 18:17:33
nit: we use two spaces after }
} //
chili
2016/06/24 20:30:10
Done.
| |
18 | |
19 TEST(RequestCoordinatorEventLoggerTest, RecordsWhenLoggingIsOn) { | |
20 RequestCoordinatorEventLogger logger; | |
21 std::vector<std::string> log; | |
22 | |
23 logger.SetIsLogging(true); | |
24 logger.RecordSavePageRequestUpdated(kNamespace, kStatus, kId); | |
25 logger.GetLogs(log); | |
26 | |
27 EXPECT_EQ(1, log.size()); | |
28 } | |
29 | |
30 TEST(RequestCoordinatorEventLoggerTest, RecordsWhenLoggingIsOff) { | |
31 RequestCoordinatorEventLogger logger; | |
32 std::vector<std::string> log; | |
33 | |
34 logger.SetIsLogging(false); | |
35 logger.RecordSavePageRequestUpdated(kNamespace, kStatus, kId); | |
36 logger.GetLogs(log); | |
37 | |
38 EXPECT_EQ(1, log.size()); | |
39 } | |
40 | |
41 TEST(RequestCoordinatorEventLoggerTest, DoesNotExceedMaxSize) { | |
42 RequestCoordinatorEventLogger logger; | |
43 std::vector<std::string> log; | |
44 | |
45 logger.SetIsLogging(true); | |
46 for (int i = 0; i < kMaxLogCount + 1; ++i) { | |
47 logger.RecordSavePageRequestUpdated(kNamespace, kStatus, kId); | |
48 } | |
49 logger.GetLogs(log); | |
50 | |
51 EXPECT_EQ(kMaxLogCount, log.size()); | |
52 } | |
53 | |
54 } // namespace offline_internals | |
fgorski
2016/06/24 18:17:33
please update to } // (two spaces)
and fix the na
chili
2016/06/24 20:30:10
Done.
| |
OLD | NEW |