| 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 023dc46896d400891bad5732884d361c629bd030..512a50a5ae303ff63d4a9dc36cf59e1305844986 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
|
| @@ -251,7 +251,7 @@ public class AndroidViewIntegrationTest extends AwTestBase {
|
|
|
| @SmallTest
|
| @Feature({"AndroidWebView"})
|
| - public void testPreferredSizeUpdateWhenDetached() throws Throwable {
|
| + public void testSizeUpdateWhenDetached() throws Throwable {
|
| final TestAwContentsClient contentsClient = new TestAwContentsClient();
|
| final AwTestContainerView testContainerView = createDetachedTestContainerViewOnMainSync(
|
| contentsClient);
|
| @@ -274,6 +274,35 @@ public class AndroidViewIntegrationTest extends AwTestBase {
|
|
|
| @SmallTest
|
| @Feature({"AndroidWebView"})
|
| + public void testAbsolutePositionContributesToContentSize() throws Throwable {
|
| + 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);
|
| +
|
| + waitForContentSizeToChangeTo(mOnContentSizeChangedHelper, contentSizeChangeCallCount,
|
| + widthCss, heightCss);
|
| + }
|
| +
|
| + @SmallTest
|
| + @Feature({"AndroidWebView"})
|
| public void testViewSizedCorrectlyInWrapContentMode() throws Throwable {
|
| final TestAwContentsClient contentsClient = new TestAwContentsClient();
|
| final AwTestContainerView testContainerView = createCustomTestContainerViewOnMainSync(
|
| @@ -312,16 +341,18 @@ public class AndroidViewIntegrationTest extends AwTestBase {
|
|
|
| final int contentWidthCss = 142;
|
| final int contentHeightCss = 180;
|
| +
|
| + final int expectedWidthCss = (int) (getRootLayoutWidthOnMainThread() / deviceDIPScale);
|
| final int expectedHeightCss = contentHeightCss +
|
| // The second div in the contents is styled to have 150% of the viewport height, hence
|
| // the 1.5.
|
| (int) (AwLayoutSizer.FIXED_LAYOUT_HEIGHT * 1.5);
|
|
|
| loadPageOfSizeAndWaitForSizeChange(testContainerView.getAwContents(),
|
| - mOnContentSizeChangedHelper, contentWidthCss, contentHeightCss, true);
|
| + mOnContentSizeChangedHelper, expectedWidthCss, contentHeightCss, true);
|
|
|
| waitForNoLayoutsPending();
|
| - assertEquals(contentWidthCss, mOnContentSizeChangedHelper.getWidth());
|
| + assertEquals(expectedWidthCss, mOnContentSizeChangedHelper.getWidth());
|
| assertEquals(expectedHeightCss, mOnContentSizeChangedHelper.getHeight());
|
| }
|
| }
|
|
|