| Index: chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/EmulatedVrController.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/EmulatedVrController.java b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/EmulatedVrController.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..304169a7a521e795ce2f30f2a54fe82cbb51ed07
|
| --- /dev/null
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/EmulatedVrController.java
|
| @@ -0,0 +1,40 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package org.chromium.chrome.browser.vr_shell;
|
| +
|
| +import android.content.Context;
|
| +
|
| +import com.google.vr.testframework.controller.ControllerTestApi;
|
| +
|
| +/**
|
| + * Wrapper for the ControllerTestApi class to handle more complex actions such
|
| + * as clicking and dragging.
|
| + *
|
| + * Requires that VrCore's settings file is modified to use the test API:
|
| + * - UseAutomatedController: true
|
| + * - PairedControllerDriver: "DRIVER_AUTOMATED"
|
| + * - PairedControllerAddress: "FOO"
|
| + */
|
| +public class EmulatedVrController {
|
| + private final ControllerTestApi mApi;
|
| +
|
| + public EmulatedVrController(Context context) {
|
| + mApi = new ControllerTestApi(context);
|
| + }
|
| +
|
| + public ControllerTestApi getApi() {
|
| + return mApi;
|
| + }
|
| +
|
| + /**
|
| + * Presses and quickly releases the Daydream controller's touchpad button.
|
| + * Or, if the button is already pressed, releases and quickly presses again.
|
| + */
|
| + public void pressReleaseTouchpadButton() {
|
| + mApi.buttonEvent.sendClickButtonEvent();
|
| + }
|
| +
|
| + // TODO(bsheedy): Add support for more complex actions, e.g. click/drag/release
|
| +}
|
|
|