Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: remoting/host/chromoting_host_unittest.cc

Issue 1545743002: Move ownership of Transport out of Session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass_client
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "remoting/base/auto_thread_task_runner.h" 8 #include "remoting/base/auto_thread_task_runner.h"
9 #include "remoting/host/audio_capturer.h" 9 #include "remoting/host/audio_capturer.h"
10 #include "remoting/host/chromoting_host.h" 10 #include "remoting/host/chromoting_host.h"
11 #include "remoting/host/chromoting_host_context.h" 11 #include "remoting/host/chromoting_host_context.h"
12 #include "remoting/host/fake_desktop_environment.h" 12 #include "remoting/host/fake_desktop_environment.h"
13 #include "remoting/host/fake_mouse_cursor_monitor.h" 13 #include "remoting/host/fake_mouse_cursor_monitor.h"
14 #include "remoting/host/host_mock_objects.h" 14 #include "remoting/host/host_mock_objects.h"
15 #include "remoting/proto/video.pb.h" 15 #include "remoting/proto/video.pb.h"
16 #include "remoting/protocol/errors.h" 16 #include "remoting/protocol/errors.h"
17 #include "remoting/protocol/fake_connection_to_client.h" 17 #include "remoting/protocol/fake_connection_to_client.h"
18 #include "remoting/protocol/fake_desktop_capturer.h" 18 #include "remoting/protocol/fake_desktop_capturer.h"
19 #include "remoting/protocol/protocol_mock_objects.h" 19 #include "remoting/protocol/protocol_mock_objects.h"
20 #include "remoting/protocol/session_config.h" 20 #include "remoting/protocol/session_config.h"
21 #include "remoting/protocol/transport_context.h"
21 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gmock_mutant.h" 23 #include "testing/gmock_mutant.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 25
25 using ::remoting::protocol::MockClientStub; 26 using ::remoting::protocol::MockClientStub;
26 using ::remoting::protocol::MockConnectionToClientEventHandler; 27 using ::remoting::protocol::MockConnectionToClientEventHandler;
27 using ::remoting::protocol::MockHostStub; 28 using ::remoting::protocol::MockHostStub;
28 using ::remoting::protocol::MockSession; 29 using ::remoting::protocol::MockSession;
29 using ::remoting::protocol::MockVideoStub; 30 using ::remoting::protocol::MockVideoStub;
30 using ::remoting::protocol::Session; 31 using ::remoting::protocol::Session;
(...skipping 12 matching lines...) Expand all
43 using testing::InvokeWithoutArgs; 44 using testing::InvokeWithoutArgs;
44 using testing::Return; 45 using testing::Return;
45 using testing::ReturnRef; 46 using testing::ReturnRef;
46 using testing::SaveArg; 47 using testing::SaveArg;
47 using testing::Sequence; 48 using testing::Sequence;
48 49
49 namespace remoting { 50 namespace remoting {
50 51
51 class ChromotingHostTest : public testing::Test { 52 class ChromotingHostTest : public testing::Test {
52 public: 53 public:
53 ChromotingHostTest() { 54 ChromotingHostTest() {}
54 }
55 55
56 void SetUp() override { 56 void SetUp() override {
57 task_runner_ = new AutoThreadTaskRunner(message_loop_.task_runner(), 57 task_runner_ = new AutoThreadTaskRunner(message_loop_.task_runner(),
58 base::Bind(&base::DoNothing)); 58 base::Bind(&base::DoNothing));
59 59
60 desktop_environment_factory_.reset(new FakeDesktopEnvironmentFactory()); 60 desktop_environment_factory_.reset(new FakeDesktopEnvironmentFactory());
61 session_manager_ = new protocol::MockSessionManager(); 61 session_manager_ = new protocol::MockSessionManager();
62 62
63 host_.reset(new ChromotingHost(desktop_environment_factory_.get(), 63 host_.reset(new ChromotingHost(
64 make_scoped_ptr(session_manager_), 64 desktop_environment_factory_.get(), make_scoped_ptr(session_manager_),
65 task_runner_, // Audio 65 protocol::TransportContext::ForTests(protocol::TransportRole::SERVER),
66 task_runner_, // Input 66 task_runner_, // Audio
67 task_runner_, // Video capture 67 task_runner_, // Input
68 task_runner_, // Video encode 68 task_runner_, // Video capture
69 task_runner_, // Network 69 task_runner_, // Video encode
70 task_runner_)); // UI 70 task_runner_, // Network
71 task_runner_)); // UI
71 host_->AddStatusObserver(&host_status_observer_); 72 host_->AddStatusObserver(&host_status_observer_);
72 73
73 xmpp_login_ = "host@domain"; 74 xmpp_login_ = "host@domain";
74 session1_ = new MockSession(); 75 session1_ = new MockSession();
75 session2_ = new MockSession(); 76 session2_ = new MockSession();
76 session_unowned1_.reset(new MockSession()); 77 session_unowned1_.reset(new MockSession());
77 session_unowned2_.reset(new MockSession()); 78 session_unowned2_.reset(new MockSession());
78 session_config1_ = SessionConfig::ForTest(); 79 session_config1_ = SessionConfig::ForTest();
79 session_jid1_ = "user@domain/rest-of-jid"; 80 session_jid1_ = "user@domain/rest-of-jid";
80 session_config2_ = SessionConfig::ForTest(); 81 session_config2_ = SessionConfig::ForTest();
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 399
399 ExpectClientConnected(0); 400 ExpectClientConnected(0);
400 SimulateClientConnection(0, true, false); 401 SimulateClientConnection(0, true, false);
401 402
402 ExpectClientDisconnected(0); 403 ExpectClientDisconnected(0);
403 DisconnectAllClients(); 404 DisconnectAllClients();
404 testing::Mock::VerifyAndClearExpectations(&host_status_observer_); 405 testing::Mock::VerifyAndClearExpectations(&host_status_observer_);
405 } 406 }
406 407
407 } // namespace remoting 408 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698