OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.test.suitebuilder.annotation.SmallTest; |
| 8 |
7 import org.chromium.android_webview.AwContents; | 9 import org.chromium.android_webview.AwContents; |
8 import org.chromium.android_webview.test.util.CommonResources; | 10 import org.chromium.android_webview.test.util.CommonResources; |
9 import org.chromium.base.test.util.DisabledTest; | |
10 import org.chromium.content.browser.ContentViewCore; | 11 import org.chromium.content.browser.ContentViewCore; |
11 | 12 |
12 /** | 13 /** |
13 * Tests for the WebViewClient.onScaleChanged. | 14 * Tests for the WebViewClient.onScaleChanged. |
14 */ | 15 */ |
15 public class AwContentsClientOnScaleChangedTest extends AwTestBase { | 16 public class AwContentsClientOnScaleChangedTest extends AwTestBase { |
16 private TestAwContentsClient mContentsClient; | 17 private TestAwContentsClient mContentsClient; |
17 private AwContents mAwContents; | 18 private AwContents mAwContents; |
18 | 19 |
19 @Override | 20 @Override |
20 protected void setUp() throws Exception { | 21 protected void setUp() throws Exception { |
21 super.setUp(); | 22 super.setUp(); |
22 mContentsClient = new TestAwContentsClient(); | 23 mContentsClient = new TestAwContentsClient(); |
23 AwTestContainerView testContainerView = | 24 AwTestContainerView testContainerView = |
24 createAwTestContainerViewOnMainSync(mContentsClient); | 25 createAwTestContainerViewOnMainSync(mContentsClient); |
25 mAwContents = testContainerView.getAwContents(); | 26 mAwContents = testContainerView.getAwContents(); |
26 } | 27 } |
27 | 28 |
28 @Override | 29 @Override |
29 protected void tearDown() throws Exception { | 30 protected void tearDown() throws Exception { |
30 super.tearDown(); | 31 super.tearDown(); |
31 } | 32 } |
32 | 33 |
33 /* | |
34 @SmallTest | 34 @SmallTest |
35 This test is timing out on ICS bots including cq. See crbug.com/175854. | |
36 */ | |
37 @DisabledTest | |
38 public void testScaleUp() throws Throwable { | 35 public void testScaleUp() throws Throwable { |
39 getAwSettingsOnUiThread(mAwContents).setUseWideViewPort(true); | 36 getAwSettingsOnUiThread(mAwContents).setUseWideViewPort(true); |
40 loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), | 37 loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), |
41 CommonResources.ABOUT_HTML, "text/html", false); | 38 CommonResources.ABOUT_HTML, "text/html", false); |
42 ContentViewCore core = mAwContents.getContentViewCore(); | 39 ContentViewCore core = mAwContents.getContentViewCore(); |
43 int callCount = mContentsClient.getOnScaleChangedHelper().getCallCount()
; | 40 int callCount = mContentsClient.getOnScaleChangedHelper().getCallCount()
; |
44 core.onSizeChanged( | 41 core.onSizeChanged( |
45 core.getViewportWidthPix() / 2, core.getViewportHeightPix() / 2, | 42 core.getViewportWidthPix() / 2, core.getViewportHeightPix() / 2, |
46 core.getViewportWidthPix(), core.getViewportHeightPix()); | 43 core.getViewportWidthPix(), core.getViewportHeightPix()); |
47 // TODO: Investigate on using core.zoomIn(); | 44 // TODO: Investigate on using core.zoomIn(); |
48 mContentsClient.getOnScaleChangedHelper().waitForCallback(callCount); | 45 mContentsClient.getOnScaleChangedHelper().waitForCallback(callCount); |
49 assertTrue("Scale ratio:" + mContentsClient.getOnScaleChangedHelper().ge
tLastScaleRatio(), | 46 assertTrue("Scale ratio:" + mContentsClient.getOnScaleChangedHelper().ge
tLastScaleRatio(), |
50 mContentsClient.getOnScaleChangedHelper().getLastScaleRatio() <
1); | 47 mContentsClient.getOnScaleChangedHelper().getLastScaleRatio() <
1); |
51 } | 48 } |
52 } | 49 } |
OLD | NEW |