@Test
 public void testScrollWithParent_shouldScrollAndClearFocus() {
   AccessibilityNodeInfoCompat parent = AccessibilityNodeInfoCompat.obtain();
   ((ShadowAccessibilityNodeInfoCompat) ShadowExtractor.extract(parent)).addChild(mCompat1);
   ShadowAccessibilityNodeInfo shadowParent =
       (ShadowAccessibilityNodeInfo) ShadowExtractor.extract(parent.getInfo());
   parent.setScrollable(true);
   mActionNode1.recycle();
   mActionNode1 =
       new AccessibilityNodeActionNode(
           mCompat1,
           new AccessibilityNodeInfoCompat.AccessibilityActionCompat(
               AccessibilityNodeInfoCompat.ACTION_CLICK, "label1"));
   mSelectionNode = new OptionScanSelectionNode(mActionNode1, mActionNode2);
   mOptionManager.clearFocusIfNewTree(mSelectionNode);
   mOptionManager.selectOption(0);
   mOptionManager.performScrollAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD);
   assertEquals(0, mShadowInfo1.getPerformedActions().size());
   List<Integer> parentActions = shadowParent.getPerformedActions();
   assertEquals(1, parentActions.size());
   assertEquals(
       new Integer(AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD), parentActions.get(0));
   verify(mOverlayController, times(3)).clearOverlay();
   parent.recycle();
 }
 @Test
 public void testLongClickWithTwoOptions_shouldDoNothing() {
   OptionScanSelectionNode superParentNode =
       new OptionScanSelectionNode(mSelectionNode, mSelectionNode);
   mOptionManager.clearFocusIfNewTree(superParentNode);
   mOptionManager.selectOption(0);
   mOptionManager.performLongClick();
   assertEquals(0, mShadowInfo1.getPerformedActions().size());
   assertEquals(0, mShadowInfo2.getPerformedActions().size());
 }
 @Test
 public void testMoveToParent_nowhereToGoWithWrap_shouldClearFocus() {
   mOptionManager.clearFocusIfNewTree(mSelectionNode);
   mOptionManager.selectOption(0);
   mOptionManager.moveToParent(true);
   /* Confirm that we're on null selection by moving to a child */
   mOptionManager.selectOption(0);
   assertEquals(0, mShadowInfo1.getPerformedActions().size());
   mOptionManager.selectOption(0);
   assertEquals(1, mShadowInfo1.getPerformedActions().size());
 }
 @Test
 public void testLongClickWithOneOptionThatSucceeds_shouldLongClickAndClearFocus() {
   mOptionManager.clearFocusIfNewTree(mSelectionNode);
   mOptionManager.selectOption(0);
   mOptionManager.performLongClick();
   List<Integer> info1Actions = mShadowInfo1.getPerformedActions();
   assertEquals(1, info1Actions.size());
   assertEquals(new Integer(AccessibilityNodeInfoCompat.ACTION_LONG_CLICK), info1Actions.get(0));
   verify(mOverlayController, times(3)).clearOverlay();
 }
 @Test
 public void testMoveToParent_fromNull_shouldWrap() {
   OptionScanSelectionNode topSelectionNode =
       new OptionScanSelectionNode(mActionNode1, mSelectionNode);
   mOptionManager.clearFocusIfNewTree(topSelectionNode);
   mOptionManager.moveToParent(true);
   /* Confirm that we're on mSelectionNode by moving to a child */
   mOptionManager.selectOption(0);
   assertEquals(1, mShadowInfo1.getPerformedActions().size());
 }
 @Test
 public void testScrollWithOneOptionThatSucceeds_shouldScrollAndClearFocus() {
   mCompat1.setScrollable(true);
   mActionNode1.recycle();
   mActionNode1 =
       new AccessibilityNodeActionNode(
           mCompat1,
           new AccessibilityNodeInfoCompat.AccessibilityActionCompat(
               AccessibilityNodeInfoCompat.ACTION_CLICK, "label1"));
   mSelectionNode = new OptionScanSelectionNode(mActionNode1, mActionNode2);
   mOptionManager.clearFocusIfNewTree(mSelectionNode);
   mOptionManager.selectOption(0);
   mOptionManager.performScrollAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD);
   List<Integer> info1Actions = mShadowInfo1.getPerformedActions();
   assertEquals(1, info1Actions.size());
   assertEquals(
       new Integer(AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD), info1Actions.get(0));
   verify(mOverlayController, times(3)).clearOverlay();
 }
 @Test
 public void testNegativeSelection_shouldBeIgnored() {
   mOptionManager.clearFocusIfNewTree(mActionNode1);
   mOptionManager.selectOption(-1);
   assertEquals(0, mShadowInfo1.getPerformedActions().size());
 }
 @Test
 public void testOnlyOneActionNode_shouldPerformActionOnFirstSelect() {
   mOptionManager.clearFocusIfNewTree(mActionNode1);
   mOptionManager.selectOption(0);
   assertEquals(1, mShadowInfo1.getPerformedActions().size());
 }
 @Test
 public void testOnlyOneActionNode_shouldDoNothingBeforeSelection() {
   mOptionManager.clearFocusIfNewTree(mActionNode1);
   assertEquals(0, mShadowInfo1.getPerformedActions().size());
 }