| Index: content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java
|
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java b/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java
|
| index fa52a8a74a4d752255c60147f1a1ff1c8a3dbc14..e3b1e348636e28ab90a5c19b3db99829a8b6118d 100644
|
| --- a/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java
|
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java
|
| @@ -11,6 +11,7 @@ import android.os.Parcel;
|
| import android.support.test.filters.SmallTest;
|
|
|
| import org.chromium.base.ThreadUtils;
|
| +import org.chromium.content_public.browser.RenderFrameHost;
|
| import org.chromium.content_public.browser.WebContents;
|
| import org.chromium.content_shell.Shell;
|
| import org.chromium.content_shell_apk.ContentShellActivity;
|
| @@ -310,6 +311,36 @@ public class WebContentsTest extends ContentShellTestBase {
|
| }
|
| }
|
|
|
| + /**
|
| + * Check that the main frame associated with the WebContents is not null
|
| + * and corresponds with the test URL.
|
| + *
|
| + * @throws InterruptedException
|
| + */
|
| + @SmallTest
|
| + public void testWebContentsMainFrame() throws InterruptedException {
|
| + final ContentShellActivity activity = launchContentShellWithUrl(TEST_URL_1);
|
| + waitForActiveShellToBeDoneLoading();
|
| + final WebContents webContents = activity.getActiveWebContents();
|
| +
|
| + ThreadUtils.postOnUiThread(new Runnable() {
|
| + @Override
|
| + public void run() {
|
| + RenderFrameHost frameHost = webContents.getMainFrame();
|
| +
|
| + assertNotNull(frameHost);
|
| +
|
| + // FIXME: make this work with PlzNavigate.
|
| + // assertEquals("RenderFrameHost has incorrect last committed URL", "about:blank",
|
| + // frameHost.getLastCommittedURL());
|
| +
|
| + WebContents associatedWebContents = WebContentsImpl.fromRenderFrameHost(frameHost);
|
| + assertEquals("RenderFrameHost associated with different WebContents", webContents,
|
| + associatedWebContents);
|
| + }
|
| + });
|
| + }
|
| +
|
| private boolean isWebContentsDestroyed(final WebContents webContents) {
|
| return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() {
|
| @Override
|
|
|