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 14 matching lines...) Expand all Loading... |
25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
26 #include "components/plugins/renderer/plugin_placeholder.h" | 26 #include "components/plugins/renderer/plugin_placeholder.h" |
27 #include "components/test_runner/app_banner_client.h" | 27 #include "components/test_runner/app_banner_client.h" |
28 #include "components/test_runner/gamepad_controller.h" | 28 #include "components/test_runner/gamepad_controller.h" |
29 #include "components/test_runner/mock_screen_orientation_client.h" | 29 #include "components/test_runner/mock_screen_orientation_client.h" |
30 #include "components/test_runner/test_interfaces.h" | 30 #include "components/test_runner/test_interfaces.h" |
31 #include "components/test_runner/web_task.h" | 31 #include "components/test_runner/web_task.h" |
32 #include "components/test_runner/web_test_interfaces.h" | 32 #include "components/test_runner/web_test_interfaces.h" |
33 #include "components/test_runner/web_test_proxy.h" | 33 #include "components/test_runner/web_test_proxy.h" |
34 #include "components/test_runner/web_test_runner.h" | 34 #include "components/test_runner/web_test_runner.h" |
35 #include "content/common/content_switches_internal.h" | |
36 #include "content/public/common/content_switches.h" | 35 #include "content/public/common/content_switches.h" |
37 #include "content/public/common/url_constants.h" | 36 #include "content/public/common/url_constants.h" |
38 #include "content/public/common/web_preferences.h" | 37 #include "content/public/common/web_preferences.h" |
39 #include "content/public/renderer/media_stream_api.h" | 38 #include "content/public/renderer/media_stream_api.h" |
40 #include "content/public/renderer/render_frame.h" | 39 #include "content/public/renderer/render_frame.h" |
41 #include "content/public/renderer/render_view.h" | 40 #include "content/public/renderer/render_view.h" |
42 #include "content/public/renderer/render_view_visitor.h" | 41 #include "content/public/renderer/render_view_visitor.h" |
43 #include "content/public/renderer/renderer_gamepad_provider.h" | 42 #include "content/public/renderer/renderer_gamepad_provider.h" |
44 #include "content/public/test/layouttest_support.h" | 43 #include "content/public/test/layouttest_support.h" |
45 #include "content/shell/common/layout_test/layout_test_messages.h" | 44 #include "content/shell/common/layout_test/layout_test_messages.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 258 |
260 } // namespace | 259 } // namespace |
261 | 260 |
262 BlinkTestRunner::BlinkTestRunner(RenderView* render_view) | 261 BlinkTestRunner::BlinkTestRunner(RenderView* render_view) |
263 : RenderViewObserver(render_view), | 262 : RenderViewObserver(render_view), |
264 RenderViewObserverTracker<BlinkTestRunner>(render_view), | 263 RenderViewObserverTracker<BlinkTestRunner>(render_view), |
265 proxy_(NULL), | 264 proxy_(NULL), |
266 focused_view_(NULL), | 265 focused_view_(NULL), |
267 is_main_window_(false), | 266 is_main_window_(false), |
268 focus_on_next_commit_(false), | 267 focus_on_next_commit_(false), |
269 leak_detector_(new LeakDetector(this)), | 268 leak_detector_(new LeakDetector(this)) { |
270 device_scale_factor_(1.f) {} | 269 } |
271 | 270 |
272 BlinkTestRunner::~BlinkTestRunner() { | 271 BlinkTestRunner::~BlinkTestRunner() { |
273 } | 272 } |
274 | 273 |
275 // WebTestDelegate ----------------------------------------------------------- | 274 // WebTestDelegate ----------------------------------------------------------- |
276 | 275 |
277 void BlinkTestRunner::ClearEditCommand() { | 276 void BlinkTestRunner::ClearEditCommand() { |
278 render_view()->ClearEditCommands(); | 277 render_view()->ClearEditCommands(); |
279 } | 278 } |
280 | 279 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 Send(new LayoutTestHostMsg_SetDatabaseQuota(routing_id(), quota)); | 505 Send(new LayoutTestHostMsg_SetDatabaseQuota(routing_id(), quota)); |
507 } | 506 } |
508 | 507 |
509 void BlinkTestRunner::SimulateWebNotificationClick(const std::string& title, | 508 void BlinkTestRunner::SimulateWebNotificationClick(const std::string& title, |
510 int action_index) { | 509 int action_index) { |
511 Send(new LayoutTestHostMsg_SimulateWebNotificationClick(routing_id(), title, | 510 Send(new LayoutTestHostMsg_SimulateWebNotificationClick(routing_id(), title, |
512 action_index)); | 511 action_index)); |
513 } | 512 } |
514 | 513 |
515 void BlinkTestRunner::SetDeviceScaleFactor(float factor) { | 514 void BlinkTestRunner::SetDeviceScaleFactor(float factor) { |
516 if (device_scale_factor_ == factor) | |
517 return; | |
518 device_scale_factor_ = factor; | |
519 content::SetDeviceScaleFactor(render_view(), factor); | 515 content::SetDeviceScaleFactor(render_view(), factor); |
520 Send(new ShellViewHostMsg_SetDeviceScaleFactor(routing_id(), factor)); | |
521 } | 516 } |
522 | 517 |
523 void BlinkTestRunner::EnableUseZoomForDSF() { | 518 void BlinkTestRunner::EnableUseZoomForDSF() { |
524 base::CommandLine::ForCurrentProcess()-> | 519 base::CommandLine::ForCurrentProcess()-> |
525 AppendSwitch(switches::kEnableUseZoomForDSF); | 520 AppendSwitch(switches::kEnableUseZoomForDSF); |
526 } | 521 } |
527 | 522 |
528 void BlinkTestRunner::SetDeviceColorProfile(const std::string& name) { | 523 void BlinkTestRunner::SetDeviceColorProfile(const std::string& name) { |
529 content::SetDeviceColorProfile(render_view(), name); | 524 content::SetDeviceColorProfile(render_view(), name); |
530 } | 525 } |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 plugins::PluginPlaceholder* placeholder = | 758 plugins::PluginPlaceholder* placeholder = |
764 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame, | 759 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame, |
765 params, "<div>Test content</div>"); | 760 params, "<div>Test content</div>"); |
766 return placeholder->plugin(); | 761 return placeholder->plugin(); |
767 } | 762 } |
768 | 763 |
769 void BlinkTestRunner::OnWebTestProxyBaseDestroy( | 764 void BlinkTestRunner::OnWebTestProxyBaseDestroy( |
770 test_runner::WebTestProxyBase* proxy) { | 765 test_runner::WebTestProxyBase* proxy) { |
771 } | 766 } |
772 | 767 |
773 blink::WebPoint BlinkTestRunner::ConvertDIPToNative( | |
774 const blink::WebPoint& point_in_dip) const { | |
775 return blink::WebPoint(point_in_dip.x * device_scale_factor_, | |
776 point_in_dip.y * device_scale_factor_); | |
777 } | |
778 bool BlinkTestRunner::AddMediaStreamVideoSourceAndTrack( | 768 bool BlinkTestRunner::AddMediaStreamVideoSourceAndTrack( |
779 blink::WebMediaStream* stream) { | 769 blink::WebMediaStream* stream) { |
780 DCHECK(stream); | 770 DCHECK(stream); |
781 #if defined(ENABLE_WEBRTC) | 771 #if defined(ENABLE_WEBRTC) |
782 return AddVideoTrackToMediaStream( | 772 return AddVideoTrackToMediaStream( |
783 make_scoped_ptr(new MockVideoCapturerSource()), | 773 make_scoped_ptr(new MockVideoCapturerSource()), |
784 false /* is_remote */, false /* is_readonly */, stream); | 774 false /* is_remote */, false /* is_readonly */, stream); |
785 #else | 775 #else |
786 return false; | 776 return false; |
787 #endif | 777 #endif |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 get_bluetooth_events_callbacks_.pop_front(); | 995 get_bluetooth_events_callbacks_.pop_front(); |
1006 callback.Run(events); | 996 callback.Run(events); |
1007 } | 997 } |
1008 | 998 |
1009 void BlinkTestRunner::ReportLeakDetectionResult( | 999 void BlinkTestRunner::ReportLeakDetectionResult( |
1010 const LeakDetectionResult& report) { | 1000 const LeakDetectionResult& report) { |
1011 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1001 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
1012 } | 1002 } |
1013 | 1003 |
1014 } // namespace content | 1004 } // namespace content |
OLD | NEW |