use of android.view.ActionMode in project android_frameworks_base by AOSPA.
the class ActionBarContainerTest method testFloatingActionModesAreBubbledUp.
public void testFloatingActionModesAreBubbledUp() {
TestViewGroup viewGroup = new TestViewGroup(mContext);
viewGroup.addView(mActionBarContainer);
ActionMode mode = mActionBarContainer.startActionModeForChild(null, null, ActionMode.TYPE_FLOATING);
// Should bubble up.
assertNotNull(mode);
assertTrue(viewGroup.isStartActionModeForChildTypedCalled);
}
use of android.view.ActionMode in project android_frameworks_base by AOSPA.
the class PhoneWindowActionModeTest method testCreatedFloatingModeLifecycleIsHandled.
@UiThreadTest
public void testCreatedFloatingModeLifecycleIsHandled() {
mWindowCallback.mShouldReturnOwnActionMode = false;
ActionMode mode = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_FLOATING);
assertNotNull(mode);
assertEquals(ActionMode.TYPE_FLOATING, mode.getType());
assertTrue(mActionModeCallback.mIsCreateActionModeCalled);
assertTrue(mWindowCallback.mIsActionModeStarted);
}
use of android.view.ActionMode in project android_frameworks_base by AOSPA.
the class PhoneWindowActionModeTest method testStartActionModeFloatingFinishesPreviousMode.
public void testStartActionModeFloatingFinishesPreviousMode() {
// Use custom callback to control the provided ActionMode.
mWindowCallback.mShouldReturnOwnActionMode = true;
ActionMode mode1 = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_FLOATING);
ActionMode mode2 = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_FLOATING);
assertTrue(mode1 instanceof MockActionMode);
assertTrue(((MockActionMode) mode1).mIsFinished);
assertNotNull(mode2);
}
use of android.view.ActionMode in project android_frameworks_base by AOSPA.
the class PhoneWindowActionModeTest method testStartActionModePrimaryFinishesPreviousMode.
public void testStartActionModePrimaryFinishesPreviousMode() {
// Use custom callback to control the provided ActionMode.
mWindowCallback.mShouldReturnOwnActionMode = true;
ActionMode mode1 = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_PRIMARY);
ActionMode mode2 = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_PRIMARY);
assertTrue(mode1 instanceof MockActionMode);
assertTrue(((MockActionMode) mode1).mIsFinished);
assertNotNull(mode2);
}
use of android.view.ActionMode in project android_frameworks_base by AOSPA.
the class PhoneWindowActionModeTest method testCreatedModeIsNotStartedIfCreateReturnsFalse.
@UiThreadTest
public void testCreatedModeIsNotStartedIfCreateReturnsFalse() {
mWindowCallback.mShouldReturnOwnActionMode = false;
mActionModeCallback.mShouldCreateActionMode = false;
ActionMode mode = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_FLOATING);
assertTrue(mActionModeCallback.mIsCreateActionModeCalled);
assertFalse(mWindowCallback.mIsActionModeStarted);
assertNull(mode);
}
Aggregations