import android.content.Context;
import android.graphics.Point;
import android.os.Build;
-import android.os.Bundle;
import android.os.SystemClock;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
}
}
- @SmallTest
- @Feature({"AndroidWebView", "Preferences"})
- // background shorthand property must not override background-size when
- // it's already set.
- public void testUseLegacyBackgroundSizeShorthandBehavior() throws Throwable {
- final TestAwContentsClient contentClient = new TestAwContentsClient();
- final AwTestContainerView testContainerView =
- createAwTestContainerViewOnMainSync(contentClient);
- final AwContents awContents = testContainerView.getAwContents();
- AwSettings settings = getAwSettingsOnUiThread(awContents);
- CallbackHelper onPageFinishedHelper = contentClient.getOnPageFinishedHelper();
- final String expectedBackgroundSize = "cover";
- final String page = "<html><head>" +
- "<script>" +
- "function getBackgroundSize() {" +
- " var e = document.getElementById('test'); " +
- " e.style.backgroundSize = '" + expectedBackgroundSize + "';" +
- " e.style.background = 'center red url(dummy://test.png) no-repeat border-box'; " +
- " return e.style.backgroundSize; " +
- "}" +
- "</script></head>" +
- "<body onload='document.title=getBackgroundSize()'>" +
- " <div id='test'> </div>" +
- "</body></html>";
- settings.setJavaScriptEnabled(true);
- loadDataSync(awContents, onPageFinishedHelper, page, "text/html", false);
- String actualBackgroundSize = getTitleOnUiThread(awContents);
- assertEquals(expectedBackgroundSize, actualBackgroundSize);
- }
-
static class ViewPair {
private final AwContents contents0;
private final TestAwContentsClient client0;
@Override
public void run() {
awContents.getContentViewCore().sendDoubleTapForTest(
- SystemClock.uptimeMillis(), x, y, new Bundle());
+ SystemClock.uptimeMillis(), x, y);
}
});
}