OLD | NEW |
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 "content/shell/renderer/layout_test/blink_test_runner.h" | 5 #include "content/shell/renderer/layout_test/blink_test_runner.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 |
8 #include <algorithm> | 9 #include <algorithm> |
9 #include <clocale> | 10 #include <clocale> |
10 #include <cmath> | 11 #include <cmath> |
| 12 #include <memory> |
11 #include <utility> | 13 #include <utility> |
12 | 14 |
13 #include "base/base64.h" | 15 #include "base/base64.h" |
14 #include "base/command_line.h" | 16 #include "base/command_line.h" |
15 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
16 #include "base/debug/debugger.h" | 18 #include "base/debug/debugger.h" |
17 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
18 #include "base/location.h" | 20 #include "base/location.h" |
19 #include "base/macros.h" | 21 #include "base/macros.h" |
20 #include "base/md5.h" | 22 #include "base/md5.h" |
21 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/ptr_util.h" |
22 #include "base/single_thread_task_runner.h" | 24 #include "base/single_thread_task_runner.h" |
23 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
24 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
25 #include "base/strings/sys_string_conversions.h" | 27 #include "base/strings/sys_string_conversions.h" |
26 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
27 #include "base/thread_task_runner_handle.h" | 29 #include "base/thread_task_runner_handle.h" |
28 #include "base/time/time.h" | 30 #include "base/time/time.h" |
29 #include "base/values.h" | 31 #include "base/values.h" |
30 #include "build/build_config.h" | 32 #include "build/build_config.h" |
31 #include "components/plugins/renderer/plugin_placeholder.h" | 33 #include "components/plugins/renderer/plugin_placeholder.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 controller_->SampleGamepads(gamepads); | 157 controller_->SampleGamepads(gamepads); |
156 } | 158 } |
157 void Start(blink::WebPlatformEventListener* listener) override { | 159 void Start(blink::WebPlatformEventListener* listener) override { |
158 controller_->SetListener(static_cast<blink::WebGamepadListener*>(listener)); | 160 controller_->SetListener(static_cast<blink::WebGamepadListener*>(listener)); |
159 RendererGamepadProvider::Start(listener); | 161 RendererGamepadProvider::Start(listener); |
160 } | 162 } |
161 void SendStartMessage() override {} | 163 void SendStartMessage() override {} |
162 void SendStopMessage() override {} | 164 void SendStopMessage() override {} |
163 | 165 |
164 private: | 166 private: |
165 scoped_ptr<test_runner::GamepadController> controller_; | 167 std::unique_ptr<test_runner::GamepadController> controller_; |
166 | 168 |
167 DISALLOW_COPY_AND_ASSIGN(MockGamepadProvider); | 169 DISALLOW_COPY_AND_ASSIGN(MockGamepadProvider); |
168 }; | 170 }; |
169 | 171 |
170 class MockVideoCapturerSource : public media::VideoCapturerSource { | 172 class MockVideoCapturerSource : public media::VideoCapturerSource { |
171 public: | 173 public: |
172 MockVideoCapturerSource() = default; | 174 MockVideoCapturerSource() = default; |
173 ~MockVideoCapturerSource() override {} | 175 ~MockVideoCapturerSource() override {} |
174 | 176 |
175 void GetCurrentSupportedFormats( | 177 void GetCurrentSupportedFormats( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 render_view()->ClearEditCommands(); | 223 render_view()->ClearEditCommands(); |
222 } | 224 } |
223 | 225 |
224 void BlinkTestRunner::SetEditCommand(const std::string& name, | 226 void BlinkTestRunner::SetEditCommand(const std::string& name, |
225 const std::string& value) { | 227 const std::string& value) { |
226 render_view()->SetEditCommandForNextKeyEvent(name, value); | 228 render_view()->SetEditCommandForNextKeyEvent(name, value); |
227 } | 229 } |
228 | 230 |
229 void BlinkTestRunner::SetGamepadProvider( | 231 void BlinkTestRunner::SetGamepadProvider( |
230 test_runner::GamepadController* controller) { | 232 test_runner::GamepadController* controller) { |
231 scoped_ptr<MockGamepadProvider> provider(new MockGamepadProvider(controller)); | 233 std::unique_ptr<MockGamepadProvider> provider( |
| 234 new MockGamepadProvider(controller)); |
232 SetMockGamepadProvider(std::move(provider)); | 235 SetMockGamepadProvider(std::move(provider)); |
233 } | 236 } |
234 | 237 |
235 void BlinkTestRunner::SetDeviceLightData(const double data) { | 238 void BlinkTestRunner::SetDeviceLightData(const double data) { |
236 SetMockDeviceLightData(data); | 239 SetMockDeviceLightData(data); |
237 } | 240 } |
238 | 241 |
239 void BlinkTestRunner::SetDeviceMotionData(const WebDeviceMotionData& data) { | 242 void BlinkTestRunner::SetDeviceMotionData(const WebDeviceMotionData& data) { |
240 SetMockDeviceMotionData(data); | 243 SetMockDeviceMotionData(data); |
241 } | 244 } |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 | 702 |
700 float BlinkTestRunner::GetDeviceScaleFactorForTest() const { | 703 float BlinkTestRunner::GetDeviceScaleFactorForTest() const { |
701 return render_view()->GetDeviceScaleFactorForTest(); | 704 return render_view()->GetDeviceScaleFactorForTest(); |
702 } | 705 } |
703 | 706 |
704 bool BlinkTestRunner::AddMediaStreamVideoSourceAndTrack( | 707 bool BlinkTestRunner::AddMediaStreamVideoSourceAndTrack( |
705 blink::WebMediaStream* stream) { | 708 blink::WebMediaStream* stream) { |
706 DCHECK(stream); | 709 DCHECK(stream); |
707 #if defined(ENABLE_WEBRTC) | 710 #if defined(ENABLE_WEBRTC) |
708 return AddVideoTrackToMediaStream( | 711 return AddVideoTrackToMediaStream( |
709 make_scoped_ptr(new MockVideoCapturerSource()), | 712 base::WrapUnique(new MockVideoCapturerSource()), |
710 false, // is_remote | 713 false, // is_remote |
711 false, // is_readonly | 714 false, // is_readonly |
712 stream); | 715 stream); |
713 #else | 716 #else |
714 return false; | 717 return false; |
715 #endif | 718 #endif |
716 } | 719 } |
717 | 720 |
718 bool BlinkTestRunner::AddMediaStreamAudioSourceAndTrack( | 721 bool BlinkTestRunner::AddMediaStreamAudioSourceAndTrack( |
719 blink::WebMediaStream* stream) { | 722 blink::WebMediaStream* stream) { |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 get_bluetooth_events_callbacks_.pop_front(); | 982 get_bluetooth_events_callbacks_.pop_front(); |
980 callback.Run(events); | 983 callback.Run(events); |
981 } | 984 } |
982 | 985 |
983 void BlinkTestRunner::ReportLeakDetectionResult( | 986 void BlinkTestRunner::ReportLeakDetectionResult( |
984 const LeakDetectionResult& report) { | 987 const LeakDetectionResult& report) { |
985 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 988 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
986 } | 989 } |
987 | 990 |
988 } // namespace content | 991 } // namespace content |
OLD | NEW |