import org.chromium.base.test.util.UrlUtils;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
+import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_shell_apk.ContentShellActivity;
import org.chromium.content_shell_apk.ContentShellTestBase;
+/**
+ * Provides test environment for ContentView Test Shell.
+ * This is a helper class for Content Shell tests.
+*/
public class ContentViewTestBase extends ContentShellTestBase {
protected TestCallbackHelperContainer mTestCallbackHelperContainer;
runTestOnUiThread(new Runnable() {
@Override
public void run() {
- ContentView contentView = activity.getActiveContentView();
- contentView.getContentViewCore().addPossiblyUnsafeJavascriptInterface(object,
- name, null);
- mTestCallbackHelperContainer =
- new TestCallbackHelperContainer(contentView);
+ ContentViewCore viewCore = activity.getActiveContentViewCore();
+ viewCore.addPossiblyUnsafeJavascriptInterface(object, name, null);
+ mTestCallbackHelperContainer = new TestCallbackHelperContainer(viewCore);
}
});
- loadDataSync(activity.getActiveContentView(),
+ loadDataSync(activity.getActiveContentViewCore(),
"<!DOCTYPE html><title></title>", "text/html", false);
} catch (Throwable e) {
throw new RuntimeException(
* Loads data on the UI thread and blocks until onPageFinished is called.
* TODO(cramya): Move method to a separate util file once UiUtils.java moves into base.
*/
- protected void loadDataSync(final ContentView contentView, final String data,
+ protected void loadDataSync(final ContentViewCore contentViewCore, final String data,
final String mimeType, final boolean isBase64Encoded) throws Throwable {
- loadUrl(contentView, mTestCallbackHelperContainer, LoadUrlParams.createLoadDataParams(
+ loadUrl(contentViewCore, mTestCallbackHelperContainer, LoadUrlParams.createLoadDataParams(
data, mimeType, isBase64Encoded));
}
}