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

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java

Issue 2741043004: Revert of Add Java wrapper for RenderFrameHost (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « content/public/android/java/src/org/chromium/content_public/browser/WebContents.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
15 import org.chromium.content_public.browser.WebContents; 14 import org.chromium.content_public.browser.WebContents;
16 import org.chromium.content_shell.Shell; 15 import org.chromium.content_shell.Shell;
17 import org.chromium.content_shell_apk.ContentShellActivity; 16 import org.chromium.content_shell_apk.ContentShellActivity;
18 import org.chromium.content_shell_apk.ContentShellTestBase; 17 import org.chromium.content_shell_apk.ContentShellTestBase;
19 18
20 import java.util.concurrent.Callable; 19 import java.util.concurrent.Callable;
21 import java.util.concurrent.ExecutionException; 20 import java.util.concurrent.ExecutionException;
22 21
23 /** 22 /**
24 * Test various Java WebContents specific features. 23 * Test various Java WebContents specific features.
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 assertNull("Unexpectedly deserialized a WebContents", deserializedWe bContents); 303 assertNull("Unexpectedly deserialized a WebContents", deserializedWe bContents);
305 304
306 // Make sure we can properly deserialize the String after the WebCon tents. 305 // Make sure we can properly deserialize the String after the WebCon tents.
307 assertEquals("Failing to read the WebContents corrupted the parcel", 306 assertEquals("Failing to read the WebContents corrupted the parcel",
308 PARCEL_STRING_TEST_DATA, parcel.readString()); 307 PARCEL_STRING_TEST_DATA, parcel.readString());
309 } finally { 308 } finally {
310 parcel.recycle(); 309 parcel.recycle();
311 } 310 }
312 } 311 }
313 312
314 /**
315 * Check that the main frame associated with the WebContents is not null
316 * and corresponds with the test URL.
317 *
318 * @throws InterruptedException
319 */
320 @SmallTest
321 public void testWebContentsMainFrame() throws InterruptedException {
322 final ContentShellActivity activity = launchContentShellWithUrl(TEST_URL _1);
323 waitForActiveShellToBeDoneLoading();
324 final WebContents webContents = activity.getActiveWebContents();
325
326 ThreadUtils.postOnUiThread(new Runnable() {
327 @Override
328 public void run() {
329 RenderFrameHost frameHost = webContents.getMainFrame();
330
331 assertNotNull(frameHost);
332
333 assertEquals("RenderFrameHost has incorrect last committed URL", "about:blank",
334 frameHost.getLastCommittedURL());
335
336 WebContents associatedWebContents = WebContentsImpl.fromRenderFr ameHost(frameHost);
337 assertEquals("RenderFrameHost associated with different WebConte nts", webContents,
338 associatedWebContents);
339 }
340 });
341 }
342
343 private boolean isWebContentsDestroyed(final WebContents webContents) { 313 private boolean isWebContentsDestroyed(final WebContents webContents) {
344 return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean >() { 314 return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean >() {
345 @Override 315 @Override
346 public Boolean call() throws Exception { 316 public Boolean call() throws Exception {
347 return webContents.isDestroyed(); 317 return webContents.isDestroyed();
348 } 318 }
349 }); 319 });
350 } 320 }
351 } 321 }
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content_public/browser/WebContents.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698