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
3 // found in the LICENSE file.
5 package org.chromium.android_webview.test;
7 import android.test.suitebuilder.annotation.SmallTest;
9 import org.chromium.android_webview.AwContents;
10 import org.chromium.base.test.util.DisabledTest;
11 import org.chromium.content.browser.ContentViewCore;
12 import org.chromium.content.browser.test.util.CallbackHelper;
13 import org.chromium.android_webview.test.util.CommonResources;
15 import android.util.Log;
18 * Tests for the WebViewClient.onScaleChanged.
20 public class AwContentsClientOnScaleChangedTest extends AwTestBase {
21 private TestAwContentsClient mContentsClient;
22 private AwContents mAwContents;
25 protected void setUp() throws Exception {
27 mContentsClient = new TestAwContentsClient();
28 AwTestContainerView testContainerView =
29 createAwTestContainerViewOnMainSync(mContentsClient);
30 mAwContents = testContainerView.getAwContents();
34 protected void tearDown() throws Exception {
40 This test is timing out on ICS bots including cq. See crbug.com/175854.
43 public void testScaleUp() throws Throwable {
44 getAwSettingsOnUiThread(mAwContents).setUseWideViewPort(true);
45 loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
46 CommonResources.ABOUT_HTML, "text/html", false);
47 ContentViewCore core = mAwContents.getContentViewCore();
48 int callCount = mContentsClient.getOnScaleChangedHelper().getCallCount();
50 core.getViewportWidthPix() / 2, core.getViewportHeightPix() / 2,
51 core.getViewportWidthPix(), core.getViewportHeightPix());
52 // TODO: Investigate on using core.zoomIn();
53 mContentsClient.getOnScaleChangedHelper().waitForCallback(callCount);
54 assertTrue("Scale ratio:" + mContentsClient.getOnScaleChangedHelper().getLastScaleRatio(),
55 mContentsClient.getOnScaleChangedHelper().getLastScaleRatio() < 1);