use of androidx.test.espresso.remote.GenericRemoteMessage in project android-test by android.
the class DisplayDataMatcherRemoteMsgTest method toProto.
private static DisplayDataMatcherProto toProto() {
Matcher<View> adapterMatcher = isAssignableFrom(AdapterView.class);
Matcher<String> stringMatcher = allOf(instanceOf(String.class), equalTo(TEXT_VIEW_TEXT));
AdapterViewProtocol adapterViewProtocol = AdapterViewProtocols.standardProtocol();
AdapterDataLoaderAction adapterDataLoaderAction = new AdapterDataLoaderAction(stringMatcher, EspressoOptional.<Integer>absent(), adapterViewProtocol);
Function<AdapterDataLoaderAction, ViewInteraction> noOpDataLoaderFunction = new Function<AdapterDataLoaderAction, ViewInteraction>() {
@Override
public ViewInteraction apply(AdapterDataLoaderAction adapterDataLoaderAction) {
return null;
}
};
DisplayDataMatcher displayDataMatcher = new DisplayDataMatcher(adapterMatcher, stringMatcher, adapterViewProtocol, adapterDataLoaderAction, noOpDataLoaderFunction);
return (DisplayDataMatcherProto) new GenericRemoteMessage(displayDataMatcher).toProto();
}
use of androidx.test.espresso.remote.GenericRemoteMessage in project android-test by android.
the class RemoteViewAssertionsTest method noOverlaps_transformationFromProto.
@Test
public void noOverlaps_transformationFromProto() {
ViewAssertion viewAssertion = noOverlaps();
NoOverlapsViewAssertionProto viewAssertionProto = (NoOverlapsViewAssertionProto) new GenericRemoteMessage(viewAssertion).toProto();
ViewAssertion viewAssertionFromProto = (ViewAssertion) GenericRemoteMessage.FROM.fromProto(viewAssertionProto);
assertThat(viewAssertionFromProto, instanceOf(NoOverlapsViewAssertion.class));
}
use of androidx.test.espresso.remote.GenericRemoteMessage in project android-test by android.
the class RemoteViewAssertionsTest method selectedDescendantsMatch_transformationToProto.
@Test
public void selectedDescendantsMatch_transformationToProto() {
ViewAssertion viewAssertion = selectedDescendantsMatch(withText("no content description"), hasContentDescription());
SelectedDescendantsMatchViewAssertionProto viewAssertionProto = (SelectedDescendantsMatchViewAssertionProto) new GenericRemoteMessage(viewAssertion).toProto();
assertThat(viewAssertionProto, notNullValue());
}
use of androidx.test.espresso.remote.GenericRemoteMessage in project android-test by android.
the class RemoteViewAssertionsTest method matches_transformationFromProto.
@Test
public void matches_transformationFromProto() {
View view = new View(getInstrumentation().getContext());
ViewAssertion viewAssertion = matches(withId(view.getId()));
MatchesViewAssertionProto viewAssertionProto = (MatchesViewAssertionProto) new GenericRemoteMessage(viewAssertion).toProto();
((MatchesViewAssertion) GenericRemoteMessage.FROM.fromProto(viewAssertionProto)).viewMatcher.matches(view);
}
use of androidx.test.espresso.remote.GenericRemoteMessage in project android-test by android.
the class RemoteViewActionsTest method editorAction_transformationFromProto.
@Test
public void editorAction_transformationFromProto() {
ViewAction editorAction = pressImeActionButton();
EditorActionProto editorActionActionProto = (EditorActionProto) new GenericRemoteMessage(editorAction).toProto();
EditorAction editorActionFromProto = (EditorAction) GenericRemoteMessage.FROM.fromProto(editorActionActionProto);
assertThat(editorActionFromProto, notNullValue());
}
Aggregations