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/client/client_status_logger.h" | 5 #include "remoting/client/client_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/client/chromoting_stats.h" | 10 #include "remoting/client/chromoting_stats.h" |
10 #include "remoting/signaling/mock_signal_strategy.h" | 11 #include "remoting/signaling/mock_signal_strategy.h" |
11 #include "remoting/signaling/server_log_entry_unittest.h" | 12 #include "remoting/signaling/server_log_entry_unittest.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.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 remoting::protocol::ConnectionToHost; | 19 using remoting::protocol::ConnectionToHost; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 } | 62 } |
62 | 63 |
63 } // namespace | 64 } // namespace |
64 | 65 |
65 class ClientStatusLoggerTest : public testing::Test { | 66 class ClientStatusLoggerTest : public testing::Test { |
66 public: | 67 public: |
67 ClientStatusLoggerTest() {} | 68 ClientStatusLoggerTest() {} |
68 void SetUp() override { | 69 void SetUp() override { |
69 EXPECT_CALL(signal_strategy_, AddListener(_)); | 70 EXPECT_CALL(signal_strategy_, AddListener(_)); |
70 EXPECT_CALL(signal_strategy_, RemoveListener(_)); | 71 EXPECT_CALL(signal_strategy_, RemoveListener(_)); |
71 message_loop_proxy_ = base::MessageLoopProxy::current(); | 72 message_loop_proxy_ = base::ThreadTaskRunnerHandle::Get(); |
72 client_status_logger_.reset( | 73 client_status_logger_.reset( |
73 new ClientStatusLogger(ServerLogEntry::ME2ME, | 74 new ClientStatusLogger(ServerLogEntry::ME2ME, |
74 &signal_strategy_, | 75 &signal_strategy_, |
75 kTestBotJid)); | 76 kTestBotJid)); |
76 } | 77 } |
77 | 78 |
78 protected: | 79 protected: |
79 base::MessageLoop message_loop_; | 80 base::MessageLoop message_loop_; |
80 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 81 scoped_refptr<base::SingleThreadTaskRunner> message_loop_proxy_; |
Sergey Ulanov
2015/05/04 20:49:58
This isn't used anywhere and can be removed.
anujsharma
2015/05/05 10:59:04
Removed!!
| |
81 MockSignalStrategy signal_strategy_; | 82 MockSignalStrategy signal_strategy_; |
82 scoped_ptr<ClientStatusLogger> client_status_logger_; | 83 scoped_ptr<ClientStatusLogger> client_status_logger_; |
83 }; | 84 }; |
84 | 85 |
85 TEST_F(ClientStatusLoggerTest, LogStateChange) { | 86 TEST_F(ClientStatusLoggerTest, LogStateChange) { |
86 { | 87 { |
87 InSequence s; | 88 InSequence s; |
88 EXPECT_CALL(signal_strategy_, GetLocalJid()) | 89 EXPECT_CALL(signal_strategy_, GetLocalJid()) |
89 .WillRepeatedly(Return(kClientJid)); | 90 .WillRepeatedly(Return(kClientJid)); |
90 EXPECT_CALL(signal_strategy_, AddListener(_)); | 91 EXPECT_CALL(signal_strategy_, AddListener(_)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 | 147 |
147 ChromotingStats stats; | 148 ChromotingStats stats; |
148 client_status_logger_->LogStatistics(&stats); | 149 client_status_logger_->LogStatistics(&stats); |
149 | 150 |
150 client_status_logger_->SetSignalingStateForTest(SignalStrategy::CONNECTED); | 151 client_status_logger_->SetSignalingStateForTest(SignalStrategy::CONNECTED); |
151 client_status_logger_->SetSignalingStateForTest(SignalStrategy::DISCONNECTED); | 152 client_status_logger_->SetSignalingStateForTest(SignalStrategy::DISCONNECTED); |
152 message_loop_.Run(); | 153 message_loop_.Run(); |
153 } | 154 } |
154 | 155 |
155 } // namespace remoting | 156 } // namespace remoting |
OLD | NEW |