Sha256: 1b56d4e852f5a9f705039b44344b48da89911a69abc9feb4fdd35e481ee3f9b9
Contents?: true
Size: 1.13 KB
Versions: 97
Compression:
Stored size: 1.13 KB
Contents
package sh.calaba.instrumentationbackend.actions.view; import sh.calaba.instrumentationbackend.InstrumentationBackend; import sh.calaba.instrumentationbackend.Result; import sh.calaba.instrumentationbackend.actions.Action; import android.app.Activity; /** * This action checks that the current activity under test has the focus. * * This is useful to run tests across different applications (for example, * your application launching the browser). Since the instrumentation can * only work with the application under test, then all we can assert is that * said application has lost the focus. * * @author Gianpiero Puleo (gianpi@ustwo.co.uk) * @author Juan Delgado (juan@ustwo.co.uk) */ @SuppressWarnings("deprecation") public class IsCurrentActivityFocused implements Action { @Override public Result execute(String... args) { Activity currentActivity = InstrumentationBackend.solo.getCurrentActivity(); String hasFocus = "false"; if (currentActivity.hasWindowFocus()) { hasFocus = "true"; } return new Result(true, hasFocus); } @Override public String key() { return "is_current_activity_focused"; } }
Version data entries
97 entries across 97 versions & 2 rubygems