Commit 24b51059 authored by bsheedy's avatar bsheedy Committed by Commit Bot

Add null check to VR ensureNoVrActivitiesDisplayed

It turns out that UiDevice.getCurrentPackageName can return null, so
handle that case to avoid NullPointerExceptions.

TBR=mthiesse@chromium.org

Change-Id: I8cb220d5df1d0f110b2bded7473f20ba7d859872
Reviewed-on: https://chromium-review.googlesource.com/1099838Reviewed-by: default avatarBrian Sheedy <bsheedy@chromium.org>
Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567010}
parent e45d5c78
......@@ -105,7 +105,8 @@ public class VrTestRuleUtils {
*/
public static void ensureNoVrActivitiesDisplayed() {
UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
if (uiDevice.getCurrentPackageName().contains("vr")) {
String currentPackageName = uiDevice.getCurrentPackageName();
if (currentPackageName != null && currentPackageName.contains("vr")) {
uiDevice.pressHome();
// Chrome startup would likely be slow enough that this sleep is unnecessary, but sleep
// to be sure since this will be hit relatively infrequently.
......
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