Commit 388af9a0 authored by bsheedy's avatar bsheedy Committed by Commit Bot

Clear VR feedback shared prefs before test start

Clears the two VR feedback shared preference values before a test starts
if they aren't currently the default. This is to prevent flakiness in
VrFeedbackInfoBarTest#* since shared preference settings are not
automatically reset between tests (which is expected).

Bug: 875977
Change-Id: Ic69cadd2ae43b1a3570ee9f349f2770fed812138
Reviewed-on: https://chromium-review.googlesource.com/1183816Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585073}
parent 7a7759f7
......@@ -12,6 +12,7 @@ import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.chromium.base.test.params.ParameterSet;
import org.chromium.chrome.browser.vr.VrFeedbackStatus;
import org.chromium.chrome.browser.vr.rules.ChromeTabbedActivityVrTestRule;
import org.chromium.chrome.browser.vr.rules.CustomTabActivityVrTestRule;
import org.chromium.chrome.browser.vr.rules.VrTestRule;
......@@ -56,6 +57,17 @@ public class VrTestRuleUtils extends XrTestRuleUtils {
// IllegalStateException for being used from a backgrounded app.
VrSettingsServiceUtils.checkForAndApplyVrSettingsFileAnnotation(desc, rule);
// Reset the VR feedback shared preferences if they're not currently the default because
// otherwise we can run into issues with VrFeedbackInfoBarTest#* erroneously failing due to
// tests being non-hermetic. Only set if not the default instead of unconditionally in order
// to avoid unnecessary disk writes.
if (VrFeedbackStatus.getFeedbackOptOut()) {
VrFeedbackStatus.setFeedbackOptOut(false);
}
if (VrFeedbackStatus.getUserExitedAndEntered2DCount() != 0) {
VrFeedbackStatus.setUserExitedAndEntered2DCount(0);
}
try {
base.evaluate();
} finally {
......
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