Commit 2e9bcdf6 authored by jdduke's avatar jdduke Committed by Commit bot

Fix ProGuard issues after recent NavigationController refactoring

Annotate several NavigationController methods used only in testing, and
remove a helper test function that is unused even in tests.

BUG=398263
NOTRY=true

Review URL: https://codereview.chromium.org/569343002

Cr-Commit-Position: refs/heads/master@{#294864}
parent 5cc0fb53
...@@ -8,6 +8,7 @@ import android.graphics.Bitmap; ...@@ -8,6 +8,7 @@ import android.graphics.Bitmap;
import org.chromium.base.CalledByNative; import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace; import org.chromium.base.JNINamespace;
import org.chromium.base.VisibleForTesting;
import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.NavigationController; import org.chromium.content_public.browser.NavigationController;
import org.chromium.content_public.browser.NavigationEntry; import org.chromium.content_public.browser.NavigationEntry;
...@@ -51,6 +52,7 @@ import org.chromium.content_public.browser.NavigationHistory; ...@@ -51,6 +52,7 @@ import org.chromium.content_public.browser.NavigationHistory;
} }
@Override @Override
@VisibleForTesting
public boolean canGoToOffset(int offset) { public boolean canGoToOffset(int offset) {
return mNativeNavigationControllerAndroid != 0 return mNativeNavigationControllerAndroid != 0
&& nativeCanGoToOffset(mNativeNavigationControllerAndroid, offset); && nativeCanGoToOffset(mNativeNavigationControllerAndroid, offset);
...@@ -146,6 +148,7 @@ import org.chromium.content_public.browser.NavigationHistory; ...@@ -146,6 +148,7 @@ import org.chromium.content_public.browser.NavigationHistory;
} }
@Override @Override
@VisibleForTesting
public void clearHistory() { public void clearHistory() {
if (mNativeNavigationControllerAndroid != 0) { if (mNativeNavigationControllerAndroid != 0) {
nativeClearHistory(mNativeNavigationControllerAndroid); nativeClearHistory(mNativeNavigationControllerAndroid);
......
...@@ -23,11 +23,11 @@ public class HistoryUtils { ...@@ -23,11 +23,11 @@ public class HistoryUtils {
protected static final long WAIT_TIMEOUT_SECONDS = scaleTimeout(15); protected static final long WAIT_TIMEOUT_SECONDS = scaleTimeout(15);
/** /**
* Calls {@link ContentViewCore#canGoBack()} on UI thread. * Calls {@link NavigationController#canGoBack()} on UI thread.
* *
* @param instrumentation an Instrumentation instance. * @param instrumentation an Instrumentation instance.
* @param contentViewCore a ContentViewCore instance. * @param contentViewCore a ContentViewCore instance.
* @return result of {@link ContentViewCore#canGoBack()} * @return result of {@link NavigationController#canGoBack()}
* @throws Throwable * @throws Throwable
*/ */
public static boolean canGoBackOnUiThread(Instrumentation instrumentation, public static boolean canGoBackOnUiThread(Instrumentation instrumentation,
...@@ -42,13 +42,13 @@ public class HistoryUtils { ...@@ -42,13 +42,13 @@ public class HistoryUtils {
} }
/** /**
* Calls {@link ContentViewCore#canGoToOffset(int)} on UI thread. * Calls {@link NavigationController#canGoToOffset(int)} on UI thread.
* *
* @param instrumentation an Instrumentation instance. * @param instrumentation an Instrumentation instance.
* @param contentViewCore a ContentViewCore instance. * @param contentViewCore a ContentViewCore instance.
* @param offset The number of steps to go on the UI thread, with negative * @param offset The number of steps to go on the UI thread, with negative
* representing going back. * representing going back.
* @return result of {@link ContentViewCore#canGoToOffset(int)} * @return result of {@link NavigationController#canGoToOffset(int)}
* @throws Throwable * @throws Throwable
*/ */
public static boolean canGoToOffsetOnUiThread(Instrumentation instrumentation, public static boolean canGoToOffsetOnUiThread(Instrumentation instrumentation,
...@@ -63,11 +63,11 @@ public class HistoryUtils { ...@@ -63,11 +63,11 @@ public class HistoryUtils {
} }
/** /**
* Calls {@link ContentViewCore#canGoForward()} on UI thread. * Calls {@link NavigationController#canGoForward()} on UI thread.
* *
* @param instrumentation an Instrumentation instance. * @param instrumentation an Instrumentation instance.
* @param contentViewCore a ContentViewCore instance. * @param contentViewCore a ContentViewCore instance.
* @return result of {@link ContentViewCore#canGoForward()} * @return result of {@link NavigationController#canGoForward()}
* @throws Throwable * @throws Throwable
*/ */
public static boolean canGoForwardOnUiThread(Instrumentation instrumentation, public static boolean canGoForwardOnUiThread(Instrumentation instrumentation,
...@@ -82,7 +82,7 @@ public class HistoryUtils { ...@@ -82,7 +82,7 @@ public class HistoryUtils {
} }
/** /**
* Calls {@link ContentViewCore#clearHistory()} on UI thread. * Calls {@link NavigationController#clearHistory()} on UI thread.
* *
* @param instrumentation an Instrumentation instance. * @param instrumentation an Instrumentation instance.
* @param contentViewCore a ContentViewCore instance. * @param contentViewCore a ContentViewCore instance.
...@@ -99,7 +99,7 @@ public class HistoryUtils { ...@@ -99,7 +99,7 @@ public class HistoryUtils {
} }
/** /**
* Calls {@link ContentViewCore#getUrl()} on UI Thread to get the current URL. * Calls {@link NavigationController#getUrl()} on UI Thread to get the current URL.
* *
* @param instrumentation an Instrumentation instance. * @param instrumentation an Instrumentation instance.
* @param contentViewCore a ContentViewCore instance. * @param contentViewCore a ContentViewCore instance.
...@@ -117,32 +117,6 @@ public class HistoryUtils { ...@@ -117,32 +117,6 @@ public class HistoryUtils {
}); });
} }
/**
* Performs navigation in the history on UI thread and waits until
* onPageFinished is called.
*
* @param instrumentation an Instrumentation instance.
* @param contentViewCore a ContentViewCore instance.
* @param onPageFinishedHelper the CallbackHelper instance associated with the onPageFinished
* callback of contentViewCore.
* @param offset
* @throws Throwable
*/
public static void goToOffsetSync(Instrumentation instrumentation,
final WebContents webContents, CallbackHelper onPageFinishedHelper,
final int offset) throws Throwable {
int currentCallCount = onPageFinishedHelper.getCallCount();
instrumentation.runOnMainSync(new Runnable() {
@Override
public void run() {
webContents.getNavigationController().goToOffset(offset);
}
});
// Wait for onPageFinished event or timeout after 30s
onPageFinishedHelper.waitForCallback(currentCallCount, 1, 30, TimeUnit.SECONDS);
}
/** /**
* Goes back on UI thread and waits until onPageFinished is called or until * Goes back on UI thread and waits until onPageFinished is called or until
* it times out. * it times out.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment