Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Side by Side Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java

Issue 216873002: [Android WebView] Fix AwSettingsTest.testUseWideViewportControlsDoubleTabToZoom (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.content.Context; 7 import android.content.Context;
8 import android.graphics.Point; 8 import android.graphics.Point;
9 import android.os.Build; 9 import android.os.Build;
10 import android.os.SystemClock; 10 import android.os.SystemClock;
(...skipping 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after
2423 @Feature({"AndroidWebView", "Preferences"}) 2423 @Feature({"AndroidWebView", "Preferences"})
2424 public void testUseWideViewportControlsDoubleTabToZoom() throws Throwable { 2424 public void testUseWideViewportControlsDoubleTabToZoom() throws Throwable {
2425 final TestAwContentsClient contentClient = new TestAwContentsClient(); 2425 final TestAwContentsClient contentClient = new TestAwContentsClient();
2426 final AwTestContainerView testContainerView = 2426 final AwTestContainerView testContainerView =
2427 createAwTestContainerViewOnMainSync(contentClient); 2427 createAwTestContainerViewOnMainSync(contentClient);
2428 final AwContents awContents = testContainerView.getAwContents(); 2428 final AwContents awContents = testContainerView.getAwContents();
2429 CallbackHelper onPageFinishedHelper = contentClient.getOnPageFinishedHel per(); 2429 CallbackHelper onPageFinishedHelper = contentClient.getOnPageFinishedHel per();
2430 AwSettings settings = getAwSettingsOnUiThread(awContents); 2430 AwSettings settings = getAwSettingsOnUiThread(awContents);
2431 settings.setBuiltInZoomControls(true); 2431 settings.setBuiltInZoomControls(true);
2432 2432
2433 final String page = "<html><body>Page Text</body></html>"; 2433 DeviceDisplayInfo deviceInfo =
2434 DeviceDisplayInfo.create(testContainerView.getContext());
2435 int displayWidth = (int) (deviceInfo.getDisplayWidth() / deviceInfo.getD IPScale());
2436 int layoutWidth = displayWidth * 2;
2437 final String page = "<html>" +
2438 "<head><meta name='viewport' content='width=" + layoutWidth + "' >" +
2439 "<style> body { width: " + layoutWidth + "px; }</style></head>" +
2440 "<body>Page Text</body></html>";
2441
2434 assertFalse(settings.getUseWideViewPort()); 2442 assertFalse(settings.getUseWideViewPort());
2443 // Without wide viewport the <meta viewport> tag will be ignored by WebV iew,
2444 // but it doesn't really matter as we don't expect double tap to change the scale.
2435 loadDataSync(awContents, onPageFinishedHelper, page, "text/html", false) ; 2445 loadDataSync(awContents, onPageFinishedHelper, page, "text/html", false) ;
2436 final float initialScale = getScaleOnUiThread(awContents); 2446 final float initialScale = getScaleOnUiThread(awContents);
2437 simulateDoubleTapCenterOfWebViewOnUiThread(testContainerView); 2447 simulateDoubleTapCenterOfWebViewOnUiThread(testContainerView);
2438 Thread.sleep(1000); 2448 Thread.sleep(1000);
2439 assertEquals(initialScale, getScaleOnUiThread(awContents)); 2449 assertEquals(initialScale, getScaleOnUiThread(awContents));
2440 2450
2441 settings.setUseWideViewPort(true); 2451 settings.setUseWideViewPort(true);
2442 loadDataSync(awContents, onPageFinishedHelper, page, "text/html", false) ; 2452 loadDataSync(awContents, onPageFinishedHelper, page, "text/html", false) ;
2443 int onScaleChangedCallCount = contentClient.getOnScaleChangedHelper().ge tCallCount(); 2453 int onScaleChangedCallCount = contentClient.getOnScaleChangedHelper().ge tCallCount();
2444 simulateDoubleTapCenterOfWebViewOnUiThread(testContainerView); 2454 simulateDoubleTapCenterOfWebViewOnUiThread(testContainerView);
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
2747 final AwContents awContents = webView.getAwContents(); 2757 final AwContents awContents = webView.getAwContents();
2748 runTestOnUiThread(new Runnable() { 2758 runTestOnUiThread(new Runnable() {
2749 @Override 2759 @Override
2750 public void run() { 2760 public void run() {
2751 awContents.getContentViewCore().sendDoubleTapForTest( 2761 awContents.getContentViewCore().sendDoubleTapForTest(
2752 SystemClock.uptimeMillis(), x, y); 2762 SystemClock.uptimeMillis(), x, y);
2753 } 2763 }
2754 }); 2764 });
2755 } 2765 }
2756 } 2766 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698