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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 config_(protocol::SessionConfig::ForTest()), | 52 config_(protocol::SessionConfig::ForTest()), |
53 #else | 53 #else |
54 config_(protocol::SessionConfig::ForTestWithAudio()), | 54 config_(protocol::SessionConfig::ForTestWithAudio()), |
55 #endif | 55 #endif |
56 event_logger_(&connection_) { | 56 event_logger_(&connection_) { |
57 factory_.set_enable_user_interface(false); | 57 factory_.set_enable_user_interface(false); |
58 EXPECT_CALL(*static_cast<MockSession*>(connection_.session()), jid()) | 58 EXPECT_CALL(*static_cast<MockSession*>(connection_.session()), jid()) |
59 .WillRepeatedly(testing::ReturnRef(session_jid_)); | 59 .WillRepeatedly(testing::ReturnRef(session_jid_)); |
60 EXPECT_CALL(*static_cast<MockSession*>(connection_.session()), config()) | 60 EXPECT_CALL(*static_cast<MockSession*>(connection_.session()), config()) |
61 .WillRepeatedly(testing::ReturnRef(*config_)); | 61 .WillRepeatedly(testing::ReturnRef(*config_)); |
62 connection_.set_audio_stub(event_logger_.audio_stub()); | |
63 connection_.set_video_stub(event_logger_.video_stub()); | 62 connection_.set_video_stub(event_logger_.video_stub()); |
64 connection_.set_client_stub(event_logger_.client_stub()); | 63 connection_.set_client_stub(event_logger_.client_stub()); |
65 connection_.set_host_stub(event_logger_.host_stub()); | 64 connection_.set_host_stub(event_logger_.host_stub()); |
66 connection_.set_video_encode_task_runner( | 65 connection_.set_video_encode_task_runner( |
67 context_->video_encode_task_runner()); | 66 context_->video_encode_task_runner()); |
68 } | 67 } |
69 | 68 |
70 It2MeStandaloneHost::~It2MeStandaloneHost() {} | 69 It2MeStandaloneHost::~It2MeStandaloneHost() {} |
71 | 70 |
72 void It2MeStandaloneHost::Run() { | 71 void It2MeStandaloneHost::Run() { |
73 main_task_runner_->PostTask( | 72 main_task_runner_->PostTask( |
74 FROM_HERE, | 73 FROM_HERE, |
75 base::Bind(&It2MeStandaloneHost::Connect, base::Unretained(this))); | 74 base::Bind(&It2MeStandaloneHost::Connect, base::Unretained(this))); |
76 run_loop_.Run(); | 75 run_loop_.Run(); |
77 } | 76 } |
78 | 77 |
79 void It2MeStandaloneHost::StartOutputTimer() { | 78 void It2MeStandaloneHost::StartOutputTimer() { |
80 timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), | 79 timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), |
81 base::Bind(&OutputFakeConnectionEventLogger, | 80 base::Bind(&OutputFakeConnectionEventLogger, |
82 base::ConstRef(event_logger_))); | 81 base::ConstRef(event_logger_))); |
83 } | 82 } |
84 | 83 |
85 void It2MeStandaloneHost::Connect() { | 84 void It2MeStandaloneHost::Connect() { |
86 session_.reset(new ClientSession( | 85 session_.reset(new ClientSession( |
87 &handler_, | 86 &handler_, std::unique_ptr<protocol::ConnectionToClient>(&connection_), |
88 context_->audio_task_runner(), | 87 &factory_, base::TimeDelta(), scoped_refptr<protocol::PairingRegistry>(), |
89 std::unique_ptr<protocol::ConnectionToClient>(&connection_), | |
90 &factory_, | |
91 base::TimeDelta(), | |
92 scoped_refptr<protocol::PairingRegistry>(), | |
93 std::vector<HostExtension*>())); | 88 std::vector<HostExtension*>())); |
94 session_->OnConnectionAuthenticated(&connection_); | 89 session_->OnConnectionAuthenticated(&connection_); |
95 session_->OnConnectionChannelsConnected(&connection_); | 90 session_->OnConnectionChannelsConnected(&connection_); |
96 session_->CreateVideoStreams(&connection_); | 91 session_->CreateMediaStreams(&connection_); |
97 } | 92 } |
98 | 93 |
99 } // namespace test | 94 } // namespace test |
100 } // namespace remoting | 95 } // namespace remoting |
OLD | NEW |