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

Side by Side Diff: sync/internal_api/debug_info_event_listener_unittest.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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
« no previous file with comments | « sync/internal_api/debug_info_event_listener.cc ('k') | sync/internal_api/delete_journal.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "sync/internal_api/debug_info_event_listener.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace syncer {
10
11 typedef testing::Test DebugInfoEventListenerTest;
12
13 TEST_F(DebugInfoEventListenerTest, VerifyEventsAdded) {
14 DebugInfoEventListener debug_info_event_listener;
15 debug_info_event_listener.CreateAndAddEvent(
16 sync_pb::SyncEnums::ENCRYPTION_COMPLETE);
17 ASSERT_EQ(debug_info_event_listener.events_.size(), 1U);
18 const sync_pb::DebugEventInfo& debug_info =
19 debug_info_event_listener.events_.back();
20 ASSERT_TRUE(debug_info.has_singleton_event());
21 ASSERT_EQ(debug_info.singleton_event(),
22 sync_pb::SyncEnums::ENCRYPTION_COMPLETE);
23 }
24
25 TEST_F(DebugInfoEventListenerTest, VerifyQueueSize) {
26 DebugInfoEventListener debug_info_event_listener;
27 for (unsigned int i = 0; i < 2*kMaxEntries; ++i) {
28 debug_info_event_listener.CreateAndAddEvent(
29 sync_pb::SyncEnums::ENCRYPTION_COMPLETE);
30 }
31 sync_pb::DebugInfo debug_info;
32 debug_info_event_listener.GetDebugInfo(&debug_info);
33 debug_info_event_listener.ClearDebugInfo();
34 ASSERT_TRUE(debug_info.events_dropped());
35 ASSERT_EQ(static_cast<int>(kMaxEntries), debug_info.events_size());
36 }
37
38 TEST_F(DebugInfoEventListenerTest, VerifyGetEvents) {
39 DebugInfoEventListener debug_info_event_listener;
40 debug_info_event_listener.CreateAndAddEvent(
41 sync_pb::SyncEnums::ENCRYPTION_COMPLETE);
42 ASSERT_EQ(debug_info_event_listener.events_.size(), 1U);
43 sync_pb::DebugInfo debug_info;
44 debug_info_event_listener.GetDebugInfo(&debug_info);
45 ASSERT_EQ(debug_info_event_listener.events_.size(), 1U);
46 ASSERT_EQ(debug_info.events_size(), 1);
47 ASSERT_TRUE(debug_info.events(0).has_singleton_event());
48 ASSERT_EQ(debug_info.events(0).singleton_event(),
49 sync_pb::SyncEnums::ENCRYPTION_COMPLETE);
50 }
51
52 TEST_F(DebugInfoEventListenerTest, VerifyClearEvents) {
53 DebugInfoEventListener debug_info_event_listener;
54 debug_info_event_listener.CreateAndAddEvent(
55 sync_pb::SyncEnums::ENCRYPTION_COMPLETE);
56 ASSERT_EQ(debug_info_event_listener.events_.size(), 1U);
57 debug_info_event_listener.ClearDebugInfo();
58 ASSERT_EQ(debug_info_event_listener.events_.size(), 0U);
59 }
60
61 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/debug_info_event_listener.cc ('k') | sync/internal_api/delete_journal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698