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

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

Issue 1786243003: Rename pollForCriteria to pollForTestThreadCriteria. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and update MediaRouterIntegrationTest.java Created 4 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
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.net.http.SslError; 9 import android.net.http.SslError;
10 import android.os.Build; 10 import android.os.Build;
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 mOldFontSize = getActualFontSize(); 934 mOldFontSize = getActualFontSize();
935 mNeedToWaitForFontSizeChange = true; 935 mNeedToWaitForFontSizeChange = true;
936 } 936 }
937 } 937 }
938 938
939 protected float getActualFontSize() throws Throwable { 939 protected float getActualFontSize() throws Throwable {
940 if (!mNeedToWaitForFontSizeChange) { 940 if (!mNeedToWaitForFontSizeChange) {
941 executeJavaScriptAndWaitForResult("setTitleToActualFontSize()"); 941 executeJavaScriptAndWaitForResult("setTitleToActualFontSize()");
942 } else { 942 } else {
943 final float oldFontSize = mOldFontSize; 943 final float oldFontSize = mOldFontSize;
944 poll(new Callable<Boolean>() { 944 pollInstrumentationThread(new Callable<Boolean>() {
945 @Override 945 @Override
946 public Boolean call() throws Exception { 946 public Boolean call() throws Exception {
947 executeJavaScriptAndWaitForResult("setTitleToActualFontS ize()"); 947 executeJavaScriptAndWaitForResult("setTitleToActualFontS ize()");
948 float newFontSize = Float.parseFloat(getTitleOnUiThread( )); 948 float newFontSize = Float.parseFloat(getTitleOnUiThread( ));
949 return newFontSize != oldFontSize; 949 return newFontSize != oldFontSize;
950 } 950 }
951 }); 951 });
952 mNeedToWaitForFontSizeChange = false; 952 mNeedToWaitForFontSizeChange = false;
953 } 953 }
954 return Float.parseFloat(getTitleOnUiThread()); 954 return Float.parseFloat(getTitleOnUiThread());
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 1157
1158 @Override 1158 @Override
1159 protected void setCurrentValue(Boolean value) { 1159 protected void setCurrentValue(Boolean value) {
1160 mAwSettings.setJavaScriptCanOpenWindowsAutomatically(value); 1160 mAwSettings.setJavaScriptCanOpenWindowsAutomatically(value);
1161 } 1161 }
1162 1162
1163 @Override 1163 @Override
1164 protected void doEnsureSettingHasValue(Boolean value) throws Throwable { 1164 protected void doEnsureSettingHasValue(Boolean value) throws Throwable {
1165 loadDataSync(getData()); 1165 loadDataSync(getData());
1166 final boolean expectPopupEnabled = value; 1166 final boolean expectPopupEnabled = value;
1167 poll(new Callable<Boolean>() { 1167 pollInstrumentationThread(new Callable<Boolean>() {
1168 @Override 1168 @Override
1169 public Boolean call() throws Exception { 1169 public Boolean call() throws Exception {
1170 String title = getTitleOnUiThread(); 1170 String title = getTitleOnUiThread();
1171 return expectPopupEnabled ? POPUP_ENABLED.equals(title) : 1171 return expectPopupEnabled ? POPUP_ENABLED.equals(title) :
1172 POPUP_BLOCKED.equals(title); 1172 POPUP_BLOCKED.equals(title);
1173 } 1173 }
1174 }); 1174 });
1175 assertEquals(value ? POPUP_ENABLED : POPUP_BLOCKED, getTitleOnUiThre ad()); 1175 assertEquals(value ? POPUP_ENABLED : POPUP_BLOCKED, getTitleOnUiThre ad());
1176 } 1176 }
1177 1177
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 settings.setJavaScriptEnabled(true); 1575 settings.setJavaScriptEnabled(true);
1576 ImagePageGenerator generator = new ImagePageGenerator(0, false); 1576 ImagePageGenerator generator = new ImagePageGenerator(0, false);
1577 settings.setLoadsImagesAutomatically(false); 1577 settings.setLoadsImagesAutomatically(false);
1578 loadDataSync(awContents, 1578 loadDataSync(awContents,
1579 contentClient.getOnPageFinishedHelper(), 1579 contentClient.getOnPageFinishedHelper(),
1580 generator.getPageSource(), 1580 generator.getPageSource(),
1581 "text/html", false); 1581 "text/html", false);
1582 assertEquals(ImagePageGenerator.IMAGE_NOT_LOADED_STRING, 1582 assertEquals(ImagePageGenerator.IMAGE_NOT_LOADED_STRING,
1583 getTitleOnUiThread(awContents)); 1583 getTitleOnUiThread(awContents));
1584 settings.setLoadsImagesAutomatically(true); 1584 settings.setLoadsImagesAutomatically(true);
1585 poll(new Callable<Boolean>() { 1585 pollInstrumentationThread(new Callable<Boolean>() {
1586 @Override 1586 @Override
1587 public Boolean call() throws Exception { 1587 public Boolean call() throws Exception {
1588 return !ImagePageGenerator.IMAGE_NOT_LOADED_STRING.equals( 1588 return !ImagePageGenerator.IMAGE_NOT_LOADED_STRING.equals(
1589 getTitleOnUiThread(awContents)); 1589 getTitleOnUiThread(awContents));
1590 } 1590 }
1591 }); 1591 });
1592 assertEquals(ImagePageGenerator.IMAGE_LOADED_STRING, getTitleOnUiThread( awContents)); 1592 assertEquals(ImagePageGenerator.IMAGE_LOADED_STRING, getTitleOnUiThread( awContents));
1593 } 1593 }
1594 1594
1595 1595
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 TestWebServer webServer = TestWebServer.start(); 1962 TestWebServer webServer = TestWebServer.start();
1963 try { 1963 try {
1964 final String httpImageUrl = generator.getPageUrl(webServer); 1964 final String httpImageUrl = generator.getPageUrl(webServer);
1965 1965
1966 settings.setImagesEnabled(false); 1966 settings.setImagesEnabled(false);
1967 loadUrlSync(awContents, contentClient.getOnPageFinishedHelper(), htt pImageUrl); 1967 loadUrlSync(awContents, contentClient.getOnPageFinishedHelper(), htt pImageUrl);
1968 assertEquals(ImagePageGenerator.IMAGE_NOT_LOADED_STRING, 1968 assertEquals(ImagePageGenerator.IMAGE_NOT_LOADED_STRING,
1969 getTitleOnUiThread(awContents)); 1969 getTitleOnUiThread(awContents));
1970 1970
1971 settings.setImagesEnabled(true); 1971 settings.setImagesEnabled(true);
1972 poll(new Callable<Boolean>() { 1972 pollInstrumentationThread(new Callable<Boolean>() {
1973 @Override 1973 @Override
1974 public Boolean call() throws Exception { 1974 public Boolean call() throws Exception {
1975 return ImagePageGenerator.IMAGE_LOADED_STRING.equals( 1975 return ImagePageGenerator.IMAGE_LOADED_STRING.equals(
1976 getTitleOnUiThread(awContents)); 1976 getTitleOnUiThread(awContents));
1977 } 1977 }
1978 }); 1978 });
1979 } finally { 1979 } finally {
1980 webServer.shutdown(); 1980 webServer.shutdown();
1981 } 1981 }
1982 } 1982 }
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 int waitUntilHtmlIsRequested(final int initialRequestCount) throws Excep tion { 2379 int waitUntilHtmlIsRequested(final int initialRequestCount) throws Excep tion {
2380 return waitUntilResourceIsRequested(mHtmlPath, initialRequestCount); 2380 return waitUntilResourceIsRequested(mHtmlPath, initialRequestCount);
2381 } 2381 }
2382 2382
2383 int waitUntilManifestIsRequested(final int initialRequestCount) throws E xception { 2383 int waitUntilManifestIsRequested(final int initialRequestCount) throws E xception {
2384 return waitUntilResourceIsRequested(mManifestPath, initialRequestCou nt); 2384 return waitUntilResourceIsRequested(mManifestPath, initialRequestCou nt);
2385 } 2385 }
2386 2386
2387 private int waitUntilResourceIsRequested( 2387 private int waitUntilResourceIsRequested(
2388 final String path, final int initialRequestCount) throws Excepti on { 2388 final String path, final int initialRequestCount) throws Excepti on {
2389 poll(new Callable<Boolean>() { 2389 pollInstrumentationThread(new Callable<Boolean>() {
2390 @Override 2390 @Override
2391 public Boolean call() throws Exception { 2391 public Boolean call() throws Exception {
2392 return mWebServer.getRequestCount(path) > initialRequestCoun t; 2392 return mWebServer.getRequestCount(path) > initialRequestCoun t;
2393 } 2393 }
2394 }); 2394 });
2395 return mWebServer.getRequestCount(path); 2395 return mWebServer.getRequestCount(path);
2396 } 2396 }
2397 } 2397 }
2398 2398
2399 @SmallTest 2399 @SmallTest
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
3014 final AwContents awContents = webView.getAwContents(); 3014 final AwContents awContents = webView.getAwContents();
3015 runTestOnUiThread(new Runnable() { 3015 runTestOnUiThread(new Runnable() {
3016 @Override 3016 @Override
3017 public void run() { 3017 public void run() {
3018 awContents.getContentViewCore().sendDoubleTapForTest( 3018 awContents.getContentViewCore().sendDoubleTapForTest(
3019 SystemClock.uptimeMillis(), x, y); 3019 SystemClock.uptimeMillis(), x, y);
3020 } 3020 }
3021 }); 3021 });
3022 } 3022 }
3023 } 3023 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698