本文整理汇总了Java中org.robolectric.shadows.ShadowWebView.LoadDataWithBaseURL方法的典型用法代码示例。如果您正苦于以下问题:Java ShadowWebView.LoadDataWithBaseURL方法的具体用法?Java ShadowWebView.LoadDataWithBaseURL怎么用?Java ShadowWebView.LoadDataWithBaseURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robolectric.shadows.ShadowWebView
的用法示例。
在下文中一共展示了ShadowWebView.LoadDataWithBaseURL方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LoadReceipt
import org.robolectric.shadows.ShadowWebView; //导入方法依赖的package包/类
@Test
public void LoadReceipt()
{
Intent intent = new Intent();
final Bundle bundle = new Bundle();
bundle.putString("receipt", "receipt");
intent.putExtras(bundle);
ActivityController activityController = Robolectric.buildActivity(
ReceiptViewActivity.class).withIntent(intent).create();
activityController.start();
activityController.resume();
Activity activity = (Activity)activityController.get();
WebView receiptView = (WebView)activity.findViewById(R.id.imageView);
ShadowWebView.LoadDataWithBaseURL loadedData = shadowOf(receiptView).getLastLoadDataWithBaseURL();
assertEquals("", loadedData.baseUrl);
assertEquals("text/html", loadedData.mimeType);
assertEquals("utf-8", loadedData.encoding);
assertNull(loadedData.historyUrl);
assertTrue(loadedData.data.contains("src=\"file://receipt\""));
}
示例2: LoadReceipt
import org.robolectric.shadows.ShadowWebView; //导入方法依赖的package包/类
@Test
public void LoadReceipt()
{
activityController.start();
activityController.resume();
Activity activity = (Activity)activityController.get();
WebView receiptView = (WebView)activity.findViewById(R.id.imageView);
ShadowWebView.LoadDataWithBaseURL loadedData = shadowOf(receiptView).getLastLoadDataWithBaseURL();
assertEquals("", loadedData.baseUrl);
assertEquals("text/html", loadedData.mimeType);
assertEquals("utf-8", loadedData.encoding);
assertNull(loadedData.historyUrl);
assertTrue(loadedData.data.contains("src=\"file://receipt\""));
}
示例3: loadHtmlResponse_shouldCallLoadDataWithBaseURL
import org.robolectric.shadows.ShadowWebView; //导入方法依赖的package包/类
@Test
public void loadHtmlResponse_shouldCallLoadDataWithBaseURL() throws Exception {
String htmlResponse = "some random html response";
subject.loadHtmlResponse(htmlResponse);
ShadowWebView.LoadDataWithBaseURL lastLoadData = shadowOf(subject).getLastLoadDataWithBaseURL();
assertThat(lastLoadData.baseUrl).isEqualTo("http://ads.mopub.com/");
assertThat(lastLoadData.data).isEqualTo(htmlResponse);
assertThat(lastLoadData.mimeType).isEqualTo("text/html");
assertThat(lastLoadData.encoding).isEqualTo("utf-8");
assertThat(lastLoadData.historyUrl).isNull();
}
示例4: loadData_shouldCallLoadDataWithBaseURL
import org.robolectric.shadows.ShadowWebView; //导入方法依赖的package包/类
@Test
public void loadData_shouldCallLoadDataWithBaseURL() throws Exception {
String data = "some random html response";
subject.loadData(data);
ShadowWebView.LoadDataWithBaseURL lastLoadData
= shadowOf(subject).getLastLoadDataWithBaseURL();
assertThat(lastLoadData.baseUrl).isEqualTo("http://ads.mopub.com/");
assertThat(lastLoadData.data).isEqualTo(data);
assertThat(lastLoadData.mimeType).isEqualTo("text/html");
assertThat(lastLoadData.encoding).isEqualTo("utf-8");
assertThat(lastLoadData.historyUrl).isNull();
}