OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.MediumTest; | 7 import android.test.suitebuilder.annotation.MediumTest; |
8 | 8 |
9 import org.chromium.android_webview.AwContents; | 9 import org.chromium.android_webview.AwContents; |
10 import org.chromium.android_webview.AwContentsClient; | 10 import org.chromium.android_webview.AwContentsClient; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 pageWidth, pageScale); | 197 pageWidth, pageScale); |
198 | 198 |
199 settings.setJavaScriptEnabled(true); | 199 settings.setJavaScriptEnabled(true); |
200 settings.setUseWideViewPort(true); | 200 settings.setUseWideViewPort(true); |
201 settings.setBuiltInZoomControls(true); | 201 settings.setBuiltInZoomControls(true); |
202 settings.setSupportZoom(true); | 202 settings.setSupportZoom(true); |
203 | 203 |
204 loadDataSync(awContents, onPageFinishedHelper, page, "text/html", false)
; | 204 loadDataSync(awContents, onPageFinishedHelper, page, "text/html", false)
; |
205 // ContentView must update itself according to the viewport setup. | 205 // ContentView must update itself according to the viewport setup. |
206 // As we specify 'user-scalable=0', the page must become non-zoomable. | 206 // As we specify 'user-scalable=0', the page must become non-zoomable. |
207 poll(new Callable<Boolean>() { | 207 pollInstrumentationThread(new Callable<Boolean>() { |
208 @Override | 208 @Override |
209 public Boolean call() throws Exception { | 209 public Boolean call() throws Exception { |
210 return !canZoomInOnUiThread(awContents) && !canZoomOutOnUiThread
(awContents); | 210 return !canZoomInOnUiThread(awContents) && !canZoomOutOnUiThread
(awContents); |
211 } | 211 } |
212 }); | 212 }); |
213 int width = Integer.parseInt(getTitleOnUiThread(awContents)); | 213 int width = Integer.parseInt(getTitleOnUiThread(awContents)); |
214 assertEquals(pageWidth, width); | 214 assertEquals(pageWidth, width); |
215 assertEquals(pageScale, getScaleOnUiThread(awContents)); | 215 assertEquals(pageScale, getScaleOnUiThread(awContents)); |
216 } | 216 } |
217 | 217 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 assertEquals(expectedBackgroundSize, actualBackgroundSize); | 339 assertEquals(expectedBackgroundSize, actualBackgroundSize); |
340 } | 340 } |
341 | 341 |
342 private AwTestContainerView createAwTestContainerViewOnMainSyncInQuirksMode( | 342 private AwTestContainerView createAwTestContainerViewOnMainSyncInQuirksMode( |
343 final AwContentsClient client) throws Exception { | 343 final AwContentsClient client) throws Exception { |
344 return createAwTestContainerViewOnMainSync(client, true); | 344 return createAwTestContainerViewOnMainSync(client, true); |
345 } | 345 } |
346 | 346 |
347 private void ensureScaleBecomes(final float targetScale, final AwContents aw
Contents) | 347 private void ensureScaleBecomes(final float targetScale, final AwContents aw
Contents) |
348 throws Throwable { | 348 throws Throwable { |
349 poll(new Callable<Boolean>() { | 349 pollInstrumentationThread(new Callable<Boolean>() { |
350 @Override | 350 @Override |
351 public Boolean call() throws Exception { | 351 public Boolean call() throws Exception { |
352 return targetScale == getScaleOnUiThread(awContents); | 352 return targetScale == getScaleOnUiThread(awContents); |
353 } | 353 } |
354 }); | 354 }); |
355 } | 355 } |
356 } | 356 } |
OLD | NEW |