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

Unified Diff: remoting/host/server_log_entry_unittest.cc

Issue 8468015: The host sends simple log entries to the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac trybot. Created 9 years, 1 month 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: remoting/host/server_log_entry_unittest.cc
diff --git a/remoting/host/server_log_entry_unittest.cc b/remoting/host/server_log_entry_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..959004a25615cca1b3bf169ed5cc14f3116146cf
--- /dev/null
+++ b/remoting/host/server_log_entry_unittest.cc
@@ -0,0 +1,50 @@
+// 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 "base/memory/scoped_ptr.h"
+#include "remoting/host/server_log_entry.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
+
+using buzz::XmlAttr;
+using buzz::XmlElement;
+
+namespace remoting {
+
+class ServerLogEntryTest : public testing::Test {
+ protected:
+ static int countAttrs(XmlElement* elem) {
Sergey Ulanov 2011/11/17 01:16:33 CountAttrs?
simonmorris 2011/11/18 19:23:04 Removed altogether.
+ int n = 0;
+ XmlAttr* attr = elem->FirstAttr();
+ while (attr != NULL) {
+ attr = attr->NextAttr();
+ n++;
+ }
+ return n;
+ }
+};
+
+TEST_F(ServerLogEntryTest, MakeSessionStateChange) {
+ scoped_ptr<ServerLogEntry> entry(
+ ServerLogEntry::MakeSessionStateChange(true));
+ scoped_ptr<XmlElement> stanza(entry->ToStanza());
+ ASSERT_EQ(3, ServerLogEntryTest::countAttrs(stanza.get()));
+}
+
+TEST_F(ServerLogEntryTest, AddHostFields) {
+ scoped_ptr<ServerLogEntry> entry(
+ ServerLogEntry::MakeSessionStateChange(true));
+ entry->AddHostFields();
+ scoped_ptr<XmlElement> stanza(entry->ToStanza());
+
+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
+ int expected = 6;
+#else
+ int expected = 5;
+#endif
+
+ ASSERT_EQ(expected, ServerLogEntryTest::countAttrs(stanza.get()));
Sergey Ulanov 2011/11/17 01:16:33 In protocol/jingle_messages_unittests.cc there is
simonmorris 2011/11/18 19:23:04 Done (something similar).
+}
+
+} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698