Java 类android.support.test.espresso.Root 实例源码

项目:TherapyGuide    文件:Matchers.java   
public static Matcher<Root> showsToast() {
    return new TypeSafeMatcher<Root>() {

        @Override
        public boolean matchesSafely(Root root) {
            int type = root.getWindowLayoutParams().get().type;
            if (type == WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY) {
                IBinder windowToken = root.getDecorView().getWindowToken();
                IBinder appToken = root.getDecorView().getApplicationWindowToken();
                if (windowToken == appToken) {
                    // windowToken == appToken means this window isn't contained by any other windows.
                    // if it was a window for an activity, it would have TYPE_BASE_APPLICATION.
                    return true;
                }
            }
            return false;
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("is toast");
        }
    };
}
项目:mangosta-android    文件:MyViewMatchers.java   
public static Matcher<Root> isToast() {
    return new TypeSafeMatcher<Root>() {
        @Override
        public void describeTo(Description description) {
            description.appendText("is toast");
        }

        @Override
        public boolean matchesSafely(Root root) {
            int type = root.getWindowLayoutParams().get().type;
            if (type == WindowManager.LayoutParams.TYPE_TOAST) {
                IBinder windowToken = root.getDecorView().getWindowToken();
                IBinder appToken = root.getDecorView().getApplicationWindowToken();
                if (windowToken == appToken) {
                    // windowToken == appToken means this window isn't contained by any other windows.
                    // if it was a window for an activity, it would have TYPE_BASE_APPLICATION.
                    return true;
                }
            }
            return false;
        }
    };
}
项目:Vineyard    文件:CustomMatchers.java   
/**
 * Matcher that is Toast window.
 */
public static Matcher<Root> isToast() {
    return new TypeSafeMatcher<Root>() {

        @Override
        public void describeTo(Description description) {
            description.appendText("is toast");
        }

        @Override
        public boolean matchesSafely(Root root) {
            int type = root.getWindowLayoutParams().get().type;
            if ((type == WindowManager.LayoutParams.TYPE_TOAST)) {
                IBinder windowToken = root.getDecorView().getWindowToken();
                IBinder appToken = root.getDecorView().getApplicationWindowToken();
                if (windowToken == appToken) {
                    // windowToken == appToken means this window isn't contained by any other windows.
                    // if it was a window for an activity, it would have TYPE_BASE_APPLICATION.
                    return true;
                }
            }
            return false;
        }
    };
}
项目:pubnative-android-sdk    文件:LayoutActivityTest.java   
@Override
public boolean matchesSafely(Root root) {
    int type = root.getWindowLayoutParams().get().type;
    if (type == WindowManager.LayoutParams.TYPE_TOAST) {
        IBinder windowToken = root.getDecorView().getWindowToken();
        IBinder appToken = root.getDecorView().getApplicationWindowToken();
        if (windowToken == appToken) {
            // windowToken == appToken means this window isn't contained by any other windows.
            // if it was a window for an activity, it would have TYPE_BASE_APPLICATION.
            return true;
        }
    }
    return false;
}
项目:Attendance    文件:CompaniesMvvmActivityEspressoTest.java   
@Override
public boolean matchesSafely(Root root) {
    int type = root.getWindowLayoutParams().get().type;
    if ((type == WindowManager.LayoutParams.TYPE_TOAST)) {
        IBinder windowToken = root.getDecorView().getWindowToken();
        IBinder appToken = root.getDecorView().getApplicationWindowToken();
        if (windowToken == appToken) {
            return true;
        }
    }
    return false;
}
项目:friendly-plans    文件:ToastMatcher.java   
@Override
public boolean matchesSafely(Root root) {
    int type = root.getWindowLayoutParams().get().type;
    if (type == WindowManager.LayoutParams.TYPE_TOAST) {
        IBinder windowToken = root.getDecorView().getWindowToken();
        IBinder appToken = root.getDecorView().getApplicationWindowToken();
        if (windowToken == appToken) {
            return true;
        }
    }
    return false;
}
项目:zulip-android    文件:ToastMatcher.java   
@Override
public boolean matchesSafely(Root root) {
    int type = root.getWindowLayoutParams().get().type;
    if ((type == WindowManager.LayoutParams.TYPE_TOAST)) {
        IBinder windowToken = root.getDecorView().getWindowToken();
        IBinder appToken = root.getDecorView().getApplicationWindowToken();
        if (windowToken == appToken) {
            return true;
        }
    }
    return false;
}
项目:Ironhide    文件:BaseView.java   
/**
 * Checks that the root of the current view matches the given rootMatcher
 *
 * @param rootMatcher The RootMatcher used to check the root of the element
 * @return The model reached by interacting with this element
 */
protected T checkRootMatches(Matcher<Root> rootMatcher) {
    onView(getSelector())
            .inRoot(rootMatcher)
            .check(ViewAssertions.matches(ViewMatchers.isDisplayed()));

    return returnGeneric();
}
项目:americano    文件:RootMatchers.java   
/**
 * Matches {@link Root}s that are toasts.
 */
