Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4406)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/EmulatedVrController.java

Issue 2826273002: Add automated VR controller emulator (Closed)
Patch Set: New library version + proguard config Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
+}
« no previous file with comments | « chrome/android/BUILD.gn ('k') | chrome/android/javatests/src/org/chromium/chrome/browser/vr_shell/WebVrTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698