Commit dc2ffb3b authored by Clemens Arbesser's avatar Clemens Arbesser Committed by Commit Bot

[Autofill Assistant] Added test for image resource identifiers

We used to have a test like this, but it was disabled some time ago due
to hard-to-reproduce issues on devices with older API levels. This is
a more focused test specifically for vector graphics. I have tried this
on a variety of (emulated) devices and API levels and could not
reproduce, so I'm going ahead and submit this test.

Tested on:
- Generic phone 21
- Nexus 5x 23
- Nexus 5x 25
- Nexus 5x 26
- Pixel 3 XL 28
- Pixel 3 30

Bug: b/145043394
Change-Id: I6d27eeda3e2ef7c2e29d5364838349664a83eb49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2310991
Commit-Queue: Marian Fechete <marianfe@google.com>
Reviewed-by: default avatarMarian Fechete <marianfe@google.com>
Auto-Submit: Clemens Arbesser <arbesser@google.com>
Cr-Commit-Position: refs/heads/master@{#790785}
parent 19ff4e19
...@@ -65,6 +65,7 @@ import org.junit.runner.RunWith; ...@@ -65,6 +65,7 @@ import org.junit.runner.RunWith;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.DisableIf;
import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.generic_ui.AssistantDimension; import org.chromium.chrome.browser.autofill_assistant.generic_ui.AssistantDimension;
import org.chromium.chrome.browser.autofill_assistant.proto.ActionProto; import org.chromium.chrome.browser.autofill_assistant.proto.ActionProto;
...@@ -3312,4 +3313,65 @@ public class AutofillAssistantGenericUiTest { ...@@ -3312,4 +3313,65 @@ public class AutofillAssistantGenericUiTest {
CreditCardResponseProto.newBuilder().setNetwork("amex"))) CreditCardResponseProto.newBuilder().setNetwork("amex")))
.build())); .build()));
} }
}
@Test
@MediumTest
@MinAndroidSdkLevel(21)
public void testImageResourceIdentifier() {
ViewProto imageView =
(ViewProto) ViewProto.newBuilder()
.setLayoutParams(
ViewLayoutParamsProto.newBuilder()
.setLayoutWidth(24)
.setLayoutHeight(24)
.setLayoutGravity(
ViewLayoutParamsProto.Gravity.CENTER_VALUE))
.setAttributes(ViewAttributesProto.newBuilder().setContentDescription(
"test image"))
.setImageView(ImageViewProto.newBuilder().setImage(
DrawableProto.newBuilder().setResourceIdentifier(
"ic_visibility_black")))
.build();
GenericUserInterfaceProto genericUserInterface =
(GenericUserInterfaceProto) GenericUserInterfaceProto.newBuilder()
.setRootView(
ViewProto.newBuilder()
.setLayoutParams(
ViewLayoutParamsProto.newBuilder()
.setLayoutWidth(ViewLayoutParamsProto.Size
.MATCH_PARENT_VALUE)
.setLayoutHeight(
ViewLayoutParamsProto.Size
.WRAP_CONTENT_VALUE))
.setViewContainer(
ViewContainerProto.newBuilder()
.setLinearLayout(
LinearLayoutProto.newBuilder()
.setOrientation(
LinearLayoutProto
.Orientation
.VERTICAL))
.addViews(imageView)))
.build();
ArrayList<ActionProto> list = new ArrayList<>();
list.add((ActionProto) ActionProto.newBuilder()
.setShowGenericUi(ShowGenericUiProto.newBuilder().setGenericUserInterface(
genericUserInterface))
.build());
AutofillAssistantTestScript script = new AutofillAssistantTestScript(
(SupportedScriptProto) SupportedScriptProto.newBuilder()
.setPath("autofill_assistant_target_website.html")
.setPresentation(PresentationProto.newBuilder().setAutostart(true).setChip(
ChipProto.newBuilder().setText("Autostart")))
.build(),
list);
AutofillAssistantTestService testService =
new AutofillAssistantTestService(Collections.singletonList(script));
startAutofillAssistant(mTestRule.getActivity(), testService);
waitUntilViewMatchesCondition(withContentDescription("test image"), isDisplayed());
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment