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.app.Activity; | 7 import android.app.Activity; |
8 import android.content.pm.ActivityInfo; | 8 import android.content.pm.ActivityInfo; |
9 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
10 import android.view.View; | 10 import android.view.View; |
(...skipping 18 matching lines...) Expand all Loading... |
29 @Override | 29 @Override |
30 public void setUp() throws Exception { | 30 public void setUp() throws Exception { |
31 super.setUp(); | 31 super.setUp(); |
32 mContentsClient = new TestAwContentsClient(); | 32 mContentsClient = new TestAwContentsClient(); |
33 final AwTestContainerView testContainerView = | 33 final AwTestContainerView testContainerView = |
34 createAwTestContainerViewOnMainSync(mContentsClient); | 34 createAwTestContainerViewOnMainSync(mContentsClient); |
35 mAwContents = testContainerView.getAwContents(); | 35 mAwContents = testContainerView.getAwContents(); |
36 } | 36 } |
37 | 37 |
38 private String getZoomableHtml(float scale) { | 38 private String getZoomableHtml(float scale) { |
39 final int divWidthPercent = (int)(100.0f / scale); | 39 final int divWidthPercent = (int) (100.0f / scale); |
40 return String.format(Locale.US, "<html><head><meta name=\"viewport\" con
tent=\"" + | 40 return String.format(Locale.US, "<html><head><meta name=\"viewport\" con
tent=\"" + |
41 "width=device-width, minimum-scale=%f, maximum-scale=%f, initial
-scale=%f" + | 41 "width=device-width, minimum-scale=%f, maximum-scale=%f, initial
-scale=%f" + |
42 "\"/></head><body style='margin:0'>" + | 42 "\"/></head><body style='margin:0'>" + |
43 "<div style='width:%d%%;height:100px;border:1px solid black'>Zoo
mable</div>" + | 43 "<div style='width:%d%%;height:100px;border:1px solid black'>Zoo
mable</div>" + |
44 "</body></html>", | 44 "</body></html>", |
45 scale, MAXIMUM_SCALE, scale, divWidthPercent); | 45 scale, MAXIMUM_SCALE, scale, divWidthPercent); |
46 } | 46 } |
47 | 47 |
48 private String getNonZoomableHtml() { | 48 private String getNonZoomableHtml() { |
49 // This page can't be zoomed because its viewport fully occupies | 49 // This page can't be zoomed because its viewport fully occupies |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 activity.setRequestedOrientation(orientation); | 291 activity.setRequestedOrientation(orientation); |
292 invokeZoomPickerOnUiThread(); | 292 invokeZoomPickerOnUiThread(); |
293 | 293 |
294 // We may crash shortly (as the zoom picker has a short delay in it befo
re | 294 // We may crash shortly (as the zoom picker has a short delay in it befo
re |
295 // it tries to register it's BroadcastReceiver), so sleep to verify we d
on't. | 295 // it tries to register it's BroadcastReceiver), so sleep to verify we d
on't. |
296 // The delay is encoded in ZoomButtonsController#ZOOM_CONTROLS_TIMEOUT, | 296 // The delay is encoded in ZoomButtonsController#ZOOM_CONTROLS_TIMEOUT, |
297 // if that changes we may need to update this test. | 297 // if that changes we may need to update this test. |
298 Thread.sleep(ViewConfiguration.getZoomControlsTimeout()); | 298 Thread.sleep(ViewConfiguration.getZoomControlsTimeout()); |
299 } | 299 } |
300 } | 300 } |
OLD | NEW |