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 |