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

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

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 #ifndef REMOTING_TEST_APP_REMOTING_CONNECTION_HELPER_H_ 5 #ifndef REMOTING_TEST_APP_REMOTING_CONNECTION_HELPER_H_
6 #define REMOTING_TEST_APP_REMOTING_CONNECTION_HELPER_H_ 6 #define REMOTING_TEST_APP_REMOTING_CONNECTION_HELPER_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "remoting/test/remote_connection_observer.h" 14 #include "remoting/test/remote_connection_observer.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace base { 17 namespace base {
18 class RunLoop; 18 class RunLoop;
19 class Timer; 19 class Timer;
20 class Lock; 20 class Lock;
21 } 21 }
22 22
23 namespace remoting { 23 namespace remoting {
24 namespace test { 24 namespace test {
25 25
26 struct RemoteApplicationDetails; 26 struct RemoteApplicationDetails;
27 class TestChromotingClient; 27 class TestChromotingClient;
28 28
29 // Creates a connection to a remote host which is available for tests to use. 29 // Creates a connection to a remote host which is available for tests to use.
30 // A TestChromotingClient is required from caller. 30 // A TestChromotingClient is required from caller.
31 class AppRemotingConnectionHelper 31 class AppRemotingConnectionHelper
32 : public RemoteConnectionObserver { 32 : public RemoteConnectionObserver {
33 public: 33 public:
34 explicit AppRemotingConnectionHelper( 34 explicit AppRemotingConnectionHelper(
35 const RemoteApplicationDetails& application_details); 35 const RemoteApplicationDetails& application_details);
36 ~AppRemotingConnectionHelper() override; 36 ~AppRemotingConnectionHelper() override;
37 37
38 // Initialize internal structures. 38 // Initialize internal structures.
39 void Initialize(scoped_ptr<TestChromotingClient> test_chromoting_client); 39 void Initialize(std::unique_ptr<TestChromotingClient> test_chromoting_client);
40 40
41 // Starts a connection with the remote host. 41 // Starts a connection with the remote host.
42 // NOTE: Initialize() must be called before calling this method. 42 // NOTE: Initialize() must be called before calling this method.
43 bool StartConnection(); 43 bool StartConnection();
44 44
45 // Stubs used to send messages to the remote host. 45 // Stubs used to send messages to the remote host.
46 protocol::ClipboardStub* clipboard_forwarder(); 46 protocol::ClipboardStub* clipboard_forwarder();
47 protocol::HostStub* host_stub(); 47 protocol::HostStub* host_stub();
48 protocol::InputStub* input_stub(); 48 protocol::InputStub* input_stub();
49 49
(...skipping 18 matching lines...) Expand all
68 68
69 // Contains the details for the application being tested. 69 // Contains the details for the application being tested.
70 const RemoteApplicationDetails& application_details_; 70 const RemoteApplicationDetails& application_details_;
71 71
72 // Indicates whether the remote connection is ready to be used for testing. 72 // Indicates whether the remote connection is ready to be used for testing.
73 // True when a chromoting connection to the remote host has been established 73 // True when a chromoting connection to the remote host has been established
74 // and the main application window is visible. 74 // and the main application window is visible.
75 bool connection_is_ready_for_tests_; 75 bool connection_is_ready_for_tests_;
76 76
77 // Used to run the thread's message loop. 77 // Used to run the thread's message loop.
78 scoped_ptr<base::RunLoop> run_loop_; 78 std::unique_ptr<base::RunLoop> run_loop_;
79 79
80 // Used for setting timeouts and delays. 80 // Used for setting timeouts and delays.
81 scoped_ptr<base::Timer> timer_; 81 std::unique_ptr<base::Timer> timer_;
82 82
83 // Used to ensure RemoteConnectionObserver methods are called on the same 83 // Used to ensure RemoteConnectionObserver methods are called on the same
84 // thread. 84 // thread.
85 base::ThreadChecker thread_checker_; 85 base::ThreadChecker thread_checker_;
86 86
87 // Creates and manages the connection to the remote host. 87 // Creates and manages the connection to the remote host.
88 scoped_ptr<TestChromotingClient> client_; 88 std::unique_ptr<TestChromotingClient> client_;
89 89
90 DISALLOW_COPY_AND_ASSIGN(AppRemotingConnectionHelper); 90 DISALLOW_COPY_AND_ASSIGN(AppRemotingConnectionHelper);
91 }; 91 };
92 92
93 } // namespace test 93 } // namespace test
94 } // namespace remoting 94 } // namespace remoting
95 95
96 #endif // REMOTING_TEST_APP_REMOTING_CONNECTION_HELPER_H_ 96 #endif // REMOTING_TEST_APP_REMOTING_CONNECTION_HELPER_H_
OLDNEW
« no previous file with comments | « remoting/test/app_remoting_connected_client_fixture.cc ('k') | remoting/test/app_remoting_connection_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698