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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java

Issue 666673009: Removing NavigationClient dependencies from Tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the review comments. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java
index 96f6256b7d57857aa6e6452fab745041a66781b5..9c7d855891b3e5e16146d7abd680ca9b15e14373 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java
@@ -13,9 +13,10 @@ import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils;
import org.chromium.chrome.shell.ChromeShellActivity;
import org.chromium.chrome.shell.ChromeShellTestBase;
-import org.chromium.content.browser.NavigationClient;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
+import org.chromium.content_public.browser.LoadUrlParams;
+import org.chromium.content_public.browser.NavigationController;
import org.chromium.content_public.browser.NavigationEntry;
import org.chromium.content_public.browser.NavigationHistory;
@@ -54,11 +55,11 @@ public class NavigationPopupTest extends ChromeShellTestBase {
}
}
- private static class TestNavigationClient implements NavigationClient {
+ private static class TestNavigationController implements NavigationController {
private TestNavigationHistory mHistory;
private int mNavigatedIndex = INVALID_NAVIGATION_INDEX;
- public TestNavigationClient() {
+ public TestNavigationController() {
mHistory = new TestNavigationHistory();
mHistory.addEntry(new TestNavigationEntry(
1, "about:blank", null, null, "About Blank", null));
@@ -67,6 +68,93 @@ public class NavigationPopupTest extends ChromeShellTestBase {
}
@Override
+ public boolean canGoBack() {
+ return false;
+ }
+
+ @Override
+ public boolean canGoForward() {
+ return false;
+ }
+
+ @Override
+ public boolean canGoToOffset(int offset) {
+ return false;
+ }
+
+ @Override
+ public void goToOffset(int offset) {
+ }
+
+ @Override
+ public void goBack() {
+ }
+
+ @Override
+ public void goForward() {
+ }
+
+ @Override
+ public void loadIfNecessary() {
+ }
+
+ @Override
+ public void requestRestoreLoad() {
+ }
+
+ @Override
+ public void reload(boolean checkForRepost) {
+ }
+
+ @Override
+ public void reloadIgnoringCache(boolean checkForRepost) {
+ }
+
+ @Override
+ public void cancelPendingReload() {
+ }
+
+ @Override
+ public void continuePendingReload() {
+ }
+
+ @Override
+ public void loadUrl(LoadUrlParams params) {
+ }
+
+ @Override
+ public void clearHistory() {
+ }
+
+ @Override
+ public NavigationHistory getNavigationHistory() {
+ return null;
+ }
+
+ @Override
+ public String getOriginalUrlForVisibleNavigationEntry() {
+ return null;
+ }
+
+ @Override
+ public void clearSslPreferences() {
+ }
+
+ @Override
+ public boolean getUseDesktopUserAgent() {
+ return false;
+ }
+
+ @Override
+ public void setUseDesktopUserAgent(boolean override, boolean reloadOnChange) {
+ }
+
+ @Override
+ public NavigationEntry getPendingEntry() {
+ return null;
+ }
+
+ @Override
public NavigationHistory getDirectedNavigationHistory(boolean isForward, int itemLimit) {
return mHistory;
}
@@ -80,9 +168,9 @@ public class NavigationPopupTest extends ChromeShellTestBase {
@MediumTest
@Feature({"Navigation"})
public void testFaviconFetching() throws InterruptedException {
- final TestNavigationClient client = new TestNavigationClient();
+ final TestNavigationController controller = new TestNavigationController();
final NavigationPopup popup = new NavigationPopup(
- mActivity, client, true);
+ mActivity, controller, true);
popup.setWidth(300);
popup.setAnchorView(mActivity.getActiveContentViewCore().getContainerView());
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@@ -100,7 +188,7 @@ public class NavigationPopupTest extends ChromeShellTestBase {
return ThreadUtils.runOnUiThreadBlocking(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
- NavigationHistory history = client.mHistory;
+ NavigationHistory history = controller.mHistory;
for (int i = 0; i < history.getEntryCount(); i++) {
if (history.getEntryAtIndex(i).getFavicon() == null) {
return false;
@@ -126,9 +214,9 @@ public class NavigationPopupTest extends ChromeShellTestBase {
@SmallTest
@Feature({"Navigation"})
public void testItemSelection() {
- final TestNavigationClient client = new TestNavigationClient();
+ final TestNavigationController controller = new TestNavigationController();
final NavigationPopup popup = new NavigationPopup(
- mActivity, client, true);
+ mActivity, controller, true);
popup.setWidth(300);
popup.setAnchorView(mActivity.getActiveContentViewCore().getContainerView());
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@@ -146,7 +234,8 @@ public class NavigationPopupTest extends ChromeShellTestBase {
});
assertFalse("Popup did not hide as expected.", popup.isShowing());
- assertEquals("Popup attempted to navigate to the wrong index", 5, client.mNavigatedIndex);
+ assertEquals("Popup attempted to navigate to the wrong index", 5,
+ controller.mNavigatedIndex);
}
}

Powered by Google App Engine
This is Rietveld 408576698