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

Side by Side Diff: content/shell/renderer/layout_test/blink_test_runner.cc

Issue 1555163002: Revert "Revert of Support device scale factor test with popups in LayoutTest (patchset #2 id:40001 … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hypothentical fix Created 4 years, 11 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 (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 #include <algorithm> 8 #include <algorithm>
9 #include <clocale> 9 #include <clocale>
10 #include <cmath> 10 #include <cmath>
(...skipping 18 matching lines...) Expand all
29 #include "build/build_config.h" 29 #include "build/build_config.h"
30 #include "components/plugins/renderer/plugin_placeholder.h" 30 #include "components/plugins/renderer/plugin_placeholder.h"
31 #include "components/test_runner/app_banner_client.h" 31 #include "components/test_runner/app_banner_client.h"
32 #include "components/test_runner/gamepad_controller.h" 32 #include "components/test_runner/gamepad_controller.h"
33 #include "components/test_runner/mock_screen_orientation_client.h" 33 #include "components/test_runner/mock_screen_orientation_client.h"
34 #include "components/test_runner/test_interfaces.h" 34 #include "components/test_runner/test_interfaces.h"
35 #include "components/test_runner/web_task.h" 35 #include "components/test_runner/web_task.h"
36 #include "components/test_runner/web_test_interfaces.h" 36 #include "components/test_runner/web_test_interfaces.h"
37 #include "components/test_runner/web_test_proxy.h" 37 #include "components/test_runner/web_test_proxy.h"
38 #include "components/test_runner/web_test_runner.h" 38 #include "components/test_runner/web_test_runner.h"
39 #include "content/common/content_switches_internal.h"
39 #include "content/public/common/content_switches.h" 40 #include "content/public/common/content_switches.h"
40 #include "content/public/common/url_constants.h" 41 #include "content/public/common/url_constants.h"
41 #include "content/public/common/web_preferences.h" 42 #include "content/public/common/web_preferences.h"
42 #include "content/public/renderer/media_stream_api.h" 43 #include "content/public/renderer/media_stream_api.h"
43 #include "content/public/renderer/render_frame.h" 44 #include "content/public/renderer/render_frame.h"
44 #include "content/public/renderer/render_view.h" 45 #include "content/public/renderer/render_view.h"
45 #include "content/public/renderer/render_view_visitor.h" 46 #include "content/public/renderer/render_view_visitor.h"
46 #include "content/public/renderer/renderer_gamepad_provider.h" 47 #include "content/public/renderer/renderer_gamepad_provider.h"
47 #include "content/public/test/layouttest_support.h" 48 #include "content/public/test/layouttest_support.h"
48 #include "content/shell/common/layout_test/layout_test_messages.h" 49 #include "content/shell/common/layout_test/layout_test_messages.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 263
263 } // namespace 264 } // namespace
264 265
265 BlinkTestRunner::BlinkTestRunner(RenderView* render_view) 266 BlinkTestRunner::BlinkTestRunner(RenderView* render_view)
266 : RenderViewObserver(render_view), 267 : RenderViewObserver(render_view),
267 RenderViewObserverTracker<BlinkTestRunner>(render_view), 268 RenderViewObserverTracker<BlinkTestRunner>(render_view),
268 proxy_(NULL), 269 proxy_(NULL),
269 focused_view_(NULL), 270 focused_view_(NULL),
270 is_main_window_(false), 271 is_main_window_(false),
271 focus_on_next_commit_(false), 272 focus_on_next_commit_(false),
272 leak_detector_(new LeakDetector(this)) { 273 leak_detector_(new LeakDetector(this)),
273 } 274 device_scale_factor_(1.f) {}
274 275
275 BlinkTestRunner::~BlinkTestRunner() { 276 BlinkTestRunner::~BlinkTestRunner() {
276 } 277 }
277 278
278 // WebTestDelegate ----------------------------------------------------------- 279 // WebTestDelegate -----------------------------------------------------------
279 280
280 void BlinkTestRunner::ClearEditCommand() { 281 void BlinkTestRunner::ClearEditCommand() {
281 render_view()->ClearEditCommands(); 282 render_view()->ClearEditCommands();
282 } 283 }
283 284
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 511 }
511 512
512 void BlinkTestRunner::SimulateWebNotificationClick(const std::string& title, 513 void BlinkTestRunner::SimulateWebNotificationClick(const std::string& title,
513 int action_index) { 514 int action_index) {
514 Send(new LayoutTestHostMsg_SimulateWebNotificationClick(routing_id(), title, 515 Send(new LayoutTestHostMsg_SimulateWebNotificationClick(routing_id(), title,
515 action_index)); 516 action_index));
516 } 517 }
517 518
518 void BlinkTestRunner::SetDeviceScaleFactor(float factor) { 519 void BlinkTestRunner::SetDeviceScaleFactor(float factor) {
519 content::SetDeviceScaleFactor(render_view(), factor); 520 content::SetDeviceScaleFactor(render_view(), factor);
521 if (device_scale_factor_ == factor)
522 return;
523 device_scale_factor_ = factor;
524 Send(new ShellViewHostMsg_SetDeviceScaleFactor(routing_id(), factor));
520 } 525 }
521 526
522 void BlinkTestRunner::EnableUseZoomForDSF() { 527 void BlinkTestRunner::EnableUseZoomForDSF() {
523 base::CommandLine::ForCurrentProcess()-> 528 base::CommandLine::ForCurrentProcess()->
524 AppendSwitch(switches::kEnableUseZoomForDSF); 529 AppendSwitch(switches::kEnableUseZoomForDSF);
525 } 530 }
526 531
527 void BlinkTestRunner::SetDeviceColorProfile(const std::string& name) { 532 void BlinkTestRunner::SetDeviceColorProfile(const std::string& name) {
528 content::SetDeviceColorProfile(render_view(), name); 533 content::SetDeviceColorProfile(render_view(), name);
529 } 534 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 plugins::PluginPlaceholder* placeholder = 767 plugins::PluginPlaceholder* placeholder =
763 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame, 768 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame,
764 params, "<div>Test content</div>"); 769 params, "<div>Test content</div>");
765 return placeholder->plugin(); 770 return placeholder->plugin();
766 } 771 }
767 772
768 void BlinkTestRunner::OnWebTestProxyBaseDestroy( 773 void BlinkTestRunner::OnWebTestProxyBaseDestroy(
769 test_runner::WebTestProxyBase* proxy) { 774 test_runner::WebTestProxyBase* proxy) {
770 } 775 }
771 776
777 blink::WebPoint BlinkTestRunner::ConvertDIPToNative(
778 const blink::WebPoint& point_in_dip) const {
779 return blink::WebPoint(point_in_dip.x * device_scale_factor_,
780 point_in_dip.y * device_scale_factor_);
781 }
772 bool BlinkTestRunner::AddMediaStreamVideoSourceAndTrack( 782 bool BlinkTestRunner::AddMediaStreamVideoSourceAndTrack(
773 blink::WebMediaStream* stream) { 783 blink::WebMediaStream* stream) {
774 DCHECK(stream); 784 DCHECK(stream);
775 #if defined(ENABLE_WEBRTC) 785 #if defined(ENABLE_WEBRTC)
776 return AddVideoTrackToMediaStream( 786 return AddVideoTrackToMediaStream(
777 make_scoped_ptr(new MockVideoCapturerSource()), 787 make_scoped_ptr(new MockVideoCapturerSource()),
778 false /* is_remote */, false /* is_readonly */, stream); 788 false /* is_remote */, false /* is_readonly */, stream);
779 #else 789 #else
780 return false; 790 return false;
781 #endif 791 #endif
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 get_bluetooth_events_callbacks_.pop_front(); 1009 get_bluetooth_events_callbacks_.pop_front();
1000 callback.Run(events); 1010 callback.Run(events);
1001 } 1011 }
1002 1012
1003 void BlinkTestRunner::ReportLeakDetectionResult( 1013 void BlinkTestRunner::ReportLeakDetectionResult(
1004 const LeakDetectionResult& report) { 1014 const LeakDetectionResult& report) {
1005 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 1015 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
1006 } 1016 }
1007 1017
1008 } // namespace content 1018 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698