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

Side by Side Diff: remoting/host/log_to_server_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/message_loop_proxy.h" 6 #include "base/message_loop_proxy.h"
7 #include "remoting/host/host_status_monitor_fake.h" 7 #include "remoting/host/host_status_monitor_fake.h"
8 #include "remoting/host/log_to_server.h" 8 #include "remoting/host/log_to_server.h"
9 #include "remoting/jingle_glue/mock_objects.h" 9 #include "remoting/jingle_glue/mock_objects.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 18 matching lines...) Expand all
29 29
30 const char kJabberClientNamespace[] = "jabber:client"; 30 const char kJabberClientNamespace[] = "jabber:client";
31 const char kChromotingNamespace[] = "google:remoting"; 31 const char kChromotingNamespace[] = "google:remoting";
32 const char kTestBotJid[] = "remotingunittest@bot.talk.google.com"; 32 const char kTestBotJid[] = "remotingunittest@bot.talk.google.com";
33 const char kClientJid1[] = "client@domain.com/1234"; 33 const char kClientJid1[] = "client@domain.com/1234";
34 const char kClientJid2[] = "client@domain.com/5678"; 34 const char kClientJid2[] = "client@domain.com/5678";
35 const char kHostJid[] = "host@domain.com/1234"; 35 const char kHostJid[] = "host@domain.com/1234";
36 36
37 bool IsLogEntryForConnection(XmlElement* node, const char* connection_type) { 37 bool IsLogEntryForConnection(XmlElement* node, const char* connection_type) {
38 return (node->Name() == QName(kChromotingNamespace, "entry") && 38 return (node->Name() == QName(kChromotingNamespace, "entry") &&
39 node->Attr(QName("", "event-name")) == "session-state" && 39 node->Attr(QName(std::string(), "event-name")) == "session-state" &&
40 node->Attr(QName("", "session-state")) == "connected" && 40 node->Attr(QName(std::string(), "session-state")) == "connected" &&
41 node->Attr(QName("", "role")) == "host" && 41 node->Attr(QName(std::string(), "role")) == "host" &&
42 node->Attr(QName("", "mode")) == "me2me" && 42 node->Attr(QName(std::string(), "mode")) == "me2me" &&
43 node->Attr(QName("", "connection-type")) == connection_type); 43 node->Attr(QName(std::string(), "connection-type")) ==
44 connection_type);
44 } 45 }
45 46
46 MATCHER_P(IsClientConnected, connection_type, "") { 47 MATCHER_P(IsClientConnected, connection_type, "") {
47 if (arg->Name() != QName(kJabberClientNamespace, "iq")) { 48 if (arg->Name() != QName(kJabberClientNamespace, "iq")) {
48 return false; 49 return false;
49 } 50 }
50 buzz::XmlElement* log_stanza = arg->FirstChild()->AsElement(); 51 buzz::XmlElement* log_stanza = arg->FirstChild()->AsElement();
51 if (log_stanza->Name() !=QName(kChromotingNamespace, "log")) { 52 if (log_stanza->Name() !=QName(kChromotingNamespace, "log")) {
52 return false; 53 return false;
53 } 54 }
(...skipping 30 matching lines...) Expand all
84 return false; 85 return false;
85 } 86 }
86 if (log_entry->NextChild()) { 87 if (log_entry->NextChild()) {
87 return false; 88 return false;
88 } 89 }
89 return true; 90 return true;
90 } 91 }
91 92
92 bool IsLogEntryForDisconnection(XmlElement* node) { 93 bool IsLogEntryForDisconnection(XmlElement* node) {
93 return (node->Name() == QName(kChromotingNamespace, "entry") && 94 return (node->Name() == QName(kChromotingNamespace, "entry") &&
94 node->Attr(QName("", "event-name")) == "session-state" && 95 node->Attr(QName(std::string(), "event-name")) == "session-state" &&
95 node->Attr(QName("", "session-state")) == "closed" && 96 node->Attr(QName(std::string(), "session-state")) == "closed" &&
96 node->Attr(QName("", "role")) == "host" && 97 node->Attr(QName(std::string(), "role")) == "host" &&
97 node->Attr(QName("", "mode")) == "me2me"); 98 node->Attr(QName(std::string(), "mode")) == "me2me");
98 } 99 }
99 100
100 MATCHER(IsClientDisconnected, "") { 101 MATCHER(IsClientDisconnected, "") {
101 if (arg->Name() != QName(kJabberClientNamespace, "iq")) { 102 if (arg->Name() != QName(kJabberClientNamespace, "iq")) {
102 return false; 103 return false;
103 } 104 }
104 buzz::XmlElement* log_stanza = arg->FirstChild()->AsElement(); 105 buzz::XmlElement* log_stanza = arg->FirstChild()->AsElement();
105 if (log_stanza->Name() !=QName(kChromotingNamespace, "log")) { 106 if (log_stanza->Name() !=QName(kChromotingNamespace, "log")) {
106 return false; 107 return false;
107 } 108 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 route2.type = protocol::TransportRoute::STUN; 247 route2.type = protocol::TransportRoute::STUN;
247 log_to_server_->OnClientRouteChange(kClientJid2, "video", route2); 248 log_to_server_->OnClientRouteChange(kClientJid2, "video", route2);
248 log_to_server_->OnClientDisconnected(kClientJid1); 249 log_to_server_->OnClientDisconnected(kClientJid1);
249 log_to_server_->OnClientAuthenticated(kClientJid2); 250 log_to_server_->OnClientAuthenticated(kClientJid2);
250 log_to_server_->OnClientConnected(kClientJid2); 251 log_to_server_->OnClientConnected(kClientJid2);
251 log_to_server_->OnSignalStrategyStateChange(SignalStrategy::DISCONNECTED); 252 log_to_server_->OnSignalStrategyStateChange(SignalStrategy::DISCONNECTED);
252 message_loop_.Run(); 253 message_loop_.Run();
253 } 254 }
254 255
255 } // namespace remoting 256 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/host_port_allocator.cc ('k') | remoting/host/policy_hack/policy_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698