Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "remoting/host/host_status_logger.h" | 5 #include "remoting/host/host_status_logger.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/thread_task_runner_handle.h" | |
| 9 #include "remoting/host/fake_host_status_monitor.h" | 10 #include "remoting/host/fake_host_status_monitor.h" |
| 10 #include "remoting/signaling/mock_signal_strategy.h" | 11 #include "remoting/signaling/mock_signal_strategy.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gmock_mutant.h" | 13 #include "testing/gmock_mutant.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 15 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| 15 | 16 |
| 16 using buzz::XmlElement; | 17 using buzz::XmlElement; |
| 17 using buzz::QName; | 18 using buzz::QName; |
| 18 using testing::_; | 19 using testing::_; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 } | 120 } |
| 120 return true; | 121 return true; |
| 121 } | 122 } |
| 122 | 123 |
| 123 } // namespace | 124 } // namespace |
| 124 | 125 |
| 125 class HostStatusLoggerTest : public testing::Test { | 126 class HostStatusLoggerTest : public testing::Test { |
| 126 public: | 127 public: |
| 127 HostStatusLoggerTest() {} | 128 HostStatusLoggerTest() {} |
| 128 void SetUp() override { | 129 void SetUp() override { |
| 129 message_loop_proxy_ = base::MessageLoopProxy::current(); | 130 message_loop_proxy_ = base::ThreadTaskRunnerHandle::Get(); |
| 130 EXPECT_CALL(signal_strategy_, AddListener(_)); | 131 EXPECT_CALL(signal_strategy_, AddListener(_)); |
| 131 host_status_logger_.reset( | 132 host_status_logger_.reset( |
| 132 new HostStatusLogger(host_status_monitor_.AsWeakPtr(), | 133 new HostStatusLogger(host_status_monitor_.AsWeakPtr(), |
| 133 ServerLogEntry::ME2ME, | 134 ServerLogEntry::ME2ME, |
| 134 &signal_strategy_, | 135 &signal_strategy_, |
| 135 kTestBotJid)); | 136 kTestBotJid)); |
| 136 EXPECT_CALL(signal_strategy_, RemoveListener(_)); | 137 EXPECT_CALL(signal_strategy_, RemoveListener(_)); |
| 137 } | 138 } |
| 138 | 139 |
| 139 protected: | 140 protected: |
| 140 base::MessageLoop message_loop_; | 141 base::MessageLoop message_loop_; |
| 141 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 142 scoped_refptr<base::SingleThreadTaskRunner> message_loop_proxy_; |
|
Sergey Ulanov
2015/05/04 20:49:58
This is not used anywhere and can be removed.
anujsharma
2015/05/05 10:59:04
Done.
| |
| 142 MockSignalStrategy signal_strategy_; | 143 MockSignalStrategy signal_strategy_; |
| 143 scoped_ptr<HostStatusLogger> host_status_logger_; | 144 scoped_ptr<HostStatusLogger> host_status_logger_; |
| 144 FakeHostStatusMonitor host_status_monitor_; | 145 FakeHostStatusMonitor host_status_monitor_; |
| 145 }; | 146 }; |
| 146 | 147 |
| 147 TEST_F(HostStatusLoggerTest, SendNow) { | 148 TEST_F(HostStatusLoggerTest, SendNow) { |
| 148 { | 149 { |
| 149 InSequence s; | 150 InSequence s; |
| 150 EXPECT_CALL(signal_strategy_, GetLocalJid()) | 151 EXPECT_CALL(signal_strategy_, GetLocalJid()) |
| 151 .WillRepeatedly(Return(kHostJid)); | 152 .WillRepeatedly(Return(kHostJid)); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 route2.type = protocol::TransportRoute::STUN; | 250 route2.type = protocol::TransportRoute::STUN; |
| 250 host_status_logger_->OnClientRouteChange(kClientJid2, "video", route2); | 251 host_status_logger_->OnClientRouteChange(kClientJid2, "video", route2); |
| 251 host_status_logger_->OnClientDisconnected(kClientJid1); | 252 host_status_logger_->OnClientDisconnected(kClientJid1); |
| 252 host_status_logger_->OnClientAuthenticated(kClientJid2); | 253 host_status_logger_->OnClientAuthenticated(kClientJid2); |
| 253 host_status_logger_->OnClientConnected(kClientJid2); | 254 host_status_logger_->OnClientConnected(kClientJid2); |
| 254 host_status_logger_->SetSignalingStateForTest(SignalStrategy::DISCONNECTED); | 255 host_status_logger_->SetSignalingStateForTest(SignalStrategy::DISCONNECTED); |
| 255 message_loop_.Run(); | 256 message_loop_.Run(); |
| 256 } | 257 } |
| 257 | 258 |
| 258 } // namespace remoting | 259 } // namespace remoting |
| OLD | NEW |