OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.app.Activity; | 7 import android.app.Activity; |
8 import android.content.pm.ActivityInfo; | 8 import android.content.pm.ActivityInfo; |
9 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
10 import android.view.View; | 10 import android.view.View; |
11 import android.view.ViewConfiguration; | 11 import android.view.ViewConfiguration; |
12 | 12 |
13 import org.chromium.android_webview.AwContents; | 13 import org.chromium.android_webview.AwContents; |
14 import org.chromium.android_webview.AwSettings; | 14 import org.chromium.android_webview.AwSettings; |
15 import org.chromium.base.ThreadUtils; | 15 import org.chromium.base.ThreadUtils; |
| 16 import org.chromium.base.test.util.DisabledTest; |
16 import org.chromium.base.test.util.Feature; | 17 import org.chromium.base.test.util.Feature; |
17 import org.chromium.content.browser.test.util.Criteria; | 18 import org.chromium.content.browser.test.util.Criteria; |
18 import org.chromium.content.browser.test.util.CriteriaHelper; | 19 import org.chromium.content.browser.test.util.CriteriaHelper; |
19 | 20 |
20 import java.util.concurrent.Callable; | 21 import java.util.concurrent.Callable; |
21 | 22 |
22 /** | 23 /** |
23 * A test suite for zooming-related methods and settings. | 24 * A test suite for zooming-related methods and settings. |
24 */ | 25 */ |
25 public class AwZoomTest extends AwTestBase { | 26 public class AwZoomTest extends AwTestBase { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 assertTrue(zoomInOnUiThreadAndWait()); | 187 assertTrue(zoomInOnUiThreadAndWait()); |
187 } | 188 } |
188 assertTrue("Should be able to zoom out", canZoomOutOnUiThread()); | 189 assertTrue("Should be able to zoom out", canZoomOutOnUiThread()); |
189 | 190 |
190 while (canZoomOutOnUiThread()) { | 191 while (canZoomOutOnUiThread()) { |
191 assertTrue(zoomOutOnUiThreadAndWait()); | 192 assertTrue(zoomOutOnUiThreadAndWait()); |
192 } | 193 } |
193 assertTrue("Should be able to zoom in", canZoomInOnUiThread()); | 194 assertTrue("Should be able to zoom in", canZoomInOnUiThread()); |
194 } | 195 } |
195 | 196 |
| 197 /* |
196 @SmallTest | 198 @SmallTest |
197 @Feature({"AndroidWebView"}) | 199 @Feature({"AndroidWebView"}) |
| 200 http://crbug.com/239144 |
| 201 */ |
| 202 @DisabledTest |
198 public void testMagnification() throws Throwable { | 203 public void testMagnification() throws Throwable { |
199 runMagnificationTest(true); | 204 runMagnificationTest(true); |
200 } | 205 } |
201 | 206 |
202 // According to Android CTS test, zoomIn/Out must work | 207 // According to Android CTS test, zoomIn/Out must work |
203 // even if supportZoom is turned off. | 208 // even if supportZoom is turned off. |
| 209 /* |
204 @SmallTest | 210 @SmallTest |
205 @Feature({"AndroidWebView"}) | 211 @Feature({"AndroidWebView"}) |
| 212 http://crbug.com/239144 |
| 213 */ |
| 214 @DisabledTest |
206 public void testMagnificationWithZoomSupportOff() throws Throwable { | 215 public void testMagnificationWithZoomSupportOff() throws Throwable { |
207 runMagnificationTest(false); | 216 runMagnificationTest(false); |
208 } | 217 } |
209 | 218 |
210 @SmallTest | 219 @SmallTest |
211 @Feature({"AndroidWebView"}) | 220 @Feature({"AndroidWebView"}) |
212 public void testZoomUsingMultiTouch() throws Throwable { | 221 public void testZoomUsingMultiTouch() throws Throwable { |
213 AwSettings webSettings = getAwSettingsOnUiThread(mAwContents); | 222 AwSettings webSettings = getAwSettingsOnUiThread(mAwContents); |
214 loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), | 223 loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), |
215 getZoomableHtml(), "text/html", false); | 224 getZoomableHtml(), "text/html", false); |
216 | 225 |
217 assertTrue(webSettings.supportZoom()); | 226 assertTrue(webSettings.supportZoom()); |
218 assertFalse(webSettings.getBuiltInZoomControls()); | 227 assertFalse(webSettings.getBuiltInZoomControls()); |
219 assertFalse(isMultiTouchZoomSupportedOnUiThread()); | 228 assertFalse(isMultiTouchZoomSupportedOnUiThread()); |
220 | 229 |
221 webSettings.setBuiltInZoomControls(true); | 230 webSettings.setBuiltInZoomControls(true); |
222 assertTrue(isMultiTouchZoomSupportedOnUiThread()); | 231 assertTrue(isMultiTouchZoomSupportedOnUiThread()); |
223 | 232 |
224 webSettings.setSupportZoom(false); | 233 webSettings.setSupportZoom(false); |
225 assertFalse(isMultiTouchZoomSupportedOnUiThread()); | 234 assertFalse(isMultiTouchZoomSupportedOnUiThread()); |
226 } | 235 } |
227 | 236 |
| 237 /* |
228 @SmallTest | 238 @SmallTest |
229 @Feature({"AndroidWebView"}) | 239 @Feature({"AndroidWebView"}) |
| 240 http://crbug.com/239144 |
| 241 */ |
| 242 @DisabledTest |
230 public void testZoomControls() throws Throwable { | 243 public void testZoomControls() throws Throwable { |
231 AwSettings webSettings = getAwSettingsOnUiThread(mAwContents); | 244 AwSettings webSettings = getAwSettingsOnUiThread(mAwContents); |
232 int onScaleChangedCallCount = mContentsClient.getOnScaleChangedHelper().
getCallCount(); | 245 int onScaleChangedCallCount = mContentsClient.getOnScaleChangedHelper().
getCallCount(); |
233 loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), | 246 loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), |
234 getZoomableHtml(), "text/html", false); | 247 getZoomableHtml(), "text/html", false); |
235 mContentsClient.getOnScaleChangedHelper().waitForCallback(onScaleChanged
CallCount); | 248 mContentsClient.getOnScaleChangedHelper().waitForCallback(onScaleChanged
CallCount); |
236 // It must be possible to zoom in (or zoom out) for zoom controls to be
shown | 249 // It must be possible to zoom in (or zoom out) for zoom controls to be
shown |
237 assertTrue("Should be able to zoom in", canZoomInOnUiThread()); | 250 assertTrue("Should be able to zoom in", canZoomInOnUiThread()); |
238 | 251 |
239 assertTrue(webSettings.supportZoom()); | 252 assertTrue(webSettings.supportZoom()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 activity.setRequestedOrientation(orientation); | 308 activity.setRequestedOrientation(orientation); |
296 invokeZoomPickerOnUiThread(); | 309 invokeZoomPickerOnUiThread(); |
297 | 310 |
298 // We may crash shortly (as the zoom picker has a short delay in it befo
re | 311 // We may crash shortly (as the zoom picker has a short delay in it befo
re |
299 // it tries to register it's BroadcastReceiver), so sleep to verify we d
on't. | 312 // it tries to register it's BroadcastReceiver), so sleep to verify we d
on't. |
300 // The delay is encoded in ZoomButtonsController#ZOOM_CONTROLS_TIMEOUT, | 313 // The delay is encoded in ZoomButtonsController#ZOOM_CONTROLS_TIMEOUT, |
301 // if that changes we may need to update this test. | 314 // if that changes we may need to update this test. |
302 Thread.sleep(ViewConfiguration.getZoomControlsTimeout()); | 315 Thread.sleep(ViewConfiguration.getZoomControlsTimeout()); |
303 } | 316 } |
304 } | 317 } |
OLD | NEW |