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

Unified Diff: chrome/browser/sync/internal_api/debug_info_event_listener_unittest.cc

Issue 8189003: Send important client side event information to the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: committing. Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/internal_api/debug_info_event_listener_unittest.cc
diff --git a/chrome/browser/sync/internal_api/debug_info_event_listener_unittest.cc b/chrome/browser/sync/internal_api/debug_info_event_listener_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..79b99ba1da669799fa841f5cc2f0466466078630
--- /dev/null
+++ b/chrome/browser/sync/internal_api/debug_info_event_listener_unittest.cc
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+#include "chrome/browser/sync/internal_api/debug_info_event_listener.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+typedef testing::Test DebugInfoEventListenerTest;
+
+namespace sync_api {
+TEST_F(DebugInfoEventListenerTest, VerifyEventsAdded) {
+ sync_api::DebugInfoEventListener debug_info_event_listener;
+ debug_info_event_listener.CreateAndAddEvent(
+ sync_pb::DebugEventInfo::ENCRYPTION_COMPLETE);
+ ASSERT_EQ(debug_info_event_listener.events_.size(), 1U);
+ const sync_pb::DebugEventInfo& debug_info =
+ debug_info_event_listener.events_.back();
+ ASSERT_TRUE(debug_info.has_type());
+ ASSERT_EQ(debug_info.type(), sync_pb::DebugEventInfo::ENCRYPTION_COMPLETE);
+}
+
+TEST_F(DebugInfoEventListenerTest, VerifyQueueSize) {
+ sync_api::DebugInfoEventListener debug_info_event_listener;
+ for (int i = 0; i < 10; ++i) {
+ debug_info_event_listener.CreateAndAddEvent(
+ sync_pb::DebugEventInfo::ENCRYPTION_COMPLETE);
+ }
+ ASSERT_EQ(debug_info_event_listener.events_.size(),
+ sync_api::kMaxEntries);
+}
+
+TEST_F(DebugInfoEventListenerTest, VerifyGetAndClearEvents) {
+ sync_api::DebugInfoEventListener debug_info_event_listener;
+ debug_info_event_listener.CreateAndAddEvent(
+ sync_pb::DebugEventInfo::ENCRYPTION_COMPLETE);
+ ASSERT_EQ(debug_info_event_listener.events_.size(), 1U);
+ sync_pb::DebugInfo debug_info;
+ debug_info_event_listener.GetAndClearDebugInfo(&debug_info);
+ ASSERT_EQ(debug_info_event_listener.events_.size(), 0U);
+ ASSERT_EQ(debug_info.events_size(), 1);
+ ASSERT_TRUE(debug_info.events(0).has_type());
+ ASSERT_EQ(debug_info.events(0).type(),
+ sync_pb::DebugEventInfo::ENCRYPTION_COMPLETE);
+}
+
+} // namespace sync_api
« no previous file with comments | « chrome/browser/sync/internal_api/debug_info_event_listener.cc ('k') | chrome/browser/sync/internal_api/sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698