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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // ownership of the HostExtensions themselves. | 171 // ownership of the HostExtensions themselves. |
172 std::vector<HostExtension*> extensions_; | 172 std::vector<HostExtension*> extensions_; |
173 | 173 |
174 // ClientSession instance under test. | 174 // ClientSession instance under test. |
175 scoped_ptr<ClientSession> client_session_; | 175 scoped_ptr<ClientSession> client_session_; |
176 | 176 |
177 // ClientSession::EventHandler mock for use in tests. | 177 // ClientSession::EventHandler mock for use in tests. |
178 MockClientSessionEventHandler session_event_handler_; | 178 MockClientSessionEventHandler session_event_handler_; |
179 | 179 |
180 // Storage for values to be returned by the protocol::Session mock. | 180 // Storage for values to be returned by the protocol::Session mock. |
181 SessionConfig session_config_; | 181 scoped_ptr<SessionConfig> session_config_; |
182 const std::string client_jid_; | 182 const std::string client_jid_; |
183 | 183 |
184 // Stubs returned to |client_session_| components by |connection_|. | 184 // Stubs returned to |client_session_| components by |connection_|. |
185 MockClientStub client_stub_; | 185 MockClientStub client_stub_; |
186 MockVideoStub video_stub_; | 186 MockVideoStub video_stub_; |
187 | 187 |
188 // DesktopEnvironment owns |input_injector_|, but input injection tests need | 188 // DesktopEnvironment owns |input_injector_|, but input injection tests need |
189 // to express expectations on it. | 189 // to express expectations on it. |
190 scoped_ptr<MockInputInjector> input_injector_; | 190 scoped_ptr<MockInputInjector> input_injector_; |
191 | 191 |
(...skipping 25 matching lines...) Expand all Loading... |
217 void ClientSessionTest::TearDown() { | 217 void ClientSessionTest::TearDown() { |
218 // Clear out |task_runner_| reference so the loop can quit, and run it until | 218 // Clear out |task_runner_| reference so the loop can quit, and run it until |
219 // it does. | 219 // it does. |
220 task_runner_ = nullptr; | 220 task_runner_ = nullptr; |
221 run_loop_.Run(); | 221 run_loop_.Run(); |
222 } | 222 } |
223 | 223 |
224 void ClientSessionTest::CreateClientSession() { | 224 void ClientSessionTest::CreateClientSession() { |
225 // Mock protocol::Session APIs called directly by ClientSession. | 225 // Mock protocol::Session APIs called directly by ClientSession. |
226 protocol::MockSession* session = new MockSession(); | 226 protocol::MockSession* session = new MockSession(); |
227 EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(session_config_)); | 227 EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(*session_config_)); |
228 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); | 228 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); |
229 EXPECT_CALL(*session, SetEventHandler(_)); | 229 EXPECT_CALL(*session, SetEventHandler(_)); |
230 | 230 |
231 // Mock protocol::ConnectionToClient APIs called directly by ClientSession. | 231 // Mock protocol::ConnectionToClient APIs called directly by ClientSession. |
232 // HostStub is not touched by ClientSession, so we can safely pass nullptr. | 232 // HostStub is not touched by ClientSession, so we can safely pass nullptr. |
233 scoped_ptr<MockConnectionToClient> connection( | 233 scoped_ptr<MockConnectionToClient> connection( |
234 new MockConnectionToClient(session, nullptr)); | 234 new MockConnectionToClient(session, nullptr)); |
235 EXPECT_CALL(*connection, session()).WillRepeatedly(Return(session)); | 235 EXPECT_CALL(*connection, session()).WillRepeatedly(Return(session)); |
236 EXPECT_CALL(*connection, client_stub()) | 236 EXPECT_CALL(*connection, client_stub()) |
237 .WillRepeatedly(Return(&client_stub_)); | 237 .WillRepeatedly(Return(&client_stub_)); |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 | 767 |
768 DisconnectClientSession(); | 768 DisconnectClientSession(); |
769 StopClientSession(); | 769 StopClientSession(); |
770 | 770 |
771 // ext1 was instantiated and wrapped the video capturer. | 771 // ext1 was instantiated and wrapped the video capturer. |
772 EXPECT_TRUE(extension.was_instantiated()); | 772 EXPECT_TRUE(extension.was_instantiated()); |
773 EXPECT_TRUE(extension.has_wrapped_video_capturer()); | 773 EXPECT_TRUE(extension.has_wrapped_video_capturer()); |
774 } | 774 } |
775 | 775 |
776 } // namespace remoting | 776 } // namespace remoting |
OLD | NEW |