| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content.browser.webcontents; | 5 package org.chromium.content.browser.webcontents; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.Intent; | 8 import android.content.Intent; |
| 9 import android.os.Bundle; | 9 import android.os.Bundle; |
| 10 import android.os.Parcel; | 10 import android.os.Parcel; |
| 11 import android.support.test.filters.SmallTest; | 11 import android.support.test.filters.SmallTest; |
| 12 | 12 |
| 13 import org.chromium.base.ThreadUtils; | 13 import org.chromium.base.ThreadUtils; |
| 14 import org.chromium.content_public.browser.RenderFrameHost; | 14 import org.chromium.content_public.browser.RenderFrameHost; |
| 15 import org.chromium.content_public.browser.WebContents; | 15 import org.chromium.content_public.browser.WebContents; |
| 16 import org.chromium.content_public.browser.WebContentsStatics; |
| 16 import org.chromium.content_shell.Shell; | 17 import org.chromium.content_shell.Shell; |
| 17 import org.chromium.content_shell_apk.ContentShellActivity; | 18 import org.chromium.content_shell_apk.ContentShellActivity; |
| 18 import org.chromium.content_shell_apk.ContentShellTestBase; | 19 import org.chromium.content_shell_apk.ContentShellTestBase; |
| 19 | 20 |
| 20 import java.util.concurrent.Callable; | 21 import java.util.concurrent.Callable; |
| 21 import java.util.concurrent.ExecutionException; | 22 import java.util.concurrent.ExecutionException; |
| 22 | 23 |
| 23 /** | 24 /** |
| 24 * Test various Java WebContents specific features. | 25 * Test various Java WebContents specific features. |
| 25 * TODO(dtrainor): Add more testing for the WebContents methods. | 26 * TODO(dtrainor): Add more testing for the WebContents methods. |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 ThreadUtils.postOnUiThread(new Runnable() { | 327 ThreadUtils.postOnUiThread(new Runnable() { |
| 327 @Override | 328 @Override |
| 328 public void run() { | 329 public void run() { |
| 329 RenderFrameHost frameHost = webContents.getMainFrame(); | 330 RenderFrameHost frameHost = webContents.getMainFrame(); |
| 330 | 331 |
| 331 assertNotNull(frameHost); | 332 assertNotNull(frameHost); |
| 332 | 333 |
| 333 assertEquals("RenderFrameHost has incorrect last committed URL",
"about:blank", | 334 assertEquals("RenderFrameHost has incorrect last committed URL",
"about:blank", |
| 334 frameHost.getLastCommittedURL()); | 335 frameHost.getLastCommittedURL()); |
| 335 | 336 |
| 336 WebContents associatedWebContents = WebContentsImpl.fromRenderFr
ameHost(frameHost); | 337 WebContents associatedWebContents = |
| 338 WebContentsStatics.fromRenderFrameHost(frameHost); |
| 337 assertEquals("RenderFrameHost associated with different WebConte
nts", webContents, | 339 assertEquals("RenderFrameHost associated with different WebConte
nts", webContents, |
| 338 associatedWebContents); | 340 associatedWebContents); |
| 339 } | 341 } |
| 340 }); | 342 }); |
| 341 } | 343 } |
| 342 | 344 |
| 343 private boolean isWebContentsDestroyed(final WebContents webContents) { | 345 private boolean isWebContentsDestroyed(final WebContents webContents) { |
| 344 return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean
>() { | 346 return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean
>() { |
| 345 @Override | 347 @Override |
| 346 public Boolean call() throws Exception { | 348 public Boolean call() throws Exception { |
| 347 return webContents.isDestroyed(); | 349 return webContents.isDestroyed(); |
| 348 } | 350 } |
| 349 }); | 351 }); |
| 350 } | 352 } |
| 351 } | 353 } |
| OLD | NEW |