| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <clocale> | 8 #include <clocale> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "content/public/renderer/render_view_visitor.h" | 29 #include "content/public/renderer/render_view_visitor.h" |
| 30 #include "content/public/renderer/renderer_gamepad_provider.h" | 30 #include "content/public/renderer/renderer_gamepad_provider.h" |
| 31 #include "content/public/test/layouttest_support.h" | 31 #include "content/public/test/layouttest_support.h" |
| 32 #include "content/shell/common/layout_test/layout_test_messages.h" | 32 #include "content/shell/common/layout_test/layout_test_messages.h" |
| 33 #include "content/shell/common/shell_messages.h" | 33 #include "content/shell/common/shell_messages.h" |
| 34 #include "content/shell/common/shell_switches.h" | 34 #include "content/shell/common/shell_switches.h" |
| 35 #include "content/shell/renderer/layout_test/blink_test_helpers.h" | 35 #include "content/shell/renderer/layout_test/blink_test_helpers.h" |
| 36 #include "content/shell/renderer/layout_test/gc_controller.h" | 36 #include "content/shell/renderer/layout_test/gc_controller.h" |
| 37 #include "content/shell/renderer/layout_test/layout_test_render_process_observer
.h" | 37 #include "content/shell/renderer/layout_test/layout_test_render_process_observer
.h" |
| 38 #include "content/shell/renderer/layout_test/leak_detector.h" | 38 #include "content/shell/renderer/layout_test/leak_detector.h" |
| 39 #include "content/shell/renderer/test_runner/gamepad_controller.h" |
| 39 #include "content/shell/renderer/test_runner/mock_screen_orientation_client.h" | 40 #include "content/shell/renderer/test_runner/mock_screen_orientation_client.h" |
| 40 #include "content/shell/renderer/test_runner/web_task.h" | 41 #include "content/shell/renderer/test_runner/web_task.h" |
| 41 #include "content/shell/renderer/test_runner/web_test_interfaces.h" | 42 #include "content/shell/renderer/test_runner/web_test_interfaces.h" |
| 42 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 43 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
| 43 #include "content/shell/renderer/test_runner/web_test_runner.h" | 44 #include "content/shell/renderer/test_runner/web_test_runner.h" |
| 44 #include "net/base/filename_util.h" | 45 #include "net/base/filename_util.h" |
| 45 #include "net/base/net_errors.h" | 46 #include "net/base/net_errors.h" |
| 46 #include "skia/ext/platform_canvas.h" | 47 #include "skia/ext/platform_canvas.h" |
| 47 #include "third_party/WebKit/public/platform/Platform.h" | 48 #include "third_party/WebKit/public/platform/Platform.h" |
| 48 #include "third_party/WebKit/public/platform/WebCString.h" | 49 #include "third_party/WebKit/public/platform/WebCString.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 182 |
| 182 bool Visit(RenderView* render_view) override { | 183 bool Visit(RenderView* render_view) override { |
| 183 UseSynchronousResizeMode(render_view, enable_); | 184 UseSynchronousResizeMode(render_view, enable_); |
| 184 return true; | 185 return true; |
| 185 } | 186 } |
| 186 | 187 |
| 187 private: | 188 private: |
| 188 bool enable_; | 189 bool enable_; |
| 189 }; | 190 }; |
| 190 | 191 |
| 192 class MockGamepadProvider : public RendererGamepadProvider { |
| 193 public: |
| 194 explicit MockGamepadProvider(GamepadController* controller) |
| 195 : RendererGamepadProvider(nullptr), controller_(controller) {} |
| 196 ~MockGamepadProvider() override { |
| 197 StopIfObserving(); |
| 198 } |
| 199 |
| 200 // RendererGamepadProvider implementation. |
| 201 void SampleGamepads(blink::WebGamepads& gamepads) override { |
| 202 controller_->SampleGamepads(gamepads); |
| 203 } |
| 204 void Start(blink::WebPlatformEventListener* listener) override { |
| 205 controller_->SetListener(static_cast<blink::WebGamepadListener*>(listener)); |
| 206 RendererGamepadProvider::Start(listener); |
| 207 } |
| 208 void SendStartMessage() override {} |
| 209 void SendStopMessage() override {} |
| 210 |
| 211 private: |
| 212 scoped_ptr<GamepadController> controller_; |
| 213 |
| 214 DISALLOW_COPY_AND_ASSIGN(MockGamepadProvider); |
| 215 }; |
| 216 |
| 191 } // namespace | 217 } // namespace |
| 192 | 218 |
| 193 BlinkTestRunner::BlinkTestRunner(RenderView* render_view) | 219 BlinkTestRunner::BlinkTestRunner(RenderView* render_view) |
| 194 : RenderViewObserver(render_view), | 220 : RenderViewObserver(render_view), |
| 195 RenderViewObserverTracker<BlinkTestRunner>(render_view), | 221 RenderViewObserverTracker<BlinkTestRunner>(render_view), |
| 196 proxy_(NULL), | 222 proxy_(NULL), |
| 197 focused_view_(NULL), | 223 focused_view_(NULL), |
| 198 is_main_window_(false), | 224 is_main_window_(false), |
| 199 focus_on_next_commit_(false), | 225 focus_on_next_commit_(false), |
| 200 leak_detector_(new LeakDetector(this)) { | 226 leak_detector_(new LeakDetector(this)) { |
| 201 } | 227 } |
| 202 | 228 |
| 203 BlinkTestRunner::~BlinkTestRunner() { | 229 BlinkTestRunner::~BlinkTestRunner() { |
| 204 } | 230 } |
| 205 | 231 |
| 206 // WebTestDelegate ----------------------------------------------------------- | 232 // WebTestDelegate ----------------------------------------------------------- |
| 207 | 233 |
| 208 void BlinkTestRunner::ClearEditCommand() { | 234 void BlinkTestRunner::ClearEditCommand() { |
| 209 render_view()->ClearEditCommands(); | 235 render_view()->ClearEditCommands(); |
| 210 } | 236 } |
| 211 | 237 |
| 212 void BlinkTestRunner::SetEditCommand(const std::string& name, | 238 void BlinkTestRunner::SetEditCommand(const std::string& name, |
| 213 const std::string& value) { | 239 const std::string& value) { |
| 214 render_view()->SetEditCommandForNextKeyEvent(name, value); | 240 render_view()->SetEditCommandForNextKeyEvent(name, value); |
| 215 } | 241 } |
| 216 | 242 |
| 217 void BlinkTestRunner::SetGamepadProvider( | 243 void BlinkTestRunner::SetGamepadProvider( |
| 218 scoped_ptr<RendererGamepadProvider> provider) { | 244 GamepadController* controller) { |
| 245 scoped_ptr<MockGamepadProvider> provider(new MockGamepadProvider(controller)); |
| 219 SetMockGamepadProvider(provider.Pass()); | 246 SetMockGamepadProvider(provider.Pass()); |
| 220 } | 247 } |
| 221 | 248 |
| 222 void BlinkTestRunner::SetDeviceLightData(const double data) { | 249 void BlinkTestRunner::SetDeviceLightData(const double data) { |
| 223 SetMockDeviceLightData(data); | 250 SetMockDeviceLightData(data); |
| 224 } | 251 } |
| 225 | 252 |
| 226 void BlinkTestRunner::SetDeviceMotionData(const WebDeviceMotionData& data) { | 253 void BlinkTestRunner::SetDeviceMotionData(const WebDeviceMotionData& data) { |
| 227 SetMockDeviceMotionData(data); | 254 SetMockDeviceMotionData(data); |
| 228 } | 255 } |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 | 823 |
| 797 leak_detector_->TryLeakDetection(main_frame); | 824 leak_detector_->TryLeakDetection(main_frame); |
| 798 } | 825 } |
| 799 | 826 |
| 800 void BlinkTestRunner::ReportLeakDetectionResult( | 827 void BlinkTestRunner::ReportLeakDetectionResult( |
| 801 const LeakDetectionResult& report) { | 828 const LeakDetectionResult& report) { |
| 802 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 829 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
| 803 } | 830 } |
| 804 | 831 |
| 805 } // namespace content | 832 } // namespace content |
| OLD | NEW |