OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.android_webview.test; | 5 package org.chromium.android_webview.test; |
6 | 6 |
7 import android.os.Build; | 7 import android.os.Build; |
8 import android.test.suitebuilder.annotation.MediumTest; | 8 import android.test.suitebuilder.annotation.MediumTest; |
9 | 9 |
10 import org.chromium.android_webview.AwContents; | 10 import org.chromium.android_webview.AwContents; |
11 import org.chromium.android_webview.AwContentsClient; | 11 import org.chromium.android_webview.AwContentsClient; |
12 import org.chromium.android_webview.AwSettings; | 12 import org.chromium.android_webview.AwSettings; |
| 13 import org.chromium.base.annotations.SuppressFBWarnings; |
13 import org.chromium.base.test.util.Feature; | 14 import org.chromium.base.test.util.Feature; |
14 import org.chromium.base.test.util.MinAndroidSdkLevel; | 15 import org.chromium.base.test.util.MinAndroidSdkLevel; |
15 import org.chromium.content.browser.test.util.CallbackHelper; | 16 import org.chromium.content.browser.test.util.CallbackHelper; |
16 import org.chromium.ui.gfx.DeviceDisplayInfo; | 17 import org.chromium.ui.gfx.DeviceDisplayInfo; |
17 | 18 |
18 import java.util.Locale; | 19 import java.util.Locale; |
19 import java.util.concurrent.Callable; | 20 import java.util.concurrent.Callable; |
20 | 21 |
21 /** | 22 /** |
22 * Tests for legacy quirks (compatibility with WebView Classic). | 23 * Tests for legacy quirks (compatibility with WebView Classic). |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 assertEquals(displayWidth, actualWidth, 10f); | 113 assertEquals(displayWidth, actualWidth, 10f); |
113 assertEquals(1.0f, getScaleOnUiThread(awContents)); | 114 assertEquals(1.0f, getScaleOnUiThread(awContents)); |
114 | 115 |
115 settings.setUseWideViewPort(true); | 116 settings.setUseWideViewPort(true); |
116 loadDataSync(awContents, onPageFinishedHelper, page, "text/html", false)
; | 117 loadDataSync(awContents, onPageFinishedHelper, page, "text/html", false)
; |
117 actualWidth = Integer.parseInt(getTitleOnUiThread(awContents)); | 118 actualWidth = Integer.parseInt(getTitleOnUiThread(awContents)); |
118 assertEquals(displayWidth, actualWidth, 10f); | 119 assertEquals(displayWidth, actualWidth, 10f); |
119 assertEquals(1.0f, getScaleOnUiThread(awContents)); | 120 assertEquals(1.0f, getScaleOnUiThread(awContents)); |
120 } | 121 } |
121 | 122 |
| 123 @SuppressFBWarnings("DLS_DEAD_LOCAL_STORE") |
122 @MediumTest | 124 @MediumTest |
123 @Feature({"AndroidWebView"}) | 125 @Feature({"AndroidWebView"}) |
124 public void testScreenSizeInPhysicalPixelsQuirk() throws Throwable { | 126 public void testScreenSizeInPhysicalPixelsQuirk() throws Throwable { |
125 final TestAwContentsClient contentClient = new TestAwContentsClient(); | 127 final TestAwContentsClient contentClient = new TestAwContentsClient(); |
126 final AwTestContainerView testContainerView = | 128 final AwTestContainerView testContainerView = |
127 createAwTestContainerViewOnMainSyncInQuirksMode(contentClient); | 129 createAwTestContainerViewOnMainSyncInQuirksMode(contentClient); |
128 final AwContents awContents = testContainerView.getAwContents(); | 130 final AwContents awContents = testContainerView.getAwContents(); |
129 AwSettings settings = getAwSettingsOnUiThread(awContents); | 131 AwSettings settings = getAwSettingsOnUiThread(awContents); |
130 CallbackHelper onPageFinishedHelper = contentClient.getOnPageFinishedHel
per(); | 132 CallbackHelper onPageFinishedHelper = contentClient.getOnPageFinishedHel
per(); |
131 | 133 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 private void ensureScaleBecomes(final float targetScale, final AwContents aw
Contents) | 350 private void ensureScaleBecomes(final float targetScale, final AwContents aw
Contents) |
349 throws Throwable { | 351 throws Throwable { |
350 poll(new Callable<Boolean>() { | 352 poll(new Callable<Boolean>() { |
351 @Override | 353 @Override |
352 public Boolean call() throws Exception { | 354 public Boolean call() throws Exception { |
353 return targetScale == getScaleOnUiThread(awContents); | 355 return targetScale == getScaleOnUiThread(awContents); |
354 } | 356 } |
355 }); | 357 }); |
356 } | 358 } |
357 } | 359 } |
OLD | NEW |