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/offline_page_model_event_logger.h" | |
6 | |
7 #include "testing/gtest/include/gtest/gtest.h" | |
8 | |
9 namespace offline_internals { | |
fgorski
2016/06/23 16:34:07
same comments apply to this file as to the other o
chili
2016/06/24 02:45:52
Done.
| |
10 | |
11 namespace { | |
12 | |
13 class OfflinePageModelEventLoggerTest : public ::testing::Test { | |
14 public: | |
15 OfflinePageModelEventLoggerTest() {} | |
16 ~OfflinePageModelEventLoggerTest() {} | |
17 }; | |
18 | |
19 TEST_F(OfflinePageModelEventLoggerTest, RecordsWhenLoggingIsOn) { | |
20 OfflinePageModelEventLogger logger; | |
21 std::vector<std::string> log; | |
22 | |
23 logger.SetIsLogging(true); | |
24 logger.RecordStoreCleared(); | |
25 logger.GetLogs(log); | |
26 | |
27 EXPECT_EQ(1, log.size()); | |
Pete Williamson
2016/06/24 00:38:32
It would be nice to check the contents of the log
chili
2016/06/24 02:45:52
I had this debate with myself. I ended up not che
| |
28 } | |
29 | |
30 TEST_F(OfflinePageModelEventLoggerTest, DoesNotRecordWhenLoggingIsOff) { | |
31 OfflinePageModelEventLogger logger; | |
32 std::vector<std::string> log; | |
33 | |
34 logger.SetIsLogging(false); | |
35 logger.RecordStoreCleared(); | |
36 logger.GetLogs(log); | |
37 | |
38 EXPECT_EQ(0, log.size()); | |
39 } | |
40 | |
41 TEST_F(OfflinePageModelEventLoggerTest, DoesNotExceedMaxSize) { | |
42 OfflinePageModelEventLogger logger; | |
43 std::vector<std::string> log; | |
44 | |
45 logger.SetIsLogging(true); | |
46 for (int i = 0; i < 21; i++) { | |
dewittj
2016/06/23 22:19:02
please document maximum size in code like
const i
chili
2016/06/24 02:45:52
:( .... but i like postincrement >"<
Changed
| |
47 logger.RecordStoreCleared(); | |
48 } | |
49 logger.GetLogs(log); | |
50 | |
51 EXPECT_EQ(20, log.size()); | |
52 } | |
53 | |
54 } // namespace | |
55 | |
56 } // namespace offline_internals | |
OLD | NEW |