| Index: device/gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java
|
| diff --git a/device/gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java b/device/gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java
|
| index 728540f6f49127f8aca40a0ac2f379077374035b..6ed294195d0feb9461b979fff2aa3c217437ad8e 100644
|
| --- a/device/gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java
|
| +++ b/device/gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java
|
| @@ -146,95 +146,6 @@ public class GamepadMappingsTest {
|
|
|
| @Test
|
| @Feature({"Gamepad"})
|
| - public void testXboxWirelessGamepadTriggerIdle() throws Exception {
|
| - GamepadMappings mappings = GamepadMappings.getMappings(
|
| - GamepadMappings.MICROSOFT_XBOX_WIRELESS_DEVICE_NAME, null);
|
| -
|
| - // Both triggers are inactive, because they haven't seen input yet.
|
| - mRawAxes[MotionEvent.AXIS_Z] = 0.f;
|
| - mRawAxes[MotionEvent.AXIS_RZ] = 0.f;
|
| - mappings.mapToStandardGamepad(mMappedAxes, mMappedButtons, mRawAxes, mRawButtons);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.LEFT_TRIGGER],
|
| - 0.f, ERROR_TOLERANCE);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.RIGHT_TRIGGER],
|
| - 0.f, ERROR_TOLERANCE);
|
| -
|
| - // This "activates" the left trigger, so it will begin reporting input.
|
| - // It will still be 0 because the triggers idle at -1.
|
| - mRawAxes[MotionEvent.AXIS_Z] = -1.f;
|
| - mappings.mapToStandardGamepad(mMappedAxes, mMappedButtons, mRawAxes, mRawButtons);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.LEFT_TRIGGER],
|
| - 0.f, ERROR_TOLERANCE);
|
| -
|
| - // Since the left trigger is active, 0 should be reported as 0.5.
|
| - mRawAxes[MotionEvent.AXIS_Z] = 0.f;
|
| - mappings.mapToStandardGamepad(mMappedAxes, mMappedButtons, mRawAxes, mRawButtons);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.LEFT_TRIGGER],
|
| - 0.5f, ERROR_TOLERANCE);
|
| -
|
| - // The right trigger should still read 0 because it's not active yet.
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.RIGHT_TRIGGER],
|
| - 0.f, ERROR_TOLERANCE);
|
| -
|
| - // Activate the right trigger
|
| - mRawAxes[MotionEvent.AXIS_RZ] = -1.f;
|
| - mappings.mapToStandardGamepad(mMappedAxes, mMappedButtons, mRawAxes, mRawButtons);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.RIGHT_TRIGGER],
|
| - 0.f, ERROR_TOLERANCE);
|
| -
|
| - // Now the right trigger should also report 0 as 0.5.
|
| - mRawAxes[MotionEvent.AXIS_RZ] = 0.f;
|
| - mappings.mapToStandardGamepad(mMappedAxes, mMappedButtons, mRawAxes, mRawButtons);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.RIGHT_TRIGGER],
|
| - 0.5f, ERROR_TOLERANCE);
|
| - }
|
| -
|
| - @Test
|
| - @Feature({"Gamepad"})
|
| - public void testXboxWirelessGamepadMappings() throws Exception {
|
| - GamepadMappings mappings = GamepadMappings.getMappings(
|
| - GamepadMappings.MICROSOFT_XBOX_WIRELESS_DEVICE_NAME, null);
|
| - mappings.mapToStandardGamepad(mMappedAxes, mMappedButtons, mRawAxes, mRawButtons);
|
| -
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.PRIMARY],
|
| - mRawButtons[KeyEvent.KEYCODE_BUTTON_A], ERROR_TOLERANCE);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.SECONDARY],
|
| - mRawButtons[KeyEvent.KEYCODE_BUTTON_B], ERROR_TOLERANCE);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.TERTIARY],
|
| - mRawButtons[KeyEvent.KEYCODE_BUTTON_C], ERROR_TOLERANCE);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.QUATERNARY],
|
| - mRawButtons[KeyEvent.KEYCODE_BUTTON_X], ERROR_TOLERANCE);
|
| -
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.LEFT_SHOULDER],
|
| - mRawButtons[KeyEvent.KEYCODE_BUTTON_Y], ERROR_TOLERANCE);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.RIGHT_SHOULDER],
|
| - mRawButtons[KeyEvent.KEYCODE_BUTTON_Z], ERROR_TOLERANCE);
|
| -
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.BACK_SELECT],
|
| - mRawButtons[KeyEvent.KEYCODE_BUTTON_L1], ERROR_TOLERANCE);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.START],
|
| - mRawButtons[KeyEvent.KEYCODE_BUTTON_R1], ERROR_TOLERANCE);
|
| -
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.LEFT_THUMBSTICK],
|
| - mRawButtons[KeyEvent.KEYCODE_BUTTON_L2], ERROR_TOLERANCE);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.RIGHT_THUMBSTICK],
|
| - mRawButtons[KeyEvent.KEYCODE_BUTTON_R2], ERROR_TOLERANCE);
|
| -
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.LEFT_TRIGGER],
|
| - (mRawAxes[MotionEvent.AXIS_Z] + 1) / 2, ERROR_TOLERANCE);
|
| - Assert.assertEquals(mMappedButtons[CanonicalButtonIndex.RIGHT_TRIGGER],
|
| - (mRawAxes[MotionEvent.AXIS_RZ] + 1) / 2, ERROR_TOLERANCE);
|
| -
|
| - assertMappedHatAxisToDpadButtons();
|
| - assertMappedXYAxes();
|
| - assertMappedRXAndRYAxesToRightStick();
|
| -
|
| - expectNoMetaButton();
|
| - assertMapping();
|
| - }
|
| -
|
| - @Test
|
| - @Feature({"Gamepad"})
|
| public void testUnknownXBox360GamepadMappings() throws Exception {
|
| int[] axes = new int[] {
|
| MotionEvent.AXIS_X,
|
|
|