Commit 5763c978 authored by Aldo Culquicondor's avatar Aldo Culquicondor Committed by Commit Bot

Make tests force the use of the mocked controller

The recently added mocked controller delegate eliminated the need of a
deadzone to get quiescence in the scene. However, some tests where not
using it, and thus fail.

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:linux_vr;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I7826885ab9a2900421b7bb2dbd49c1fbe5de4e33
Reviewed-on: https://chromium-review.googlesource.com/1161042
Commit-Queue: Aldo Culquicondor <acondor@chromium.org>
Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Reviewed-by: default avatarBrian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580539}
parent ce3c0f53
......@@ -381,6 +381,9 @@ public class VrBrowserTransitionTest {
mockApi.setExitFromVrReturnValue(false);
VrShellDelegateUtils.getDelegateInstance().overrideDaydreamApiForTesting(mockApi);
// Enable the mock controller even though we don't use it, because the real controller will
// never allow the scene to reach quiescense.
NativeUiUtils.enableMockedController();
NativeUiUtils.performActionAndWaitForUiQuiescence(() -> {
ThreadUtils.runOnUiThreadBlocking(() -> {
Intent preferencesIntent = PreferencesLauncher.createIntentForSettingsPage(
......@@ -479,6 +482,9 @@ public class VrBrowserTransitionTest {
VrBrowserTransitionUtils.forceEnterVrBrowserOrFail(POLL_TIMEOUT_LONG_MS);
final IncognitoNewTabPage ntp =
(IncognitoNewTabPage) mTestRule.getActivity().getActivityTab().getNativePage();
// Enable the mock controller even though we don't use it, because the real controller will
// never allow the scene to reach quiescense.
NativeUiUtils.enableMockedController();
NativeUiUtils.performActionAndWaitForUiQuiescence(() -> {
ThreadUtils.runOnUiThreadBlocking(
() -> { ntp.getView().findViewById(R.id.learn_more).performClick(); });
......
......@@ -31,6 +31,12 @@ public class NativeUiUtils {
// with an element.
private static final int DEFAULT_UI_QUIESCENCE_TIMEOUT_MS = 1000;
public static void enableMockedController() {
TestVrShellDelegate.getInstance().performControllerActionForTesting(
0 /* elementName, unused */, VrControllerTestAction.ENABLE_MOCKED_CONTROLLER,
new PointF() /* position, unused */);
}
/**
* Clicks on a UI element as if done via a controller.
*
......
......@@ -2267,8 +2267,11 @@ void VrShellGl::PerformControllerActionForTesting(
std::make_unique<ControllerDelegateForTesting>(ui_.get());
controller_delegate_for_testing_.swap(controller_delegate_);
}
static_cast<ControllerDelegateForTesting*>(controller_delegate_.get())
->QueueControllerActionForTesting(controller_input);
if (controller_input.action !=
VrControllerTestAction::kEnableMockedController) {
static_cast<ControllerDelegateForTesting*>(controller_delegate_.get())
->QueueControllerActionForTesting(controller_input);
}
}
void VrShellGl::ReportUiStatusForTesting(const base::TimeTicks& current_time,
......
......@@ -44,6 +44,7 @@ enum class VrUiTestActivityResult : int {
enum class VrControllerTestAction : int {
kClick,
kHover,
kEnableMockedController,
kRevertToRealController,
kClickDown,
kClickUp,
......
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