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

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

Issue 1460593005: Make protocol::ConnectionToClient an abstract interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 void ClientSessionTest::TearDown() { 220 void ClientSessionTest::TearDown() {
221 // Clear out |task_runner_| reference so the loop can quit, and run it until 221 // Clear out |task_runner_| reference so the loop can quit, and run it until
222 // it does. 222 // it does.
223 task_runner_ = nullptr; 223 task_runner_ = nullptr;
224 run_loop_.Run(); 224 run_loop_.Run();
225 } 225 }
226 226
227 void ClientSessionTest::CreateClientSession() { 227 void ClientSessionTest::CreateClientSession() {
228 // Mock protocol::Session APIs called directly by ClientSession. 228 // Mock protocol::Session APIs called directly by ClientSession.
229 protocol::MockSession* session = new MockSession(); 229 scoped_ptr<protocol::MockSession> session(new MockSession());
230 EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(*session_config_)); 230 EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(*session_config_));
231 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); 231 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_));
232 EXPECT_CALL(*session, SetEventHandler(_));
233 232
234 // Mock protocol::ConnectionToClient APIs called directly by ClientSession. 233 // Mock protocol::ConnectionToClient APIs called directly by ClientSession.
235 // HostStub is not touched by ClientSession, so we can safely pass nullptr. 234 // HostStub is not touched by ClientSession, so we can safely pass nullptr.
236 scoped_ptr<MockConnectionToClient> connection( 235 scoped_ptr<MockConnectionToClient> connection(
237 new MockConnectionToClient(session, nullptr)); 236 new MockConnectionToClient(session.Pass(), nullptr));
238 EXPECT_CALL(*connection, session()).WillRepeatedly(Return(session));
239 EXPECT_CALL(*connection, client_stub()) 237 EXPECT_CALL(*connection, client_stub())
240 .WillRepeatedly(Return(&client_stub_)); 238 .WillRepeatedly(Return(&client_stub_));
241 EXPECT_CALL(*connection, video_stub()).WillRepeatedly(Return(&video_stub_)); 239 EXPECT_CALL(*connection, video_stub()).WillRepeatedly(Return(&video_stub_));
242 EXPECT_CALL(*connection, Disconnect(_)); 240 EXPECT_CALL(*connection, Disconnect(_));
243 connection_ = connection.get(); 241 connection_ = connection.get();
244 242
245 client_session_.reset(new ClientSession( 243 client_session_.reset(new ClientSession(
246 &session_event_handler_, 244 &session_event_handler_,
247 task_runner_, // Audio thread. 245 task_runner_, // Audio thread.
248 task_runner_, // Input thread. 246 task_runner_, // Input thread.
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 768
771 DisconnectClientSession(); 769 DisconnectClientSession();
772 StopClientSession(); 770 StopClientSession();
773 771
774 // ext1 was instantiated and wrapped the video capturer. 772 // ext1 was instantiated and wrapped the video capturer.
775 EXPECT_TRUE(extension.was_instantiated()); 773 EXPECT_TRUE(extension.was_instantiated());
776 EXPECT_TRUE(extension.has_wrapped_video_capturer()); 774 EXPECT_TRUE(extension.has_wrapped_video_capturer());
777 } 775 }
778 776
779 } // namespace remoting 777 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698