Revert of Report viewport memory and timing correctly for Slimming Paint. (patchset...
[chromium-blink-merge.git] / remoting / host / server_log_entry_host_unittest.cc
blobbe446211ff4fb16c7449237676814521a9399308
1 // Copyright 2014 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.
5 #include "base/memory/scoped_ptr.h"
6 #include "base/strings/stringize_macros.h"
7 #include "remoting/host/server_log_entry_host.h"
8 #include "remoting/signaling/server_log_entry.h"
9 #include "remoting/signaling/server_log_entry_unittest.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
13 using buzz::XmlAttr;
14 using buzz::XmlElement;
16 namespace remoting {
18 TEST(ServerLogEntryHostTest, MakeForSessionStateChange) {
19 scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(true));
20 scoped_ptr<XmlElement> stanza = entry->ToStanza();
21 std::string error;
22 std::map<std::string, std::string> key_value_pairs;
23 key_value_pairs["role"] = "host";
24 key_value_pairs["event-name"] = "session-state";
25 key_value_pairs["session-state"] = "connected";
26 std::set<std::string> keys;
27 ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error))
28 << error;
31 TEST(ServerLogEntryHostTest, MakeForHeartbeat) {
32 scoped_ptr<ServerLogEntry> entry(MakeLogEntryForHeartbeat());
33 scoped_ptr<XmlElement> stanza = entry->ToStanza();
34 std::string error;
35 std::map<std::string, std::string> key_value_pairs;
36 key_value_pairs["role"] = "host";
37 key_value_pairs["event-name"] = "heartbeat";
38 std::set<std::string> keys;
39 ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error))
40 << error;
43 TEST(ServerLogEntryHostTest, AddHostFields) {
44 scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(true));
45 AddHostFieldsToLogEntry(entry.get());
46 scoped_ptr<XmlElement> stanza = entry->ToStanza();
47 std::string error;
48 std::map<std::string, std::string> key_value_pairs;
49 key_value_pairs["role"] = "host";
50 key_value_pairs["event-name"] = "session-state";
51 key_value_pairs["session-state"] = "connected";
52 std::set<std::string> keys;
53 keys.insert("cpu");
54 #if defined(OS_WIN)
55 key_value_pairs["os-name"] = "Windows";
56 keys.insert("os-version");
57 #elif defined(OS_MACOSX)
58 key_value_pairs["os-name"] = "Mac";
59 keys.insert("os-version");
60 #elif defined(OS_CHROMEOS)
61 key_value_pairs["os-name"] = "ChromeOS";
62 keys.insert("os-version");
63 #elif defined(OS_LINUX)
64 key_value_pairs["os-name"] = "Linux";
65 #endif
66 key_value_pairs["host-version"] = STRINGIZE(VERSION);
67 ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error)) <<
68 error;
71 TEST(ServerLogEntryHostTest, AddModeField1) {
72 scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(true));
73 entry->AddModeField(ServerLogEntry::IT2ME);
74 scoped_ptr<XmlElement> stanza = entry->ToStanza();
75 std::string error;
76 std::map<std::string, std::string> key_value_pairs;
77 key_value_pairs["role"] = "host";
78 key_value_pairs["event-name"] = "session-state";
79 key_value_pairs["session-state"] = "connected";
80 key_value_pairs["mode"] = "it2me";
81 std::set<std::string> keys;
82 ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error)) <<
83 error;
86 TEST(ServerLogEntryHostTest, AddModeField2) {
87 scoped_ptr<ServerLogEntry> entry(MakeLogEntryForSessionStateChange(true));
88 entry->AddModeField(ServerLogEntry::ME2ME);
89 scoped_ptr<XmlElement> stanza = entry->ToStanza();
90 std::string error;
91 std::map<std::string, std::string> key_value_pairs;
92 key_value_pairs["role"] = "host";
93 key_value_pairs["event-name"] = "session-state";
94 key_value_pairs["session-state"] = "connected";
95 key_value_pairs["mode"] = "me2me";
96 std::set<std::string> keys;
97 ASSERT_TRUE(VerifyStanza(key_value_pairs, keys, stanza.get(), &error)) <<
98 error;
101 } // namespace remoting