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

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java

Issue 23899004: Use contents size for android_webview layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java
index f4ba4d4e549923194a46785b198eb82c581aa384..b2c657c0272b1c9712990e0f855a357b265d844a 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java
@@ -258,6 +258,71 @@ public class AndroidViewIntegrationTest extends AwTestBase {
@SmallTest
@Feature({"AndroidWebView"})
+ public void testAbsolutePositionContentSizeUpdates() throws Throwable {
+ setQuirksMode(false);
+
+ final TestAwContentsClient contentsClient = new TestAwContentsClient();
+ final AwTestContainerView testContainerView = createDetachedTestContainerViewOnMainSync(
+ contentsClient);
+ assertZeroHeight(testContainerView);
+
+ final int widthCss = 142;
+ final int heightCss = 180;
+ final int padding = 11;
+
+ final String htmlData = CommonResources.makeHtmlPageFrom(
+ "<style type=\"text/css\">" +
+ "body { margin:0px; padding: " + padding + "px; } " +
+ "div { " +
+ "position: absolute; " +
+ "width:" + widthCss + "px; " +
+ "height:" + heightCss + "px; " +
+ "background-color: red; " +
+ "} " +
+ "</style>", "<div>a</div>");
+
+ final int contentSizeChangeCallCount = mOnContentSizeChangedHelper.getCallCount();
+ loadDataAsync(testContainerView.getAwContents(), htmlData, "text/html", false);
+
+ // Absolute-positioned elements shouldn't contribute to the height in non-quirks mode.
benm (inactive) 2013/09/06 19:27:53 Maybe move this comment to the top?
+ waitForContentSizeToChangeTo(mOnContentSizeChangedHelper, contentSizeChangeCallCount,
+ 2 * padding, 2 * padding);
+ }
+
+ @SmallTest
+ @Feature({"AndroidWebView"})
+ public void testAbsolutePositionContentSizeUpdatesInQuirksMode() throws Throwable {
+ setQuirksMode(true);
+
+ final TestAwContentsClient contentsClient = new TestAwContentsClient();
+ final AwTestContainerView testContainerView = createDetachedTestContainerViewOnMainSync(
+ contentsClient);
+ assertZeroHeight(testContainerView);
+
+ final int widthCss = 142;
+ final int heightCss = 180;
+
+ final String htmlData = CommonResources.makeHtmlPageFrom(
+ "<style type=\"text/css\">" +
+ "body { margin:0px; padding:0px; } " +
+ "div { " +
+ "position: absolute; " +
+ "width:" + widthCss + "px; " +
+ "height:" + heightCss + "px; " +
+ "background-color: red; " +
+ "} " +
+ "</style>", "<div>a</div>");
+
+ final int contentSizeChangeCallCount = mOnContentSizeChangedHelper.getCallCount();
+ loadDataAsync(testContainerView.getAwContents(), htmlData, "text/html", false);
+
+ // Absolute-positioned elements do contribute to the height in quirks mode.
benm (inactive) 2013/09/06 19:27:53 ditto
+ waitForContentSizeToChangeTo(mOnContentSizeChangedHelper, contentSizeChangeCallCount,
+ widthCss, heightCss);
+ }
+
+ @SmallTest
+ @Feature({"AndroidWebView"})
public void testViewSizedCorrectlyInWrapContentMode() throws Throwable {
final TestAwContentsClient contentsClient = new TestAwContentsClient();
final AwTestContainerView testContainerView = createCustomTestContainerViewOnMainSync(

Powered by Google App Engine
This is Rietveld 408576698