Commit d16b7adb authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

CVC.isSelectPopupVisibleForTesting

This CL replaces |getSelectPopupForTesting| with the one that simply
returns its visibility (showing or hidden), which is enough for
testing purposes. It helps CVC not return/expose non-public class
when moved to content_public https://crrev.com/c/900884

Bug: 807155
Change-Id: I8dbdace17ace9068ee7807dfa1abf7ac85f4c357
Reviewed-on: https://chromium-review.googlesource.com/902982Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Reviewed-by: default avatarTommy Nyquist <nyquist@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534829}
parent 1e290a05
......@@ -799,10 +799,9 @@ public class CustomTabActivityTest {
@Override
public boolean isSatisfied() {
return mCustomTabActivityTestRule.getActivity()
.getActivityTab()
.getContentViewCore()
.getSelectPopupForTest()
!= null;
.getActivityTab()
.getContentViewCore()
.isSelectPopupVisibleForTest();
}
});
final ChromeActivity newActivity = reparentAndVerifyTab();
......@@ -810,9 +809,8 @@ public class CustomTabActivityTest {
@Override
public boolean isSatisfied() {
Tab currentTab = newActivity.getActivityTab();
return currentTab != null
&& currentTab.getContentViewCore() != null
&& currentTab.getContentViewCore().getSelectPopupForTest() == null;
return currentTab != null && currentTab.getContentViewCore() != null
&& !currentTab.getContentViewCore().isSelectPopupVisibleForTest();
}
});
}
......
......@@ -65,7 +65,7 @@ public class SelectPopupOtherContentViewTest {
public boolean isSatisfied() {
ContentViewCore contentViewCore =
mActivityTestRule.getActivity().getCurrentContentViewCore();
return contentViewCore.getSelectPopupForTest() != null;
return contentViewCore.isSelectPopupVisibleForTest();
}
}
......@@ -112,8 +112,7 @@ public class SelectPopupOtherContentViewTest {
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
// The popup should still be shown.
Assert.assertNotNull(
"The select popup got hidden by destroying of unrelated ContentViewCore.",
viewCore.getSelectPopupForTest());
Assert.assertTrue("The select popup got hidden by destroying of unrelated ContentViewCore.",
viewCore.isSelectPopupVisibleForTest());
}
}
......@@ -12,7 +12,6 @@ import android.view.View;
import android.view.ViewGroup;
import org.chromium.base.VisibleForTesting;
import org.chromium.content.browser.input.SelectPopup;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.ViewAndroidDelegate;
import org.chromium.ui.base.WindowAndroid;
......@@ -388,8 +387,8 @@ public interface ContentViewCore {
void sendDoubleTapForTest(long timeMs, int x, int y);
/**
* @return The visible select popup being shown.
* @return {@code true} if select popup is being shown.
*/
@VisibleForTesting
SelectPopup getSelectPopupForTest();
boolean isSelectPopupVisibleForTest();
}
......@@ -1036,13 +1036,10 @@ public class ContentViewCoreImpl
if (mSelectPopup != null) mSelectPopup.hide(true);
}
/**
* @return The visible select popup being shown.
*/
@VisibleForTesting
@Override
public SelectPopup getSelectPopupForTest() {
return mSelectPopup;
public boolean isSelectPopupVisibleForTest() {
return mSelectPopup != null;
}
private void destroyPastePopup() {
......
......@@ -60,7 +60,7 @@ public class SelectPopupTest {
@Override
public boolean isSatisfied() {
return mActivityTestRule.getContentViewCore().getSelectPopupForTest() != null;
return mActivityTestRule.getContentViewCore().isSelectPopupVisibleForTest();
}
}
......@@ -71,7 +71,7 @@ public class SelectPopupTest {
@Override
public boolean isSatisfied() {
return mActivityTestRule.getContentViewCore().getSelectPopupForTest() == null;
return !mActivityTestRule.getContentViewCore().isSelectPopupVisibleForTest();
}
}
......
......@@ -12,7 +12,6 @@ import android.view.ViewGroup;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.ContentViewCore.InternalAccessDelegate;
import org.chromium.content.browser.input.SelectPopup;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.ViewAndroidDelegate;
import org.chromium.ui.base.WindowAndroid;
......@@ -202,8 +201,8 @@ public class TestContentViewCore implements ContentViewCore {
public void preserveSelectionOnNextLossOfFocus() {}
@Override
public SelectPopup getSelectPopupForTest() {
return null;
public boolean isSelectPopupVisibleForTest() {
return false;
}
@Override
......
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