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
3 // found in the LICENSE file.
5 package org.chromium.android_webview.test;
7 import org.chromium.android_webview.AwContents;
8 import org.chromium.android_webview.test.util.CommonResources;
9 import org.chromium.base.test.util.DisabledTest;
10 import org.chromium.content.browser.ContentViewCore;
13 * Tests for the WebViewClient.onScaleChanged.
15 public class AwContentsClientOnScaleChangedTest extends AwTestBase {
16 private TestAwContentsClient mContentsClient;
17 private AwContents mAwContents;
20 protected void setUp() throws Exception {
22 mContentsClient = new TestAwContentsClient();
23 AwTestContainerView testContainerView =
24 createAwTestContainerViewOnMainSync(mContentsClient);
25 mAwContents = testContainerView.getAwContents();
29 protected void tearDown() throws Exception {
35 This test is timing out on ICS bots including cq. See crbug.com/175854.
38 public void testScaleUp() throws Throwable {
39 getAwSettingsOnUiThread(mAwContents).setUseWideViewPort(true);
40 loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
41 CommonResources.ABOUT_HTML, "text/html", false);
42 ContentViewCore core = mAwContents.getContentViewCore();
43 int callCount = mContentsClient.getOnScaleChangedHelper().getCallCount();
45 core.getViewportWidthPix() / 2, core.getViewportHeightPix() / 2,
46 core.getViewportWidthPix(), core.getViewportHeightPix());
47 // TODO: Investigate on using core.zoomIn();
48 mContentsClient.getOnScaleChangedHelper().waitForCallback(callCount);
49 assertTrue("Scale ratio:" + mContentsClient.getOnScaleChangedHelper().getLastScaleRatio(),
50 mContentsClient.getOnScaleChangedHelper().getLastScaleRatio() < 1);