| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "remoting/host/server_log_entry.h" | 6 #include "remoting/host/server_log_entry.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 8 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
| 9 | 9 |
| 10 using buzz::XmlAttr; | 10 using buzz::XmlAttr; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 std::string error; | 67 std::string error; |
| 68 std::map<std::string, std::string> key_value_pairs; | 68 std::map<std::string, std::string> key_value_pairs; |
| 69 key_value_pairs["role"] = "host"; | 69 key_value_pairs["role"] = "host"; |
| 70 key_value_pairs["event-name"] = "session-state"; | 70 key_value_pairs["event-name"] = "session-state"; |
| 71 key_value_pairs["session-state"] = "connected"; | 71 key_value_pairs["session-state"] = "connected"; |
| 72 std::set<std::string> keys; | 72 std::set<std::string> keys; |
| 73 ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error)) << | 73 ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error)) << |
| 74 error; | 74 error; |
| 75 } | 75 } |
| 76 | 76 |
| 77 TEST_F(ServerLogEntryTest, MakeHeartbeat) { |
| 78 scoped_ptr<ServerLogEntry> entry(ServerLogEntry::MakeHeartbeat()); |
| 79 scoped_ptr<XmlElement> stanza = entry->ToStanza(); |
| 80 std::string error; |
| 81 std::map<std::string, std::string> key_value_pairs; |
| 82 key_value_pairs["role"] = "host"; |
| 83 key_value_pairs["event-name"] = "heartbeat"; |
| 84 std::set<std::string> keys; |
| 85 ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error)) << |
| 86 error; |
| 87 } |
| 88 |
| 77 TEST_F(ServerLogEntryTest, AddHostFields) { | 89 TEST_F(ServerLogEntryTest, AddHostFields) { |
| 78 scoped_ptr<ServerLogEntry> entry( | 90 scoped_ptr<ServerLogEntry> entry( |
| 79 ServerLogEntry::MakeSessionStateChange(true)); | 91 ServerLogEntry::MakeSessionStateChange(true)); |
| 80 entry->AddHostFields(); | 92 entry->AddHostFields(); |
| 81 scoped_ptr<XmlElement> stanza = entry->ToStanza(); | 93 scoped_ptr<XmlElement> stanza = entry->ToStanza(); |
| 82 std::string error; | 94 std::string error; |
| 83 std::map<std::string, std::string> key_value_pairs; | 95 std::map<std::string, std::string> key_value_pairs; |
| 84 key_value_pairs["role"] = "host"; | 96 key_value_pairs["role"] = "host"; |
| 85 key_value_pairs["event-name"] = "session-state"; | 97 key_value_pairs["event-name"] = "session-state"; |
| 86 key_value_pairs["session-state"] = "connected"; | 98 key_value_pairs["session-state"] = "connected"; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 key_value_pairs["role"] = "host"; | 140 key_value_pairs["role"] = "host"; |
| 129 key_value_pairs["event-name"] = "session-state"; | 141 key_value_pairs["event-name"] = "session-state"; |
| 130 key_value_pairs["session-state"] = "connected"; | 142 key_value_pairs["session-state"] = "connected"; |
| 131 key_value_pairs["mode"] = "me2me"; | 143 key_value_pairs["mode"] = "me2me"; |
| 132 std::set<std::string> keys; | 144 std::set<std::string> keys; |
| 133 ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error)) << | 145 ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error)) << |
| 134 error; | 146 error; |
| 135 } | 147 } |
| 136 | 148 |
| 137 } // namespace remoting | 149 } // namespace remoting |
| OLD | NEW |