am 56d5dc0c: Merge "Fix android.webkit.cts.WebViewTest#testFindNext seldom fail"
* commit '56d5dc0c134c031b8d9898abf6ae5fb537fa2b49':
Fix android.webkit.cts.WebViewTest#testFindNext seldom fail
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
old mode 100644
new mode 100755
index d339a62..71c2f36
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
@@ -1112,10 +1112,14 @@
"Find all instances of a word on the page and highlight them.</p>";
mOnUiThread.loadDataAndWaitForCompletion("<html><body>" + p + p + "</body></html>", "text/html", null);
+ WaitForFindResultsListener l = new WaitForFindResultsListener();
+ mOnUiThread.setFindListener(l);
// highlight all the strings found
mOnUiThread.findAll("all");
- getInstrumentation().waitForIdleSync();
+ // make sure the findAll action is completed before findNext
+ l.get();
+ mOnUiThread.setFindListener(null);
int previousScrollY = mOnUiThread.getScrollY();