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

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

Issue 1525933002: Support device scale factor test with popups in LayoutTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 <algorithm> 7 #include <algorithm>
8 #include <clocale> 8 #include <clocale>
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 14 matching lines...) Expand all
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"
35 #include "content/public/common/content_switches.h" 36 #include "content/public/common/content_switches.h"
36 #include "content/public/common/url_constants.h" 37 #include "content/public/common/url_constants.h"
37 #include "content/public/common/web_preferences.h" 38 #include "content/public/common/web_preferences.h"
38 #include "content/public/renderer/media_stream_api.h" 39 #include "content/public/renderer/media_stream_api.h"
39 #include "content/public/renderer/render_frame.h" 40 #include "content/public/renderer/render_frame.h"
40 #include "content/public/renderer/render_view.h" 41 #include "content/public/renderer/render_view.h"
41 #include "content/public/renderer/render_view_visitor.h" 42 #include "content/public/renderer/render_view_visitor.h"
42 #include "content/public/renderer/renderer_gamepad_provider.h" 43 #include "content/public/renderer/renderer_gamepad_provider.h"
43 #include "content/public/test/layouttest_support.h" 44 #include "content/public/test/layouttest_support.h"
44 #include "content/shell/common/layout_test/layout_test_messages.h" 45 #include "content/shell/common/layout_test/layout_test_messages.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 259
259 } // namespace 260 } // namespace
260 261
261 BlinkTestRunner::BlinkTestRunner(RenderView* render_view) 262 BlinkTestRunner::BlinkTestRunner(RenderView* render_view)
262 : RenderViewObserver(render_view), 263 : RenderViewObserver(render_view),
263 RenderViewObserverTracker<BlinkTestRunner>(render_view), 264 RenderViewObserverTracker<BlinkTestRunner>(render_view),
264 proxy_(NULL), 265 proxy_(NULL),
265 focused_view_(NULL), 266 focused_view_(NULL),
266 is_main_window_(false), 267 is_main_window_(false),
267 focus_on_next_commit_(false), 268 focus_on_next_commit_(false),
268 leak_detector_(new LeakDetector(this)) { 269 leak_detector_(new LeakDetector(this)),
269 } 270 device_scale_factor_(1.f) {}
270 271
271 BlinkTestRunner::~BlinkTestRunner() { 272 BlinkTestRunner::~BlinkTestRunner() {
272 } 273 }
273 274
274 // WebTestDelegate ----------------------------------------------------------- 275 // WebTestDelegate -----------------------------------------------------------
275 276
276 void BlinkTestRunner::ClearEditCommand() { 277 void BlinkTestRunner::ClearEditCommand() {
277 render_view()->ClearEditCommands(); 278 render_view()->ClearEditCommands();
278 } 279 }
279 280
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 Send(new LayoutTestHostMsg_SetDatabaseQuota(routing_id(), quota)); 506 Send(new LayoutTestHostMsg_SetDatabaseQuota(routing_id(), quota));
506 } 507 }
507 508
508 void BlinkTestRunner::SimulateWebNotificationClick(const std::string& title, 509 void BlinkTestRunner::SimulateWebNotificationClick(const std::string& title,
509 int action_index) { 510 int action_index) {
510 Send(new LayoutTestHostMsg_SimulateWebNotificationClick(routing_id(), title, 511 Send(new LayoutTestHostMsg_SimulateWebNotificationClick(routing_id(), title,
511 action_index)); 512 action_index));
512 } 513 }
513 514
514 void BlinkTestRunner::SetDeviceScaleFactor(float factor) { 515 void BlinkTestRunner::SetDeviceScaleFactor(float factor) {
516 if (device_scale_factor_ == factor)
517 return;
oshima 2015/12/15 20:21:37 I'm doing this to avoid resize request from host,
tkent 2015/12/16 06:40:01 Hmm, this looks a reasonable solution.
518 device_scale_factor_ = factor;
515 content::SetDeviceScaleFactor(render_view(), factor); 519 content::SetDeviceScaleFactor(render_view(), factor);
520 Send(new ShellViewHostMsg_SetDeviceScaleFactor(routing_id(), factor));
516 } 521 }
517 522
518 void BlinkTestRunner::SetDeviceColorProfile(const std::string& name) { 523 void BlinkTestRunner::SetDeviceColorProfile(const std::string& name) {
519 content::SetDeviceColorProfile(render_view(), name); 524 content::SetDeviceColorProfile(render_view(), name);
520 } 525 }
521 526
522 void BlinkTestRunner::SetBluetoothMockDataSet(const std::string& name) { 527 void BlinkTestRunner::SetBluetoothMockDataSet(const std::string& name) {
523 Send(new LayoutTestHostMsg_SetBluetoothAdapter(name)); 528 Send(new LayoutTestHostMsg_SetBluetoothAdapter(name));
524 // Auto-reset the chooser type so we don't get order dependence when some 529 // Auto-reset the chooser type so we don't get order dependence when some
525 // tests forget to do it explicitly. 530 // tests forget to do it explicitly.
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 plugins::PluginPlaceholder* placeholder = 758 plugins::PluginPlaceholder* placeholder =
754 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame, 759 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame,
755 params, "<div>Test content</div>"); 760 params, "<div>Test content</div>");
756 return placeholder->plugin(); 761 return placeholder->plugin();
757 } 762 }
758 763
759 void BlinkTestRunner::OnWebTestProxyBaseDestroy( 764 void BlinkTestRunner::OnWebTestProxyBaseDestroy(
760 test_runner::WebTestProxyBase* proxy) { 765 test_runner::WebTestProxyBase* proxy) {
761 } 766 }
762 767
768 blink::WebPoint BlinkTestRunner::ConvertDIPToNative(
769 const blink::WebPoint& point_in_dip) const {
770 return blink::WebPoint(point_in_dip.x * device_scale_factor_,
771 point_in_dip.y * device_scale_factor_);
772 }
763 bool BlinkTestRunner::AddMediaStreamVideoSourceAndTrack( 773 bool BlinkTestRunner::AddMediaStreamVideoSourceAndTrack(
764 blink::WebMediaStream* stream) { 774 blink::WebMediaStream* stream) {
765 DCHECK(stream); 775 DCHECK(stream);
766 #if defined(ENABLE_WEBRTC) 776 #if defined(ENABLE_WEBRTC)
767 return AddVideoTrackToMediaStream( 777 return AddVideoTrackToMediaStream(
768 make_scoped_ptr(new MockVideoCapturerSource()), 778 make_scoped_ptr(new MockVideoCapturerSource()),
769 false /* is_remote */, false /* is_readonly */, stream); 779 false /* is_remote */, false /* is_readonly */, stream);
770 #else 780 #else
771 return false; 781 return false;
772 #endif 782 #endif
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 get_bluetooth_events_callbacks_.pop_front(); 1000 get_bluetooth_events_callbacks_.pop_front();
991 callback.Run(events); 1001 callback.Run(events);
992 } 1002 }
993 1003
994 void BlinkTestRunner::ReportLeakDetectionResult( 1004 void BlinkTestRunner::ReportLeakDetectionResult(
995 const LeakDetectionResult& report) { 1005 const LeakDetectionResult& report) {
996 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 1006 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
997 } 1007 }
998 1008
999 } // namespace content 1009 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698