use of android.view.ActionMode in project platform_frameworks_base by android.
the class WindowDecorActionBarTest method testStartActionModeWhenCreateReturnsFalse.
@UiThreadTest
public void testStartActionModeWhenCreateReturnsFalse() {
mCallback.mShouldCreateActionMode = false;
ActionMode mode = mWindowDecorActionBar.startActionMode(mCallback);
assertNull(mode);
assertTrue(mCallback.mIsCreateActionModeCalled);
}
use of android.view.ActionMode in project platform_frameworks_base by android.
the class WindowDecorActionBarTest method testStartActionModeFinishesPreviousMode.
@UiThreadTest
public void testStartActionModeFinishesPreviousMode() {
ActionMode mode1 = mWindowDecorActionBar.startActionMode(mCallback);
ActionMode mode2 = mWindowDecorActionBar.startActionMode(new MockActionModeCallback());
assertNotNull(mode1);
assertNotNull(mode2);
assertTrue(mCallback.mIsDestroyActionModeCalled);
}
use of android.view.ActionMode in project platform_frameworks_base by android.
the class PhoneWindowActionModeTest method testStartActionModePreservesPreviousModeOfDifferentType2.
public void testStartActionModePreservesPreviousModeOfDifferentType2() {
// 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_FLOATING);
assertTrue(mode1 instanceof MockActionMode);
assertFalse(((MockActionMode) mode1).mIsFinished);
assertNotNull(mode2);
}
use of android.view.ActionMode in project platform_frameworks_base by android.
the class PhoneWindowActionModeTest method testCreatedPrimaryModeLifecycleIsHandled.
@UiThreadTest
public void testCreatedPrimaryModeLifecycleIsHandled() {
mWindowCallback.mShouldReturnOwnActionMode = false;
ActionMode mode = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_PRIMARY);
assertNotNull(mode);
assertEquals(ActionMode.TYPE_PRIMARY, mode.getType());
assertTrue(mActionModeCallback.mIsCreateActionModeCalled);
assertTrue(mWindowCallback.mIsActionModeStarted);
}
use of android.view.ActionMode in project platform_frameworks_base by android.
the class PhoneWindowActionModeTest method testStartActionModePreservesPreviousModeOfDifferentType1.
public void testStartActionModePreservesPreviousModeOfDifferentType1() {
// 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_PRIMARY);
assertTrue(mode1 instanceof MockActionMode);
assertFalse(((MockActionMode) mode1).mIsFinished);
assertNotNull(mode2);
}
Aggregations