Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(912)

Side by Side Diff: components/offline_pages/offline_page_model_event_logger_unittest.cc

Issue 2089413002: [Offline Pages] Create a event/activity logger (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address initial comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_pages {
10
11 TEST(OfflinePageModelEventLoggerTest, RecordsWhenLoggingIsOn) {
dewittj 2016/06/24 18:32:49 These tests don't actually test the OfflinePageMod
chili 2016/06/24 20:30:11 Done.
12 OfflinePageModelEventLogger logger;
13 std::vector<std::string> log;
14
15 logger.SetIsLogging(true);
16 logger.RecordStoreCleared();
17 logger.GetLogs(log);
18
19 EXPECT_EQ(1, log.size());
20 }
21
22 TEST(OfflinePageModelEventLoggerTest, DoesNotRecordWhenLoggingIsOff) {
23 OfflinePageModelEventLogger logger;
24 std::vector<std::string> log;
25
26 logger.SetIsLogging(false);
27 logger.RecordStoreCleared();
28 logger.GetLogs(log);
29
30 EXPECT_EQ(0, log.size());
31 }
32
33 TEST(OfflinePageModelEventLoggerTest, DoesNotExceedMaxSize) {
34 OfflinePageModelEventLogger logger;
35 std::vector<std::string> log;
36
37 logger.SetIsLogging(true);
38 for (int i = 0; i < kMaxLogCount + 1; ++i) {
39 logger.RecordStoreCleared();
40 }
41 logger.GetLogs(log);
42
43 EXPECT_EQ(kMaxLogCount, log.size());
44 }
45
46 } // namespace
fgorski 2016/06/24 18:17:34 } //
chili 2016/06/24 20:30:11 Done.
47
48 } // namespace offline_internals
fgorski 2016/06/24 18:17:34 } // namespace offline_pages
chili 2016/06/24 20:30:11 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698