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

Side by Side Diff: remoting/test/app_remoting_connection_helper.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/app_remoting_connection_helper.h" 5 #include "remoting/test/app_remoting_connection_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 29 matching lines...) Expand all
40 // TaskRunner so we need to run the loop until it has no more work to do. 40 // TaskRunner so we need to run the loop until it has no more work to do.
41 if (!connection_is_ready_for_tests_) { 41 if (!connection_is_ready_for_tests_) {
42 client_->RemoveRemoteConnectionObserver(this); 42 client_->RemoveRemoteConnectionObserver(this);
43 } 43 }
44 client_.reset(); 44 client_.reset();
45 45
46 base::RunLoop().RunUntilIdle(); 46 base::RunLoop().RunUntilIdle();
47 } 47 }
48 48
49 void AppRemotingConnectionHelper::Initialize( 49 void AppRemotingConnectionHelper::Initialize(
50 scoped_ptr<TestChromotingClient> test_chromoting_client) { 50 std::unique_ptr<TestChromotingClient> test_chromoting_client) {
51 client_ = std::move(test_chromoting_client); 51 client_ = std::move(test_chromoting_client);
52 client_->AddRemoteConnectionObserver(this); 52 client_->AddRemoteConnectionObserver(this);
53 } 53 }
54 54
55 bool AppRemotingConnectionHelper::StartConnection() { 55 bool AppRemotingConnectionHelper::StartConnection() {
56 DCHECK(thread_checker_.CalledOnValidThread()); 56 DCHECK(thread_checker_.CalledOnValidThread());
57 DCHECK(client_); 57 DCHECK(client_);
58 58
59 RemoteHostInfo remote_host_info; 59 RemoteHostInfo remote_host_info;
60 remoting::test::AppRemotingSharedData->GetRemoteHostInfoForApplicationId( 60 remoting::test::AppRemotingSharedData->GetRemoteHostInfoForApplicationId(
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 VLOG(1) << "Sending enable VideoControl message to host"; 178 VLOG(1) << "Sending enable VideoControl message to host";
179 client_->host_stub()->ControlVideo(video_control); 179 client_->host_stub()->ControlVideo(video_control);
180 } 180 }
181 181
182 void AppRemotingConnectionHelper::HandleOnWindowAddedMessage( 182 void AppRemotingConnectionHelper::HandleOnWindowAddedMessage(
183 const remoting::protocol::ExtensionMessage& message) { 183 const remoting::protocol::ExtensionMessage& message) {
184 DCHECK_EQ(message.type(), "onWindowAdded"); 184 DCHECK_EQ(message.type(), "onWindowAdded");
185 185
186 const base::DictionaryValue* message_data = nullptr; 186 const base::DictionaryValue* message_data = nullptr;
187 scoped_ptr<base::Value> host_message = base::JSONReader::Read(message.data()); 187 std::unique_ptr<base::Value> host_message =
188 base::JSONReader::Read(message.data());
188 if (!host_message.get() || !host_message->GetAsDictionary(&message_data)) { 189 if (!host_message.get() || !host_message->GetAsDictionary(&message_data)) {
189 LOG(ERROR) << "onWindowAdded message received was not valid JSON."; 190 LOG(ERROR) << "onWindowAdded message received was not valid JSON.";
190 if (run_loop_) { 191 if (run_loop_) {
191 run_loop_->Quit(); 192 run_loop_->Quit();
192 } 193 }
193 return; 194 return;
194 } 195 }
195 196
196 std::string current_window_title; 197 std::string current_window_title;
197 message_data->GetString("title", &current_window_title); 198 message_data->GetString("title", &current_window_title);
(...skipping 14 matching lines...) Expand all
212 DCHECK(run_loop_); 213 DCHECK(run_loop_);
213 // Now that the main window is visible, give the app some time to settle 214 // Now that the main window is visible, give the app some time to settle
214 // before signaling that it is ready to run tests. 215 // before signaling that it is ready to run tests.
215 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(2), 216 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(2),
216 run_loop_->QuitClosure()); 217 run_loop_->QuitClosure());
217 } 218 }
218 } 219 }
219 220
220 } // namespace test 221 } // namespace test
221 } // namespace remoting 222 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/test/app_remoting_connection_helper.h ('k') | remoting/test/app_remoting_latency_test_fixture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698