use of android.webkit.WebBackForwardList in project robolectric by robolectric.
the class ShadowWebViewTest method shouldReturnHistoryFromSaveState.
@Test
public void shouldReturnHistoryFromSaveState() {
shadowOf(webView).pushEntryToHistory("foo1.bar");
shadowOf(webView).pushEntryToHistory("foo2.bar");
Bundle outState = new Bundle();
WebBackForwardList historyList = webView.saveState(outState);
assertThat(historyList.getSize()).isEqualTo(2);
assertThat(historyList.getCurrentItem().getUrl()).isEqualTo("foo2.bar");
}
use of android.webkit.WebBackForwardList in project robolectric by robolectric.
the class ShadowWebViewTest method shouldCopyBackForwardListWhenEmpty.
@Test
public void shouldCopyBackForwardListWhenEmpty() {
WebBackForwardList historyList = webView.copyBackForwardList();
assertThat(historyList.getSize()).isEqualTo(0);
assertThat(historyList.getCurrentIndex()).isEqualTo(-1);
assertThat(historyList.getCurrentItem()).isNull();
}
use of android.webkit.WebBackForwardList in project robolectric by robolectric.
the class ShadowWebViewTest method shouldReturnNullFromRestoreStateIfNoHistoryAvailable.
@Test
public void shouldReturnNullFromRestoreStateIfNoHistoryAvailable() {
Bundle inState = new Bundle();
WebBackForwardList historyList = webView.restoreState(inState);
assertThat(historyList).isNull();
}
use of android.webkit.WebBackForwardList in project robolectric by robolectric.
the class ShadowWebViewTest method shouldSaveAndRestoreHistoryList.
@Test
public void shouldSaveAndRestoreHistoryList() {
shadowOf(webView).pushEntryToHistory("foo1.bar");
shadowOf(webView).pushEntryToHistory("foo2.bar");
Bundle outState = new Bundle();
webView.saveState(outState);
WebView newWebView = new WebView(ApplicationProvider.getApplicationContext());
WebBackForwardList historyList = newWebView.restoreState(outState);
assertThat(newWebView.canGoBack()).isTrue();
assertThat(newWebView.getUrl()).isEqualTo("foo2.bar");
assertThat(historyList.getSize()).isEqualTo(2);
assertThat(historyList.getCurrentItem().getUrl()).isEqualTo("foo2.bar");
}
use of android.webkit.WebBackForwardList in project robolectric by robolectric.
the class ShadowWebViewTest method shouldCopyBackForwardListWhenPopulated.
@Test
public void shouldCopyBackForwardListWhenPopulated() {
shadowOf(webView).pushEntryToHistory("foo1.bar");
shadowOf(webView).pushEntryToHistory("foo2.bar");
WebBackForwardList historyList = webView.copyBackForwardList();
assertThat(historyList.getSize()).isEqualTo(2);
assertThat(historyList.getCurrentItem().getUrl()).isEqualTo("foo2.bar");
}
Aggregations