/** * Tests that the showing select popup does not get closed because an unrelated ContentView gets * destroyed. @LargeTest @Feature({"Browser"}) BUG 172967 */ @DisabledTest public void testPopupNotClosedByOtherContentView() throws InterruptedException, Exception, Throwable { // Load the test page. launchChromeShellWithUrl(SELECT_URL); assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading()); final ContentViewCore viewCore = getActivity().getActiveContentViewCore(); // Once clicked, the popup should show up. DOMUtils.clickNode(this, viewCore, "select"); assertTrue( "The select popup did not show up on click.", CriteriaHelper.pollForCriteria(new PopupShowingCriteria())); // Now create and destroy a different ContentView. ThreadUtils.runOnUiThreadBlocking( new Runnable() { @Override public void run() { long nativeWebContents = ContentViewUtil.createNativeWebContents(false); WindowAndroid windowAndroid = new ActivityWindowAndroid(getActivity()); ContentViewCore contentViewCore = new ContentViewCore(getActivity()); ContentView cv = ContentView.newInstance(getActivity(), contentViewCore); contentViewCore.initialize(cv, cv, nativeWebContents, windowAndroid); contentViewCore.destroy(); } }); // Process some more events to give a chance to the dialog to hide if it were to. getInstrumentation().waitForIdleSync(); // The popup should still be shown. assertNotNull( "The select popup got hidden by destroying of unrelated ContentViewCore.", viewCore.getSelectPopupForTest()); }
@Override public boolean isSatisfied() { ContentViewCore contentViewCore = getActivity().getActiveContentViewCore(); return contentViewCore.getSelectPopupForTest() != null; }