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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java

Issue 240163005: Deliver IPC messages together with SwapCompositorFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable browsertest for android for realz this time Created 6 years, 5 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
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/android/synchronous_compositor_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java b/content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..6ef2bc43ec714612b829fcebd7de076af24b5f25
--- /dev/null
+++ b/content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java
@@ -0,0 +1,73 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.content.browser;
+
+import android.test.suitebuilder.annotation.SmallTest;
+
+import org.chromium.base.ThreadUtils;
+import org.chromium.base.test.util.Feature;
+import org.chromium.base.test.util.UrlUtils;
+import org.chromium.content.browser.test.util.CallbackHelper;
+import org.chromium.content_public.browser.WebContents;
+import org.chromium.content_shell_apk.ContentShellActivity;
+import org.chromium.content_shell_apk.ContentShellTestBase;
+
+import java.util.concurrent.Callable;
+
+/**
+ * Tests for the WebContentsObserverAndroid APIs.
+ */
+public class WebContentsObserverAndroidTest extends ContentShellTestBase {
+ private static final String URL = UrlUtils.encodeHtmlDataUri(
+ "<html><head></head><body>didFirstVisuallyNonEmptyPaint test</body></html>");
+
+ private static class TestWebContentsObserverAndroid extends WebContentsObserverAndroid {
+ private CallbackHelper mDidFirstVisuallyNonEmptyPaintCallbackHelper = new CallbackHelper();
+
+ public TestWebContentsObserverAndroid(WebContents webContents) {
+ super(webContents);
+ }
+
+ public CallbackHelper getDidFirstVisuallyNonEmptyPaintCallbackHelper() {
+ return mDidFirstVisuallyNonEmptyPaintCallbackHelper;
+ }
+
+ @Override
+ public void didFirstVisuallyNonEmptyPaint() {
+ mDidFirstVisuallyNonEmptyPaintCallbackHelper.notifyCalled();
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ ContentShellActivity activity = launchContentShellWithUrl(null);
+ assertNotNull(activity);
+ waitForActiveShellToBeDoneLoading();
+ }
+
+ @SmallTest
+ @Feature({"AndroidWebView", "Android-PostMessage"})
Yaron 2014/07/22 16:13:47 This doesn't really need to list AW, does it? It's
+ public void testDidFirstVisuallyNonEmptyPaint() throws Throwable {
+ TestWebContentsObserverAndroid observer = ThreadUtils.runOnUiThreadBlocking(
+ new Callable<TestWebContentsObserverAndroid>() {
+ @Override
+ public TestWebContentsObserverAndroid call() throws Exception {
+ return new TestWebContentsObserverAndroid(
+ getContentViewCore().getWebContents());
+ }
+ });
+
+ int callCount = observer.getDidFirstVisuallyNonEmptyPaintCallbackHelper().getCallCount();
+ getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ getActivity().getActiveShell().getContentViewCore().loadUrl(
Yaron 2014/07/22 16:13:47 nit: you could drop getActivity().getActiveShell()
+ new LoadUrlParams(URL));
+ }
+ });
+ observer.getDidFirstVisuallyNonEmptyPaintCallbackHelper().waitForCallback(callCount);
+ }
+}
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/android/synchronous_compositor_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698