OLD | NEW |
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_LATENCY_TEST_FIXTURE_H_ | 5 #ifndef REMOTING_TEST_APP_REMOTING_LATENCY_TEST_FIXTURE_H_ |
6 #define REMOTING_TEST_APP_REMOTING_LATENCY_TEST_FIXTURE_H_ | 6 #define REMOTING_TEST_APP_REMOTING_LATENCY_TEST_FIXTURE_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <vector> | 9 #include <vector> |
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/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.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 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 16 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
17 #include "ui/events/keycodes/dom/dom_code.h" | 17 #include "ui/events/keycodes/dom/dom_code.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class RunLoop; | 20 class RunLoop; |
21 class Timer; | 21 class Timer; |
22 class TimeDelta; | 22 class TimeDelta; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Get the details of the application to be run. | 82 // Get the details of the application to be run. |
83 virtual const RemoteApplicationDetails& GetApplicationDetails() = 0; | 83 virtual const RemoteApplicationDetails& GetApplicationDetails() = 0; |
84 | 84 |
85 // Used to ensure the application under test is ready for testing. | 85 // Used to ensure the application under test is ready for testing. |
86 virtual bool PrepareApplicationForTesting() = 0; | 86 virtual bool PrepareApplicationForTesting() = 0; |
87 | 87 |
88 // Clean up the running application to initial state. | 88 // Clean up the running application to initial state. |
89 virtual void ResetApplicationState(); | 89 virtual void ResetApplicationState(); |
90 | 90 |
91 // Creates and manages the connection to the remote host. | 91 // Creates and manages the connection to the remote host. |
92 scoped_ptr<AppRemotingConnectionHelper> connection_helper_; | 92 std::unique_ptr<AppRemotingConnectionHelper> connection_helper_; |
93 | 93 |
94 private: | 94 private: |
95 // testing::Test interface. | 95 // testing::Test interface. |
96 void SetUp() override; | 96 void SetUp() override; |
97 void TearDown() override; | 97 void TearDown() override; |
98 | 98 |
99 // RemoteConnectionObserver interface. | 99 // RemoteConnectionObserver interface. |
100 void HostMessageReceived(const protocol::ExtensionMessage& message) override; | 100 void HostMessageReceived(const protocol::ExtensionMessage& message) override; |
101 | 101 |
102 // Inject press key event. | 102 // Inject press key event. |
103 void PressKey(ui::DomCode usb_keycode, bool pressed); | 103 void PressKey(ui::DomCode usb_keycode, bool pressed); |
104 | 104 |
105 // Waits for an image pattern matched reply up to |max_wait_time|. Returns | 105 // Waits for an image pattern matched reply up to |max_wait_time|. Returns |
106 // true if we received a response within the maximum time limit. | 106 // true if we received a response within the maximum time limit. |
107 // NOTE: This method should only be run when as a returned callback by | 107 // NOTE: This method should only be run when as a returned callback by |
108 // SetExpectedImagePattern. | 108 // SetExpectedImagePattern. |
109 bool WaitForImagePatternMatch(scoped_ptr<base::RunLoop> run_loop, | 109 bool WaitForImagePatternMatch(std::unique_ptr<base::RunLoop> run_loop, |
110 const base::TimeDelta& max_wait_time); | 110 const base::TimeDelta& max_wait_time); |
111 | 111 |
112 // Used to run the thread's message loop. | 112 // Used to run the thread's message loop. |
113 scoped_ptr<base::RunLoop> run_loop_; | 113 std::unique_ptr<base::RunLoop> run_loop_; |
114 | 114 |
115 // Used for setting timeouts and delays. | 115 // Used for setting timeouts and delays. |
116 scoped_ptr<base::Timer> timer_; | 116 std::unique_ptr<base::Timer> timer_; |
117 | 117 |
118 // Used to maintain a reference to the TestVideoRenderer instance while it | 118 // Used to maintain a reference to the TestVideoRenderer instance while it |
119 // exists. | 119 // exists. |
120 base::WeakPtr<TestVideoRenderer> test_video_renderer_; | 120 base::WeakPtr<TestVideoRenderer> test_video_renderer_; |
121 | 121 |
122 // Called when an ExtensionMessage is received from the host. Used to | 122 // Called when an ExtensionMessage is received from the host. Used to |
123 // override default message handling. | 123 // override default message handling. |
124 HostMessageReceivedCallback host_message_received_callback_; | 124 HostMessageReceivedCallback host_message_received_callback_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(AppRemotingLatencyTestFixture); | 126 DISALLOW_COPY_AND_ASSIGN(AppRemotingLatencyTestFixture); |
127 }; | 127 }; |
128 | 128 |
129 } // namespace test | 129 } // namespace test |
130 } // namespace remoting | 130 } // namespace remoting |
131 | 131 |
132 #endif // REMOTING_TEST_APP_REMOTING_LATENCY_TEST_FIXTURE_H_ | 132 #endif // REMOTING_TEST_APP_REMOTING_LATENCY_TEST_FIXTURE_H_ |
OLD | NEW |