OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "remoting/host/capturer_fake.h" | 9 #include "remoting/host/capturer_fake.h" |
10 #include "remoting/host/chromoting_host.h" | 10 #include "remoting/host/chromoting_host.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 credentials_.set_username("user"); | 107 credentials_.set_username("user"); |
108 credentials_.set_credential("password"); | 108 credentials_.set_credential("password"); |
109 connection_ = new MockConnectionToClient( | 109 connection_ = new MockConnectionToClient( |
110 &handler_, &host_stub_, event_executor_); | 110 &handler_, &host_stub_, event_executor_); |
111 connection2_ = new MockConnectionToClient( | 111 connection2_ = new MockConnectionToClient( |
112 &handler_, &host_stub2_, &event_executor2_); | 112 &handler_, &host_stub2_, &event_executor2_); |
113 session_.reset(new MockSession()); | 113 session_.reset(new MockSession()); |
114 session2_.reset(new MockSession()); | 114 session2_.reset(new MockSession()); |
115 session_config_ = SessionConfig::GetDefault(); | 115 session_config_ = SessionConfig::GetDefault(); |
116 session_jid_ = "user@domain/rest-of-jid"; | 116 session_jid_ = "user@domain/rest-of-jid"; |
| 117 session2_jid_ = "user2@domain/rest-of-jid"; |
117 session_config2_ = SessionConfig::GetDefault(); | 118 session_config2_ = SessionConfig::GetDefault(); |
118 | 119 |
119 ON_CALL(video_stub_, ProcessVideoPacket(_, _)) | 120 ON_CALL(video_stub_, ProcessVideoPacket(_, _)) |
120 .WillByDefault( | 121 .WillByDefault( |
121 DoAll(DeleteArg<0>(), DeleteArg<1>())); | 122 DoAll(DeleteArg<0>(), DeleteArg<1>())); |
122 ON_CALL(video_stub2_, ProcessVideoPacket(_, _)) | 123 ON_CALL(video_stub2_, ProcessVideoPacket(_, _)) |
123 .WillByDefault( | 124 .WillByDefault( |
124 DoAll(DeleteArg<0>(), DeleteArg<1>())); | 125 DoAll(DeleteArg<0>(), DeleteArg<1>())); |
125 ON_CALL(*connection_.get(), video_stub()) | 126 ON_CALL(*connection_.get(), video_stub()) |
126 .WillByDefault(Return(&video_stub_)); | 127 .WillByDefault(Return(&video_stub_)); |
127 ON_CALL(*connection_.get(), client_stub()) | 128 ON_CALL(*connection_.get(), client_stub()) |
128 .WillByDefault(Return(&client_stub_)); | 129 .WillByDefault(Return(&client_stub_)); |
129 ON_CALL(*connection_.get(), session()) | 130 ON_CALL(*connection_.get(), session()) |
130 .WillByDefault(Return(session_.get())); | 131 .WillByDefault(Return(session_.get())); |
131 ON_CALL(*connection2_.get(), video_stub()) | 132 ON_CALL(*connection2_.get(), video_stub()) |
132 .WillByDefault(Return(&video_stub2_)); | 133 .WillByDefault(Return(&video_stub2_)); |
133 ON_CALL(*connection2_.get(), client_stub()) | 134 ON_CALL(*connection2_.get(), client_stub()) |
134 .WillByDefault(Return(&client_stub2_)); | 135 .WillByDefault(Return(&client_stub2_)); |
135 ON_CALL(*connection2_.get(), session()) | 136 ON_CALL(*connection2_.get(), session()) |
136 .WillByDefault(Return(session2_.get())); | 137 .WillByDefault(Return(session2_.get())); |
137 ON_CALL(*session_.get(), config()) | 138 ON_CALL(*session_.get(), config()) |
138 .WillByDefault(ReturnRef(session_config_)); | 139 .WillByDefault(ReturnRef(session_config_)); |
139 ON_CALL(*session_, jid()) | |
140 .WillByDefault(ReturnRef(session_jid_)); | |
141 ON_CALL(*session2_.get(), config()) | 140 ON_CALL(*session2_.get(), config()) |
142 .WillByDefault(ReturnRef(session_config2_)); | 141 .WillByDefault(ReturnRef(session_config2_)); |
| 142 EXPECT_CALL(*session_, jid()) |
| 143 .WillRepeatedly(ReturnRef(session_jid_)); |
| 144 EXPECT_CALL(*session2_, jid()) |
| 145 .WillRepeatedly(ReturnRef(session2_jid_)); |
143 EXPECT_CALL(*connection_.get(), video_stub()) | 146 EXPECT_CALL(*connection_.get(), video_stub()) |
144 .Times(AnyNumber()); | 147 .Times(AnyNumber()); |
145 EXPECT_CALL(*connection_.get(), client_stub()) | 148 EXPECT_CALL(*connection_.get(), client_stub()) |
146 .Times(AnyNumber()); | 149 .Times(AnyNumber()); |
147 EXPECT_CALL(*connection_.get(), session()) | 150 EXPECT_CALL(*connection_.get(), session()) |
148 .Times(AnyNumber()); | 151 .Times(AnyNumber()); |
149 EXPECT_CALL(*connection2_.get(), video_stub()) | 152 EXPECT_CALL(*connection2_.get(), video_stub()) |
150 .Times(AnyNumber()); | 153 .Times(AnyNumber()); |
151 EXPECT_CALL(*connection2_.get(), client_stub()) | 154 EXPECT_CALL(*connection2_.get(), client_stub()) |
152 .Times(AnyNumber()); | 155 .Times(AnyNumber()); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 MockChromotingHostContext context_; | 222 MockChromotingHostContext context_; |
220 protocol::LocalLoginCredentials credentials_; | 223 protocol::LocalLoginCredentials credentials_; |
221 scoped_refptr<MockConnectionToClient> connection_; | 224 scoped_refptr<MockConnectionToClient> connection_; |
222 std::string session_jid_; | 225 std::string session_jid_; |
223 scoped_ptr<MockSession> session_; | 226 scoped_ptr<MockSession> session_; |
224 SessionConfig session_config_; | 227 SessionConfig session_config_; |
225 MockVideoStub video_stub_; | 228 MockVideoStub video_stub_; |
226 MockClientStub client_stub_; | 229 MockClientStub client_stub_; |
227 MockHostStub host_stub_; | 230 MockHostStub host_stub_; |
228 scoped_refptr<MockConnectionToClient> connection2_; | 231 scoped_refptr<MockConnectionToClient> connection2_; |
| 232 std::string session2_jid_; |
229 scoped_ptr<MockSession> session2_; | 233 scoped_ptr<MockSession> session2_; |
230 SessionConfig session_config2_; | 234 SessionConfig session_config2_; |
231 MockVideoStub video_stub2_; | 235 MockVideoStub video_stub2_; |
232 MockClientStub client_stub2_; | 236 MockClientStub client_stub2_; |
233 MockHostStub host_stub2_; | 237 MockHostStub host_stub2_; |
234 MockEventExecutor event_executor2_; | 238 MockEventExecutor event_executor2_; |
235 | 239 |
236 // Owned by |host_|. | 240 // Owned by |host_|. |
237 MockEventExecutor* event_executor_; | 241 MockEventExecutor* event_executor_; |
238 MockCurtain* curtain_; | 242 MockCurtain* curtain_; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 EXPECT_CALL(*connection_.get(), Disconnect()) | 494 EXPECT_CALL(*connection_.get(), Disconnect()) |
491 .InSequence(s1, s2) | 495 .InSequence(s1, s2) |
492 .RetiresOnSaturation(); | 496 .RetiresOnSaturation(); |
493 } | 497 } |
494 SimulateClientConnection(0, true); | 498 SimulateClientConnection(0, true); |
495 message_loop_.Run(); | 499 message_loop_.Run(); |
496 host_->set_it2me(false); | 500 host_->set_it2me(false); |
497 EXPECT_THAT(curtain_activated, false); | 501 EXPECT_THAT(curtain_activated, false); |
498 } | 502 } |
499 } // namespace remoting | 503 } // namespace remoting |
OLD | NEW |