Support for a test for pausing an app via Overview.
Bug: 117888000 Change-Id: If9fc76ddfbc756acf39ad5209904d3099c2e4e5f Tests: on the Nexus side
This commit is contained in:
@@ -28,6 +28,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
@@ -280,4 +281,14 @@ public class TaskMenuView extends AbstractFloatingView {
|
||||
Rect toRect = new Rect(0, 0, getWidth(), getHeight());
|
||||
return new RoundedRectRevealOutlineProvider(radius, radius, fromRect, toRect);
|
||||
}
|
||||
|
||||
public View findMenuItemByText(String text) {
|
||||
for (int i = mOptionLayout.getChildCount() - 1; i >= 0; --i) {
|
||||
final ViewGroup menuOptionView = (ViewGroup) mOptionLayout.getChildAt(i);
|
||||
if (text.equals(menuOptionView.<TextView>findViewById(R.id.text).getText())) {
|
||||
return menuOptionView;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,6 +210,10 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
|
||||
mDigitalWellBeingToast = findViewById(R.id.digital_well_being_toast);
|
||||
}
|
||||
|
||||
public TaskMenuView getMenuView() {
|
||||
return mMenuView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates this task view to the given {@param task}.
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,8 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class TestUtil {
|
||||
public static final String DUMMY_PACKAGE = "com.example.android.aardwolf";
|
||||
|
||||
public static void installDummyApp() throws IOException {
|
||||
// Copy apk from resources to a local file and install from there.
|
||||
final Resources resources = getContext().getResources();
|
||||
@@ -48,4 +50,9 @@ public class TestUtil {
|
||||
|
||||
UiDevice.getInstance(getInstrumentation()).executeShellCommand("pm install " + apkFilename);
|
||||
}
|
||||
|
||||
public static void uninstallDummyApp() throws IOException {
|
||||
UiDevice.getInstance(getInstrumentation()).executeShellCommand(
|
||||
"pm uninstall " + DUMMY_PACKAGE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user