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

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

Issue 1797083002: aw: Fix instrumentation threading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnScaleChangedTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java
index b85960568f41f979cd125871537b458a7c979104..ba6e85af367dd914faade1720995e76c8d982dd8 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java
@@ -431,9 +431,9 @@ public class AwContentsClientFullScreenTest extends AwTestBase {
@Override
public boolean isSatisfied() {
try {
- return getKeepScreenOn(view) == expected
+ return getKeepScreenOnOnInstrumentationThread(view) == expected
&& DOMUtils.isMediaPaused(getWebContentsOnUiThread(), VIDEO_ID)
- != expected;
+ != expected;
} catch (InterruptedException | TimeoutException e) {
fail(e.getMessage());
return false;
@@ -444,17 +444,31 @@ public class AwContentsClientFullScreenTest extends AwTestBase {
private void assertKeepScreenOnActive(final View view, final boolean expected)
throws Exception {
- assertTrue(getKeepScreenOn(view) == expected
+ assertTrue(getKeepScreenOnOnInstrumentationThread(view) == expected
&& DOMUtils.isMediaPaused(getWebContentsOnUiThread(), VIDEO_ID) != expected);
}
- private boolean getKeepScreenOn(View view) {
+ private boolean getKeepScreenOnOnInstrumentationThread(final View view) {
+ try {
+ return runTestOnUiThreadAndGetResult(new Callable<Boolean>() {
+ @Override
+ public Boolean call() {
+ return getKeepScreenOnOnUiThread(view);
+ }
+ });
+ } catch (Exception e) {
+ fail(e.getMessage());
+ return false;
+ }
+ }
+
+ private boolean getKeepScreenOnOnUiThread(View view) {
// The power save blocker is added to a child anchor view,
// so we need to traverse the hierarchy.
if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
for (int i = 0; i < viewGroup.getChildCount(); i++) {
- if (getKeepScreenOn(viewGroup.getChildAt(i))) {
+ if (getKeepScreenOnOnUiThread(viewGroup.getChildAt(i))) {
return true;
}
}
« no previous file with comments | « no previous file | android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientOnScaleChangedTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698