Commit 8b7df4a2 authored by Jeffrey Cohen's avatar Jeffrey Cohen Committed by Commit Bot

[ShareButtonInToolbar] speculative fix for flaky test

Bug: 1072141
Change-Id: Ic8fea35fa0acd9bbcf8379c47ac5a8f30c3fd912
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2157891Reviewed-by: default avatarPatrick Noland <pnoland@chromium.org>
Commit-Queue: Jeffrey Cohen <jeffreycohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#761982}
parent 16e48486
...@@ -4,6 +4,13 @@ ...@@ -4,6 +4,13 @@
package org.chromium.chrome.browser.share; package org.chromium.chrome.browser.share;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
...@@ -26,6 +33,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList; ...@@ -26,6 +33,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.chrome.test.util.ViewUtils;
import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.chrome.test.util.browser.Features.EnableFeatures;
import org.chromium.chrome.test.util.browser.signin.SigninTestUtil; import org.chromium.chrome.test.util.browser.signin.SigninTestUtil;
import org.chromium.components.embedder_support.util.UrlConstants; import org.chromium.components.embedder_support.util.UrlConstants;
...@@ -146,6 +154,9 @@ public final class ShareButtonControllerTest { ...@@ -146,6 +154,9 @@ public final class ShareButtonControllerTest {
public void testShareButtonDisabledOnDataUrl() { public void testShareButtonDisabledOnDataUrl() {
mActivityTestRule.loadUrl("data:,Hello%2C%20World!"); mActivityTestRule.loadUrl("data:,Hello%2C%20World!");
ViewUtils.waitForView(allOf(withId(R.id.optional_toolbar_button),
anyOf(not(isDisplayed()), not(withContentDescription(R.string.share)))));
View experimentalButton = mActivityTestRule.getActivity() View experimentalButton = mActivityTestRule.getActivity()
.getToolbarManager() .getToolbarManager()
.getToolbarLayoutForTesting() .getToolbarLayoutForTesting()
......
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