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

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

Issue 1549493004: Use std::move() instead of .Pass() in remoting/host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass
Patch Set: include <utility> 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
« no previous file with comments | « remoting/host/chromoting_host.cc ('k') | remoting/host/client_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "remoting/host/chromoting_host.h"
6
7 #include <utility>
8
5 #include "base/bind.h" 9 #include "base/bind.h"
6 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
7 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
8 #include "remoting/base/auto_thread_task_runner.h" 12 #include "remoting/base/auto_thread_task_runner.h"
9 #include "remoting/host/audio_capturer.h" 13 #include "remoting/host/audio_capturer.h"
10 #include "remoting/host/chromoting_host.h"
11 #include "remoting/host/chromoting_host_context.h" 14 #include "remoting/host/chromoting_host_context.h"
12 #include "remoting/host/fake_desktop_environment.h" 15 #include "remoting/host/fake_desktop_environment.h"
13 #include "remoting/host/fake_mouse_cursor_monitor.h" 16 #include "remoting/host/fake_mouse_cursor_monitor.h"
14 #include "remoting/host/host_mock_objects.h" 17 #include "remoting/host/host_mock_objects.h"
15 #include "remoting/proto/video.pb.h" 18 #include "remoting/proto/video.pb.h"
16 #include "remoting/protocol/errors.h" 19 #include "remoting/protocol/errors.h"
17 #include "remoting/protocol/fake_connection_to_client.h" 20 #include "remoting/protocol/fake_connection_to_client.h"
18 #include "remoting/protocol/fake_desktop_capturer.h" 21 #include "remoting/protocol/fake_desktop_capturer.h"
19 #include "remoting/protocol/protocol_mock_objects.h" 22 #include "remoting/protocol/protocol_mock_objects.h"
20 #include "remoting/protocol/session_config.h" 23 #include "remoting/protocol/session_config.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 owned_connection2_.reset( 117 owned_connection2_.reset(
115 new protocol::FakeConnectionToClient(make_scoped_ptr(session2_))); 118 new protocol::FakeConnectionToClient(make_scoped_ptr(session2_)));
116 owned_connection2_->set_host_stub(&host_stub2_); 119 owned_connection2_->set_host_stub(&host_stub2_);
117 connection2_ = owned_connection2_.get(); 120 connection2_ = owned_connection2_.get();
118 connection2_->set_client_stub(&client_stub2_); 121 connection2_->set_client_stub(&client_stub2_);
119 } 122 }
120 123
121 // Helper method to pretend a client is connected to ChromotingHost. 124 // Helper method to pretend a client is connected to ChromotingHost.
122 void SimulateClientConnection(int connection_index, bool authenticate, 125 void SimulateClientConnection(int connection_index, bool authenticate,
123 bool reject) { 126 bool reject) {
124 scoped_ptr<protocol::ConnectionToClient> connection = 127 scoped_ptr<protocol::ConnectionToClient> connection = std::move(
125 ((connection_index == 0) ? owned_connection1_ : owned_connection2_) 128 (connection_index == 0) ? owned_connection1_ : owned_connection2_);
126 .Pass();
127 protocol::ConnectionToClient* connection_ptr = connection.get(); 129 protocol::ConnectionToClient* connection_ptr = connection.get();
128 scoped_ptr<ClientSession> client(new ClientSession( 130 scoped_ptr<ClientSession> client(new ClientSession(
129 host_.get(), 131 host_.get(),
130 task_runner_, // Audio 132 task_runner_, // Audio
131 task_runner_, // Input 133 task_runner_, // Input
132 task_runner_, // Video capture 134 task_runner_, // Video capture
133 task_runner_, // Video encode 135 task_runner_, // Video encode
134 task_runner_, // Network 136 task_runner_, // Network
135 task_runner_, // UI 137 task_runner_, // UI
136 connection.Pass(), 138 std::move(connection), desktop_environment_factory_.get(),
137 desktop_environment_factory_.get(), 139 base::TimeDelta(), nullptr, std::vector<HostExtension*>()));
138 base::TimeDelta(),
139 nullptr,
140 std::vector<HostExtension*>()));
141 ClientSession* client_ptr = client.get(); 140 ClientSession* client_ptr = client.get();
142 141
143 connection_ptr->set_host_stub(client.get()); 142 connection_ptr->set_host_stub(client.get());
144 get_client(connection_index) = client_ptr; 143 get_client(connection_index) = client_ptr;
145 144
146 // |host| is responsible for deleting |client| from now on. 145 // |host| is responsible for deleting |client| from now on.
147 host_->clients_.push_back(client.release()); 146 host_->clients_.push_back(client.release());
148 147
149 if (authenticate) { 148 if (authenticate) {
150 client_ptr->OnConnectionAuthenticated(connection_ptr); 149 client_ptr->OnConnectionAuthenticated(connection_ptr);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 398
400 ExpectClientConnected(0); 399 ExpectClientConnected(0);
401 SimulateClientConnection(0, true, false); 400 SimulateClientConnection(0, true, false);
402 401
403 ExpectClientDisconnected(0); 402 ExpectClientDisconnected(0);
404 DisconnectAllClients(); 403 DisconnectAllClients();
405 testing::Mock::VerifyAndClearExpectations(&host_status_observer_); 404 testing::Mock::VerifyAndClearExpectations(&host_status_observer_);
406 } 405 }
407 406
408 } // namespace remoting 407 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host.cc ('k') | remoting/host/client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698