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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "remoting/base/auto_thread_task_runner.h" | 9 #include "remoting/base/auto_thread_task_runner.h" |
10 #include "remoting/host/audio_capturer.h" | 10 #include "remoting/host/audio_capturer.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 arg1.Run(); | 63 arg1.Run(); |
64 } | 64 } |
65 | 65 |
66 } // namespace | 66 } // namespace |
67 | 67 |
68 class ChromotingHostTest : public testing::Test { | 68 class ChromotingHostTest : public testing::Test { |
69 public: | 69 public: |
70 ChromotingHostTest() { | 70 ChromotingHostTest() { |
71 } | 71 } |
72 | 72 |
73 virtual void SetUp() override { | 73 void SetUp() override { |
74 task_runner_ = new AutoThreadTaskRunner( | 74 task_runner_ = new AutoThreadTaskRunner( |
75 message_loop_.message_loop_proxy(), | 75 message_loop_.message_loop_proxy(), |
76 base::Bind(&ChromotingHostTest::QuitMainMessageLoop, | 76 base::Bind(&ChromotingHostTest::QuitMainMessageLoop, |
77 base::Unretained(this))); | 77 base::Unretained(this))); |
78 | 78 |
79 desktop_environment_factory_.reset(new MockDesktopEnvironmentFactory()); | 79 desktop_environment_factory_.reset(new MockDesktopEnvironmentFactory()); |
80 EXPECT_CALL(*desktop_environment_factory_, CreatePtr()) | 80 EXPECT_CALL(*desktop_environment_factory_, CreatePtr()) |
81 .Times(AnyNumber()) | 81 .Times(AnyNumber()) |
82 .WillRepeatedly(Invoke(this, | 82 .WillRepeatedly(Invoke(this, |
83 &ChromotingHostTest::CreateDesktopEnvironment)); | 83 &ChromotingHostTest::CreateDesktopEnvironment)); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 base::Unretained(client.get()), connection_ptr, | 218 base::Unretained(client.get()), connection_ptr, |
219 protocol::AUTHENTICATION_FAILED)); | 219 protocol::AUTHENTICATION_FAILED)); |
220 } | 220 } |
221 | 221 |
222 get_client(connection_index) = client.get(); | 222 get_client(connection_index) = client.get(); |
223 | 223 |
224 // |host| is responsible for deleting |client| from now on. | 224 // |host| is responsible for deleting |client| from now on. |
225 host_->clients_.push_back(client.release()); | 225 host_->clients_.push_back(client.release()); |
226 } | 226 } |
227 | 227 |
228 virtual void TearDown() override { | 228 void TearDown() override { |
229 // Make sure that the host has been properly deleted. | 229 // Make sure that the host has been properly deleted. |
230 DCHECK(host_.get() == NULL); | 230 DCHECK(host_.get() == NULL); |
231 } | 231 } |
232 | 232 |
233 // Change the session route for |client1_|. | 233 // Change the session route for |client1_|. |
234 void ChangeSessionRoute(const std::string& channel_name, | 234 void ChangeSessionRoute(const std::string& channel_name, |
235 const protocol::TransportRoute& route) { | 235 const protocol::TransportRoute& route) { |
236 host_->OnSessionRouteChange(get_client(0), channel_name, route); | 236 host_->OnSessionRouteChange(get_client(0), channel_name, route); |
237 } | 237 } |
238 | 238 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 ExpectClientDisconnected(0, true, video_packet_sent, | 711 ExpectClientDisconnected(0, true, video_packet_sent, |
712 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); | 712 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); |
713 EXPECT_CALL(host_status_observer_, OnShutdown()); | 713 EXPECT_CALL(host_status_observer_, OnShutdown()); |
714 | 714 |
715 host_->Start(xmpp_login_); | 715 host_->Start(xmpp_login_); |
716 SimulateClientConnection(0, true, false); | 716 SimulateClientConnection(0, true, false); |
717 message_loop_.Run(); | 717 message_loop_.Run(); |
718 } | 718 } |
719 | 719 |
720 } // namespace remoting | 720 } // namespace remoting |
OLD | NEW |