OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/test/it2me_standalone_host.h" | 5 #include "remoting/test/it2me_standalone_host.h" |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" |
15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
16 #include "remoting/base/auto_thread_task_runner.h" | 17 #include "remoting/base/auto_thread_task_runner.h" |
17 #include "remoting/host/chromoting_host_context.h" | 18 #include "remoting/host/chromoting_host_context.h" |
18 #include "remoting/host/host_extension.h" | 19 #include "remoting/host/host_extension.h" |
19 #include "remoting/protocol/pairing_registry.h" | 20 #include "remoting/protocol/pairing_registry.h" |
20 #include "remoting/protocol/protocol_mock_objects.h" | 21 #include "remoting/protocol/protocol_mock_objects.h" |
21 #include "remoting/protocol/session_config.h" | 22 #include "remoting/protocol/session_config.h" |
22 | 23 |
23 namespace remoting { | 24 namespace remoting { |
24 namespace test { | 25 namespace test { |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 void OutputFakeConnectionEventLogger(const FakeConnectionEventLogger& logger) { | 29 void OutputFakeConnectionEventLogger(const FakeConnectionEventLogger& logger) { |
29 std::cout << logger; | 30 std::cout << logger; |
30 } | 31 } |
31 | 32 |
32 constexpr char kSessionJid[] = "user@domain/rest-of-jid"; | 33 constexpr char kSessionJid[] = "user@domain/rest-of-jid"; |
33 | 34 |
34 } // namespace | 35 } // namespace |
35 | 36 |
36 using ::remoting::protocol::MockSession; | 37 using ::remoting::protocol::MockSession; |
37 | 38 |
38 It2MeStandaloneHost::It2MeStandaloneHost() | 39 It2MeStandaloneHost::It2MeStandaloneHost() |
39 : context_(ChromotingHostContext::Create( | 40 : scoped_task_environment_( |
40 new AutoThreadTaskRunner( | 41 base::test::ScopedTaskEnvironment::MainThreadType::UI), |
41 message_loop_.task_runner(), run_loop_.QuitClosure()))), | 42 context_(ChromotingHostContext::Create( |
42 main_task_runner_(context_->file_task_runner()), | 43 new AutoThreadTaskRunner(base::ThreadTaskRunnerHandle::Get(), |
43 factory_(main_task_runner_, | 44 run_loop_.QuitClosure()))), |
44 context_->video_capture_task_runner(), | 45 main_task_runner_(context_->file_task_runner()), |
45 context_->input_task_runner(), | 46 factory_(main_task_runner_, |
46 context_->ui_task_runner()), | 47 context_->video_capture_task_runner(), |
47 connection_(base::WrapUnique(new testing::NiceMock<MockSession>())), | 48 context_->input_task_runner(), |
48 session_jid_(kSessionJid), | 49 context_->ui_task_runner()), |
| 50 connection_(base::WrapUnique(new testing::NiceMock<MockSession>())), |
| 51 session_jid_(kSessionJid), |
49 #if defined(OS_LINUX) | 52 #if defined(OS_LINUX) |
50 // We cannot support audio capturing for linux, since a pipe name is | 53 // We cannot support audio capturing for linux, since a pipe name is |
51 // needed to initialize AudioCapturerLinux. | 54 // needed to initialize AudioCapturerLinux. |
52 config_(protocol::SessionConfig::ForTest()), | 55 config_(protocol::SessionConfig::ForTest()), |
53 #else | 56 #else |
54 config_(protocol::SessionConfig::ForTestWithAudio()), | 57 config_(protocol::SessionConfig::ForTestWithAudio()), |
55 #endif | 58 #endif |
56 event_logger_(&connection_) { | 59 event_logger_(&connection_) { |
57 EXPECT_CALL(*static_cast<MockSession*>(connection_.session()), jid()) | 60 EXPECT_CALL(*static_cast<MockSession*>(connection_.session()), jid()) |
58 .WillRepeatedly(testing::ReturnRef(session_jid_)); | 61 .WillRepeatedly(testing::ReturnRef(session_jid_)); |
59 EXPECT_CALL(*static_cast<MockSession*>(connection_.session()), config()) | 62 EXPECT_CALL(*static_cast<MockSession*>(connection_.session()), config()) |
60 .WillRepeatedly(testing::ReturnRef(*config_)); | 63 .WillRepeatedly(testing::ReturnRef(*config_)); |
61 connection_.set_video_stub(event_logger_.video_stub()); | 64 connection_.set_video_stub(event_logger_.video_stub()); |
62 connection_.set_client_stub(event_logger_.client_stub()); | 65 connection_.set_client_stub(event_logger_.client_stub()); |
63 connection_.set_host_stub(event_logger_.host_stub()); | 66 connection_.set_host_stub(event_logger_.host_stub()); |
64 connection_.set_video_encode_task_runner( | 67 connection_.set_video_encode_task_runner( |
65 context_->video_encode_task_runner()); | 68 context_->video_encode_task_runner()); |
66 } | 69 } |
(...skipping 22 matching lines...) Expand all Loading... |
89 &factory_, options, base::TimeDelta(), | 92 &factory_, options, base::TimeDelta(), |
90 scoped_refptr<protocol::PairingRegistry>(), | 93 scoped_refptr<protocol::PairingRegistry>(), |
91 std::vector<HostExtension*>())); | 94 std::vector<HostExtension*>())); |
92 session_->OnConnectionAuthenticated(); | 95 session_->OnConnectionAuthenticated(); |
93 session_->OnConnectionChannelsConnected(); | 96 session_->OnConnectionChannelsConnected(); |
94 session_->CreateMediaStreams(); | 97 session_->CreateMediaStreams(); |
95 } | 98 } |
96 | 99 |
97 } // namespace test | 100 } // namespace test |
98 } // namespace remoting | 101 } // namespace remoting |
OLD | NEW |