import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;
-import static org.chromium.base.test.util.ScalableTimeout.ScaleTimeout;
+import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
import org.chromium.android_webview.AwBrowserContext;
import org.chromium.android_webview.AwBrowserProcess;
*/
public class AwTestBase
extends ActivityInstrumentationTestCase2<AwTestRunnerActivity> {
- protected static final long WAIT_TIMEOUT_MS = ScaleTimeout(15000);
+ protected static final long WAIT_TIMEOUT_MS = scaleTimeout(15000);
protected static final int CHECK_INTERVAL = 100;
private static final String TAG = "AwTestBase";
});
}
+ protected void loadDataWithBaseUrlSync(final AwContents awContents,
+ CallbackHelper onPageFinishedHelper, final String data, final String mimeType,
+ final boolean isBase64Encoded, final String baseUrl,
+ final String historyUrl) throws Throwable {
+ int currentCallCount = onPageFinishedHelper.getCallCount();
+ loadDataWithBaseUrlAsync(awContents, data, mimeType, isBase64Encoded, baseUrl, historyUrl);
+ onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_MS,
+ TimeUnit.MILLISECONDS);
+ }
+
+ protected void loadDataWithBaseUrlAsync(final AwContents awContents,
+ final String data, final String mimeType, final boolean isBase64Encoded,
+ final String baseUrl, final String historyUrl) throws Throwable {
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ awContents.loadUrl(LoadUrlParams.createLoadDataParamsWithBaseUrl(
+ data, mimeType, isBase64Encoded, baseUrl, historyUrl));
+ }
+ });
+ }
+
/**
* Reloads the current page synchronously.
*/
protected AwTestContainerView createAwTestContainerView(
final AwContentsClient awContentsClient) {
- return createAwTestContainerView(awContentsClient, true);
+ return createAwTestContainerView(awContentsClient, false);
}
protected AwTestContainerView createAwTestContainerView(
protected AwTestContainerView createDetachedAwTestContainerView(
final AwContentsClient awContentsClient) {
- return createDetachedAwTestContainerView(awContentsClient, true);
+ return createDetachedAwTestContainerView(awContentsClient, false);
}
protected AwTestContainerView createDetachedAwTestContainerView(
testDependencyFactory.createAwTestContainerView(getActivity());
AwSettings awSettings = testDependencyFactory.createAwSettings(getActivity(),
supportsLegacyQuirks);
- // TODO(mnaganov): Should also have tests for the "pure Chromium" mode.
- // See http://crbug.com/278106
testContainerView.initialize(new AwContents(
mBrowserContext, testContainerView, testContainerView.getInternalAccessDelegate(),
awContentsClient, awSettings, testDependencyFactory.createLayoutSizer()));
protected AwTestContainerView createAwTestContainerViewOnMainSync(
final AwContentsClient client) throws Exception {
- return createAwTestContainerViewOnMainSync(client, true);
+ return createAwTestContainerViewOnMainSync(client, false);
}
protected AwTestContainerView createAwTestContainerViewOnMainSync(