public static Matcher<Root> isToast() {
    return new TypeSafeMatcher<Root>() {
        @Override
        public void describeTo(Description description) {
            description.appendText("is toast");
        }

        @Override
        public boolean matchesSafely(Root root) {
            return root.getWindowLayoutParams().get().type == WindowManager.LayoutParams.TYPE_TOAST;
        }
    };
}
项目:akvo-caddisfly    文件:ToastMatcher.java   
@Override
public boolean matchesSafely(Root root) {
    int type = root.getWindowLayoutParams().get().type;
    if (type == WindowManager.LayoutParams.TYPE_TOAST) {
        IBinder windowToken = root.getDecorView().getWindowToken();
        IBinder appToken = root.getDecorView().getApplicationWindowToken();
        if (windowToken.equals(appToken)) {
            // windowToken == appToken means this window isn't contained by any other windows.
            // if it was a window for an activity, it would have TYPE_BASE_APPLICATION.
            return true;
        }
    }
    return false;
}
项目:FitBuddy    文件:ToastMatcher.java   
@Override
public boolean matchesSafely(Root root) {
    int type = root.getWindowLayoutParams().get().type;
    if (type == WindowManager.LayoutParams.TYPE_TOAST) {
        IBinder windowToken = root.getDecorView().getWindowToken();
        IBinder appToken = root.getDecorView().getApplicationWindowToken();
        if (windowToken == appToken) {
            return true;
        }
    }
    return false;
}
项目:2016.2-MissaoNascente    文件:PreferenceControllerAcceptanceTest.java   
public static Matcher<Root> isPopupWindow() {
    return isPlatformPopup();
}
项目:2016.2-MissaoNascente    文件:TutorialAcceptanceTest.java   
public static Matcher<Root> isPopupWindow() {
    return isPlatformPopup();
}
项目:2016.2-MissaoNascente    文件:MainScreenAcceptanceTest.java   
public static Matcher<Root> isPopupWindow() {
    return isPlatformPopup();
}
项目:zulip-android    文件:BaseTest.java   
public static Matcher<Root> isToast() {
    return new ToastMatcher();
}
项目:Ironhide    文件:SpinnerView.java   
/** {@inheritDoc} */
@Override
public SpinnerView<T> inRoot(Matcher<Root> rootMatcher) {
    return (SpinnerView<T>) super.inRoot(rootMatcher);
}
项目:Ironhide    文件:Recycler.java   
/** {@inheritDoc} */
@Override
public Recycler<T> inRoot(Matcher<Root> rootMatcher) {
    return (Recycler<T>) super.inRoot(rootMatcher);
}
项目:Ironhide    文件:ListItem.java   
/** {@inheritDoc} */
@Override
public ListItem<T> inRoot(Matcher<Root> rootMatcher) {
    throw new UnsupportedOperationException("It is too late to call this method. Use ListAdapter's root changers instead");
}
项目:Ironhide    文件:ListAdapter.java   
/** {@inheritDoc} */
@Override
public ListAdapter<T> inRoot(Matcher<Root> rootMatcher) {
    this.adapter = this.adapter.inRoot(rootMatcher);
    return this;
}
项目:Ironhide    文件:Clickable.java   
/** {@inheritDoc} */
@Override
public Clickable<T> inRoot(Matcher<Root> rootMatcher) {
    return (Clickable<T>) super.inRoot(rootMatcher);
}
项目:Ironhide    文件:TextField.java   
/** {@inheritDoc} */
@Override
public TextField<T> inRoot(Matcher<Root> rootMatcher) {
    return (TextField<T>) super.inRoot(rootMatcher);
}
项目:Ironhide    文件:DatePicker.java   
/** {@inheritDoc} */
@Override
public DatePicker<T> inRoot(Matcher<Root> rootMatcher) {
    return (DatePicker<T>) super.inRoot(rootMatcher);
}
项目:Ironhide    文件:Swipeable.java   
/** {@inheritDoc} */
@Override
public Swipeable<T> inRoot(Matcher<Root> rootMatcher) {
    return (Swipeable<T>) super.inRoot(rootMatcher);
}
项目:Ironhide    文件:LayoutView.java   
/** {@inheritDoc} */
@Override
public LayoutView<T> inRoot(Matcher<Root> rootMatcher) {
    return (LayoutView<T>) super.inRoot(rootMatcher);
}
项目:Ironhide    文件:Zoomable.java   
/** {@inheritDoc} */
@Override
public Zoomable<T> inRoot(Matcher<Root> rootMatcher) {
    return (Zoomable<T>) super.inRoot(rootMatcher);
}
项目:Ironhide    文件:NavDrawer.java   
/** {@inheritDoc} */
@Override
public NavDrawer<T> inRoot(Matcher<Root> rootMatcher) {
    return (NavDrawer<T>) super.inRoot(rootMatcher);
}
项目:FitBuddy    文件:ToastMatcher.java   
public static Matcher<Root> isToast() {
    return new ToastMatcher();
}
项目:Ironhide    文件:BaseView.java   
/**
 * Changes the root for this view to match the given rootMatcher
 * @param rootMatcher a rootMatcher using Espresso's RootMatchers
 * @return  this
 */
protected BaseView<T> inRoot(Matcher<Root> rootMatcher) {
    this.viewInteraction = this.viewInteraction.inRoot(rootMatcher);
    return this;
}