diff options
author | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-17 09:20:54 +0000 |
---|---|---|
committer | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-17 09:20:54 +0000 |
commit | 4b1f621eb1d309681695fba3d02a4e990e5a2f9a (patch) | |
tree | 82a81502410169a288713813c6d14247c8ccf01d /android_webview/javatests | |
parent | 61a741eede7e32d54b4347f9d40e1d974fc252ef (diff) | |
download | chromium_src-4b1f621eb1d309681695fba3d02a4e990e5a2f9a.zip chromium_src-4b1f621eb1d309681695fba3d02a4e990e5a2f9a.tar.gz chromium_src-4b1f621eb1d309681695fba3d02a4e990e5a2f9a.tar.bz2 |
[Android WebView] Fix LoadsImagesAutomatically tests after crbug.com/224317
Blink now has more reasonable behavior of LoadsImagesAutomatically and
ImagesDisabled settings. Namely, ImagesDisabled prevents any images from
showing up, including cached ones. LoadsImagesAutomatically now allows
"loading" of data uri images embedded in pages.
This allows us to simplify our wirings for implementing Android WebView's
LoadsImagesAutomatically and BlockNetworkImage. The trick is that we should
wire them cris-cross, as WebView's LoadsImagesAutomatically must block
all images from loading / showing up (as ImagesDisabled), while
BlockNetworkImage's contract is now fulfilled by Blink's
LoadsImagesAutomatically. Please read comments on the bugs referenced
if this sounds weird to you.
AwSettingsTest.testLoadsImagesAutomaticallyWithCachedImage is removed because
this behavior is not in fact standardized in WebView Classic and isn't
preserved anymore. In fact, as cache is transient, it would be unwise for an
application to rely on the fact that cached images will stay there forever
and thus could be shown even if LoadsImagesAutomatically is disabled.
BUG=248249,224317
R=benm@chromium.org, joth@chromium.org
Review URL: https://codereview.chromium.org/16932006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206692 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/javatests')
-rw-r--r-- | android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java | 92 |
1 files changed, 4 insertions, 88 deletions
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java index dcfe4b77..a209e6af 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java @@ -1365,91 +1365,11 @@ public class AwSettingsTest extends AwTestBase { new AwSettingsDefaultFontSizeTestHelper(views.getContents1(), views.getClient1())); } - // The test verifies that disabling images loading by setting - // setLoadsImagesAutomatically to false doesn't prevent images already - // contained in the memory cache to be displayed. The cache is shared among - // all views, so the image can be put there by another view. - /* - * Fixme (crbug.com/248249): Needs investigation after crbug.com/224317 - * @Feature({"AndroidWebView", "Preferences"}) - * @SmallTest - */ - @DisabledTest - public void testLoadsImagesAutomaticallyWithCachedImage() throws Throwable { - ViewPair views = createViews(); - AwSettings settings0 = getAwSettingsOnUiThread(views.getContents0()); - settings0.setJavaScriptEnabled(true); - AwSettings settings1 = getAwSettingsOnUiThread(views.getContents1()); - settings1.setJavaScriptEnabled(true); - ImagePageGenerator generator = new ImagePageGenerator(0, false); - - // First disable images loading and verify it. - settings0.setLoadsImagesAutomatically(false); - settings1.setLoadsImagesAutomatically(false); - loadDataSync(views.getContents0(), - views.getClient0().getOnPageFinishedHelper(), - generator.getPageSource(), - "text/html", false); - loadDataSync(views.getContents1(), - views.getClient1().getOnPageFinishedHelper(), - generator.getPageSource(), - "text/html", false); - assertEquals(ImagePageGenerator.IMAGE_NOT_LOADED_STRING, - getTitleOnUiThread(views.getContents0())); - assertEquals(ImagePageGenerator.IMAGE_NOT_LOADED_STRING, - getTitleOnUiThread(views.getContents1())); - - // Now enable images loading only for view 0. - settings0.setLoadsImagesAutomatically(true); - loadDataSync(views.getContents0(), - views.getClient0().getOnPageFinishedHelper(), - generator.getPageSource(), - "text/html", false); - loadDataSync(views.getContents1(), - views.getClient1().getOnPageFinishedHelper(), - generator.getPageSource(), - "text/html", false); - - // Once the image has been cached by contentView0, it is available to contentView1. - assertEquals(ImagePageGenerator.IMAGE_LOADED_STRING, - getTitleOnUiThread(views.getContents0())); - assertEquals(ImagePageGenerator.IMAGE_LOADED_STRING, - getTitleOnUiThread(views.getContents1())); - ImagePageGenerator generator1 = new ImagePageGenerator(1, false); - - // This is a new image. view 1 can't load it. - loadDataSync(views.getContents1(), - views.getClient1().getOnPageFinishedHelper(), - generator1.getPageSource(), - "text/html", false); - assertEquals(ImagePageGenerator.IMAGE_NOT_LOADED_STRING, - getTitleOnUiThread(views.getContents1())); - loadDataSync(views.getContents0(), - views.getClient0().getOnPageFinishedHelper(), - generator1.getPageSource(), - "text/html", false); - loadDataSync(views.getContents1(), - views.getClient1().getOnPageFinishedHelper(), - generator1.getPageSource(), - "text/html", false); - - // Once the image has been cached by contentViewCore0, it is available to contentViewCore1. - assertEquals(ImagePageGenerator.IMAGE_LOADED_STRING, - getTitleOnUiThread(views.getContents0())); - assertEquals(ImagePageGenerator.IMAGE_LOADED_STRING, - getTitleOnUiThread(views.getContents1())); - } - // The test verifies that after changing the LoadsImagesAutomatically // setting value from false to true previously skipped images are // automatically loaded. - - /* - * Fixme (crbug.com/248249): Needs investigation after crbug.com/224317 - * @SmallTest - * @Feature({"AndroidWebView", "Preferences"}) - */ - @DisabledTest + @SmallTest + @Feature({"AndroidWebView", "Preferences"}) public void testLoadsImagesAutomaticallyNoPageReload() throws Throwable { final TestAwContentsClient contentClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = @@ -1483,12 +1403,8 @@ public class AwSettingsTest extends AwTestBase { } - /* - * Fixme (crbug.com/248249): Needs investigation after crbug.com/224317 - * @SmallTest - * @Feature({"AndroidWebView", "Preferences"}) - */ - @DisabledTest + @SmallTest + @Feature({"AndroidWebView", "Preferences"}) public void testLoadsImagesAutomaticallyWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( |