Commit d718df0c authored by bsheedy's avatar bsheedy Committed by Commit Bot

Add VR workaround for 819021

Changes the pixel-checking portion of testRequestPresentEntersVr and
testRequestSessionEntersVr to pass if either pure blue or (0, 0, 127) is
detected. This is a workaround for https://crbug.com/819021, where the
immersive mode popup can cause the screen to be darkened and turn pure
blue into (0, 0, 127).

Bug: 819021
Change-Id: Id0254358e7c25073d0b7800cecad8ef11f315c58
Reviewed-on: https://chromium-review.googlesource.com/950321Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541143}
parent bdec7042
...@@ -129,17 +129,21 @@ public class WebVrTransitionTest { ...@@ -129,17 +129,21 @@ public class WebVrTransitionTest {
CriteriaHelper.pollInstrumentationThread(new Criteria() { CriteriaHelper.pollInstrumentationThread(new Criteria() {
@Override @Override
public boolean isSatisfied() { public boolean isSatisfied() {
Bitmap bmpCurrentScreen = InstrumentationRegistry.getInstrumentation() Bitmap screenshot = InstrumentationRegistry.getInstrumentation()
.getUiAutomation() .getUiAutomation()
.takeScreenshot(); .takeScreenshot();
if (bmpCurrentScreen != null) { if (screenshot != null) {
// Calculate center of eye coordinates. // Calculate center of eye coordinates.
int iheight = uiDevice.getDisplayHeight() / 2; int height = uiDevice.getDisplayHeight() / 2;
int iwidth = uiDevice.getDisplayWidth() / 4; int width = uiDevice.getDisplayWidth() / 4;
// Verify screen is blue. // Verify screen is blue.
return Color.BLUE == bmpCurrentScreen.getPixel(iwidth, iheight); int pixel = screenshot.getPixel(width, height);
// Workaround for the immersive mode popup sometimes being rendered over the
// screen on K, which causes the pure blue to be darkened to (0, 0, 127).
// TODO(https://crbug.com/819021): Only check pure blue.
return pixel == Color.BLUE || pixel == Color.rgb(0, 0, 127);
} }
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment