summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsl.ostapenko@samsung.com <sl.ostapenko@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-16 15:03:26 +0000
committersl.ostapenko@samsung.com <sl.ostapenko@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-16 15:03:26 +0000
commit800eaf976f1b7126c00ecbf800417baac195e851 (patch)
treec65615db15288f45677ebf0f3a75ff963e6ce66a
parentb73862405af1fd9a1941f637856be4ca217d603b (diff)
downloadchromium_src-800eaf976f1b7126c00ecbf800417baac195e851.zip
chromium_src-800eaf976f1b7126c00ecbf800417baac195e851.tar.gz
chromium_src-800eaf976f1b7126c00ecbf800417baac195e851.tar.bz2
Use WebScreenInfo members to provide screen orientation information for layout test support.
BUG=162827 Review URL: https://codereview.chromium.org/284583003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271017 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/public/test/layouttest_support.h1
-rw-r--r--content/renderer/render_view_impl.cc30
-rw-r--r--content/renderer/render_view_impl.h4
-rw-r--r--content/shell/renderer/webkit_test_runner.cc2
-rw-r--r--content/test/layouttest_support.cc4
5 files changed, 40 insertions, 1 deletions
diff --git a/content/public/test/layouttest_support.h b/content/public/test/layouttest_support.h
index e2fb2e2..ce4a6635 100644
--- a/content/public/test/layouttest_support.h
+++ b/content/public/test/layouttest_support.h
@@ -61,6 +61,7 @@ void SetMockDeviceOrientationData(const blink::WebDeviceOrientationData& data);
// Sets WebScreenOrientationType that should be used as a mock orientation.
void SetMockScreenOrientation(
+ RenderView* render_view,
const blink::WebScreenOrientationType& orientation);
// Resets the mock screen orientation data.
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 14a0682..980927b 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -4005,6 +4005,36 @@ void RenderViewImpl::SetDeviceScaleFactorForTesting(float factor) {
OnResize(params);
}
+void RenderViewImpl::SetScreenOrientationForTesting(
+ const blink::WebScreenOrientationType& orientation) {
+ ViewMsg_Resize_Params params;
+ params.screen_info = screen_info_;
+ params.screen_info.orientationType = orientation;
+ // FIXME(ostap): This relationship between orientationType and
+ // orientationAngle is temporary. The test should be able to specify
+ // the angle in addition to the orientation type.
+ switch (orientation) {
+ case blink::WebScreenOrientationLandscapePrimary:
+ params.screen_info.orientationAngle = 90;
+ break;
+ case blink::WebScreenOrientationLandscapeSecondary:
+ params.screen_info.orientationAngle = -90;
+ break;
+ case blink::WebScreenOrientationPortraitSecondary:
+ params.screen_info.orientationAngle = 180;
+ break;
+ default:
+ params.screen_info.orientationAngle = 0;
+ }
+ params.new_size = size();
+ params.physical_backing_size = gfx::ToCeiledSize(
+ gfx::ScaleSize(size(), params.screen_info.deviceScaleFactor));
+ params.overdraw_bottom_height = 0.f;
+ params.resizer_rect = WebRect();
+ params.is_fullscreen = is_fullscreen();
+ OnResize(params);
+}
+
void RenderViewImpl::SetDeviceColorProfileForTesting(
const std::vector<char>& color_profile) {
// TODO(noel): Add RenderViewImpl::SetDeviceColorProfile(color_profile).
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index dace468..0f41643 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -360,6 +360,10 @@ class CONTENT_EXPORT RenderViewImpl
// Change the device scale factor and force the compositor to resize.
void SetDeviceScaleFactorForTesting(float factor);
+ // Change screen orientation and force the compositor to resize.
+ void SetScreenOrientationForTesting(
+ const blink::WebScreenOrientationType& orientation);
+
// Change the device ICC color profile while running a layout test.
void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile);
diff --git a/content/shell/renderer/webkit_test_runner.cc b/content/shell/renderer/webkit_test_runner.cc
index c4cc35a..4d21232 100644
--- a/content/shell/renderer/webkit_test_runner.cc
+++ b/content/shell/renderer/webkit_test_runner.cc
@@ -228,7 +228,7 @@ void WebKitTestRunner::setDeviceOrientationData(
void WebKitTestRunner::setScreenOrientation(
const WebScreenOrientationType& orientation) {
- SetMockScreenOrientation(orientation);
+ SetMockScreenOrientation(render_view(), orientation);
}
void WebKitTestRunner::resetScreenOrientation() {
diff --git a/content/test/layouttest_support.cc b/content/test/layouttest_support.cc
index 68ff6e2..301be34 100644
--- a/content/test/layouttest_support.cc
+++ b/content/test/layouttest_support.cc
@@ -103,7 +103,11 @@ void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) {
}
void SetMockScreenOrientation(
+ RenderView* render_view,
const blink::WebScreenOrientationType& orientation) {
+ static_cast<RenderViewImpl*>(render_view)
+ ->SetScreenOrientationForTesting(orientation);
+ // FIXME(ostap): Remove this when blink side gets updated.
RendererWebKitPlatformSupportImpl::
SetMockScreenOrientationForTesting(orientation);
}