This source file includes following definitions.
- isSatisfied
- testPopupNotClosedByOtherContentView
package org.chromium.chrome.browser.input;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.UrlUtils;
import org.chromium.chrome.browser.ContentViewUtil;
import org.chromium.chrome.shell.ChromeShellTestBase;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content.browser.test.util.DOMUtils;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
import org.chromium.content.browser.test.util.UiUtils;
import org.chromium.ui.base.ActivityWindowAndroid;
import org.chromium.ui.base.WindowAndroid;
public class SelectPopupOtherContentViewTest extends ChromeShellTestBase {
private static final String SELECT_URL = UrlUtils.encodeHtmlDataUri(
"<html><body>" +
"Which animal is the strongest:<br/>" +
"<select id=\"select\">" +
"<option>Black bear</option>" +
"<option>Polar bear</option>" +
"<option>Grizzly</option>" +
"<option>Tiger</option>" +
"<option>Lion</option>" +
"<option>Gorilla</option>" +
"<option>Chipmunk</option>" +
"</select>" +
"</body></html>");
private class PopupShowingCriteria implements Criteria {
@Override
public boolean isSatisfied() {
ContentView view = getActivity().getActiveContentView();
return view.getContentViewCore().getSelectPopupForTest() != null;
}
}
public SelectPopupOtherContentViewTest() {
}
@DisabledTest
public void testPopupNotClosedByOtherContentView()
throws InterruptedException, Exception, Throwable {
launchChromeShellWithUrl(SELECT_URL);
assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading());
final ContentView view = getActivity().getActiveContentView();
final TestCallbackHelperContainer viewClient =
new TestCallbackHelperContainer(view);
DOMUtils.clickNode(this, view, viewClient, "select");
assertTrue("The select popup did not show up on click.",
CriteriaHelper.pollForCriteria(new PopupShowingCriteria()));
UiUtils.runOnUiThread(getActivity(), new Runnable() {
@Override
public void run() {
long nativeWebContents = ContentViewUtil.createNativeWebContents(false);
WindowAndroid windowAndroid = new ActivityWindowAndroid(getActivity());
ContentView contentView = ContentView.newInstance(
getActivity(), nativeWebContents, windowAndroid);
contentView.destroy();
}
});
getInstrumentation().waitForIdleSync();
assertNotNull("The select popup got hidden by destroying of unrelated ContentViewCore.",
view.getContentViewCore().getSelectPopupForTest());
}
}