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

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/WebViewMixedFindApisTest.java

Issue 10941015: [Android] Upstream the WebView find-in-page API implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit fixes. Created 8 years, 3 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
Index: android_webview/javatests/src/org/chromium/android_webview/test/WebViewMixedFindApisTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/WebViewMixedFindApisTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/WebViewMixedFindApisTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..b91523f787a1933fb6d9b2fea501e3638e00008b
--- /dev/null
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/WebViewMixedFindApisTest.java
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 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.android_webview.test;
+
+import android.test.suitebuilder.annotation.SmallTest;
+
+import org.chromium.base.test.Feature;
+
+/**
+ * Tests the mixed use of synchronous and asynchronous find-in-page APIs in WebView.
+ * Helps to spot race conditions or potential deadlocks caused by the renderer receiving
+ * asynchronous messages while synchronous requests are being processed.
+ */
+public class WebViewMixedFindApisTest extends WebViewFindApisTestBase {
+
+ @SmallTest
+ @Feature({"Android-WebView", "FindInPage"})
+ public void testAsyncFindOperationsMixedWithSyncFind() throws Throwable {
+ clearMatchesOnUiThread();
+ assertEquals(4, findAllSyncOnUiThread("wood"));
+ assertEquals(4, findAllSyncOnUiThread("wood"));
+ clearMatchesOnUiThread();
+ assertEquals(4, findAllAsyncOnUiThread("wood"));
+ assertEquals(3, findNextOnUiThread(true));
+ clearMatchesOnUiThread();
+ assertEquals(4, findAllSyncOnUiThread("wood"));
+ }
+
+ @SmallTest
+ @Feature({"Android-WebView", "FindInPage"})
+ public void testInterleavedFinds() throws Throwable {
+ assertEquals(4, findAllSyncOnUiThread("wood"));
+ assertEquals(4, findAllAsyncOnUiThread("wood"));
+ assertEquals(4, findAllSyncOnUiThread("wood"));
+ assertEquals(3, findNextOnUiThread(true));
+ assertEquals(4, findAllAsyncOnUiThread("wood"));
+ assertEquals(1, findNextOnUiThread(true));
+ assertEquals(4, findAllSyncOnUiThread("wood"));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698