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/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" |
11 #include "testing/gmock_mutant.h" | 11 #include "testing/gmock_mutant.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 13 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
14 | 14 |
15 using buzz::XmlElement; | 15 using buzz::XmlElement; |
16 using buzz::QName; | 16 using buzz::QName; |
17 using testing::_; | 17 using testing::_; |
18 using testing::DeleteArg; | 18 using testing::DeleteArg; |
19 using testing::InSequence; | 19 using testing::InSequence; |
20 using testing::Return; | 20 using testing::Return; |
21 | 21 |
22 namespace remoting { | 22 namespace remoting { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 ACTION_P(QuitMainMessageLoop, message_loop) { | 26 ACTION_P(QuitMainMessageLoop, message_loop) { |
27 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 27 message_loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); |
28 } | 28 } |
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) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 EXPECT_CALL(signal_strategy_, AddListener(_)); | 129 EXPECT_CALL(signal_strategy_, AddListener(_)); |
130 log_to_server_.reset( | 130 log_to_server_.reset( |
131 new LogToServer(host_status_monitor_.AsWeakPtr(), | 131 new LogToServer(host_status_monitor_.AsWeakPtr(), |
132 ServerLogEntry::ME2ME, | 132 ServerLogEntry::ME2ME, |
133 &signal_strategy_, | 133 &signal_strategy_, |
134 kTestBotJid)); | 134 kTestBotJid)); |
135 EXPECT_CALL(signal_strategy_, RemoveListener(_)); | 135 EXPECT_CALL(signal_strategy_, RemoveListener(_)); |
136 } | 136 } |
137 | 137 |
138 protected: | 138 protected: |
139 MessageLoop message_loop_; | 139 base::MessageLoop message_loop_; |
140 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 140 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
141 MockSignalStrategy signal_strategy_; | 141 MockSignalStrategy signal_strategy_; |
142 scoped_ptr<LogToServer> log_to_server_; | 142 scoped_ptr<LogToServer> log_to_server_; |
143 HostStatusMonitorFake host_status_monitor_; | 143 HostStatusMonitorFake host_status_monitor_; |
144 }; | 144 }; |
145 | 145 |
146 TEST_F(LogToServerTest, SendNow) { | 146 TEST_F(LogToServerTest, SendNow) { |
147 { | 147 { |
148 InSequence s; | 148 InSequence s; |
149 EXPECT_CALL(signal_strategy_, GetLocalJid()) | 149 EXPECT_CALL(signal_strategy_, GetLocalJid()) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 route2.type = protocol::TransportRoute::STUN; | 247 route2.type = protocol::TransportRoute::STUN; |
248 log_to_server_->OnClientRouteChange(kClientJid2, "video", route2); | 248 log_to_server_->OnClientRouteChange(kClientJid2, "video", route2); |
249 log_to_server_->OnClientDisconnected(kClientJid1); | 249 log_to_server_->OnClientDisconnected(kClientJid1); |
250 log_to_server_->OnClientAuthenticated(kClientJid2); | 250 log_to_server_->OnClientAuthenticated(kClientJid2); |
251 log_to_server_->OnClientConnected(kClientJid2); | 251 log_to_server_->OnClientConnected(kClientJid2); |
252 log_to_server_->OnSignalStrategyStateChange(SignalStrategy::DISCONNECTED); | 252 log_to_server_->OnSignalStrategyStateChange(SignalStrategy::DISCONNECTED); |
253 message_loop_.Run(); | 253 message_loop_.Run(); |
254 } | 254 } |
255 | 255 |
256 } // namespace remoting | 256 } // namespace remoting |
OLD | NEW |