| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.input; | 5 package org.chromium.chrome.browser.input; |
| 6 | 6 |
| 7 import android.test.suitebuilder.annotation.LargeTest; | |
| 8 | |
| 9 import org.chromium.base.test.util.DisabledTest; | 7 import org.chromium.base.test.util.DisabledTest; |
| 10 import org.chromium.base.test.util.Feature; | |
| 11 import org.chromium.base.test.util.UrlUtils; | 8 import org.chromium.base.test.util.UrlUtils; |
| 12 import org.chromium.content.browser.ContentView; | 9 import org.chromium.content.browser.ContentView; |
| 13 import org.chromium.content.browser.input.SelectPopupDialog; | 10 import org.chromium.content.browser.input.SelectPopupDialog; |
| 14 import org.chromium.content.browser.test.util.Criteria; | 11 import org.chromium.content.browser.test.util.Criteria; |
| 15 import org.chromium.content.browser.test.util.CriteriaHelper; | 12 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 16 import org.chromium.content.browser.test.util.DOMUtils; | 13 import org.chromium.content.browser.test.util.DOMUtils; |
| 17 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; | 14 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; |
| 18 import org.chromium.content.browser.test.util.UiUtils; | 15 import org.chromium.content.browser.test.util.UiUtils; |
| 19 import org.chromium.chrome.browser.ContentViewUtil; | 16 import org.chromium.chrome.browser.ContentViewUtil; |
| 20 import org.chromium.chrome.testshell.ChromiumTestShellTestBase; | 17 import org.chromium.chrome.testshell.ChromiumTestShellTestBase; |
| 18 import org.chromium.ui.ActivityWindowAndroid; |
| 21 import org.chromium.ui.WindowAndroid; | 19 import org.chromium.ui.WindowAndroid; |
| 22 | 20 |
| 23 import java.util.concurrent.TimeUnit; | |
| 24 | |
| 25 public class SelectPopupOtherContentViewTest extends ChromiumTestShellTestBase { | 21 public class SelectPopupOtherContentViewTest extends ChromiumTestShellTestBase { |
| 26 private static final int WAIT_TIMEOUT_SECONDS = 2; | 22 private static final int WAIT_TIMEOUT_SECONDS = 2; |
| 27 private static final String SELECT_URL = UrlUtils.encodeHtmlDataUri( | 23 private static final String SELECT_URL = UrlUtils.encodeHtmlDataUri( |
| 28 "<html><body>" + | 24 "<html><body>" + |
| 29 "Which animal is the strongest:<br/>" + | 25 "Which animal is the strongest:<br/>" + |
| 30 "<select id=\"select\">" + | 26 "<select id=\"select\">" + |
| 31 "<option>Black bear</option>" + | 27 "<option>Black bear</option>" + |
| 32 "<option>Polar bear</option>" + | 28 "<option>Polar bear</option>" + |
| 33 "<option>Grizzly</option>" + | 29 "<option>Grizzly</option>" + |
| 34 "<option>Tiger</option>" + | 30 "<option>Tiger</option>" + |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // Once clicked, the popup should show up. | 66 // Once clicked, the popup should show up. |
| 71 DOMUtils.clickNode(this, view, viewClient, "select"); | 67 DOMUtils.clickNode(this, view, viewClient, "select"); |
| 72 assertTrue("The select popup did not show up on click.", | 68 assertTrue("The select popup did not show up on click.", |
| 73 CriteriaHelper.pollForCriteria(new PopupShowingCriteria())); | 69 CriteriaHelper.pollForCriteria(new PopupShowingCriteria())); |
| 74 | 70 |
| 75 // Now create and destroy a different ContentView. | 71 // Now create and destroy a different ContentView. |
| 76 UiUtils.runOnUiThread(getActivity(), new Runnable() { | 72 UiUtils.runOnUiThread(getActivity(), new Runnable() { |
| 77 @Override | 73 @Override |
| 78 public void run() { | 74 public void run() { |
| 79 int nativeWebContents = ContentViewUtil.createNativeWebContents(
false); | 75 int nativeWebContents = ContentViewUtil.createNativeWebContents(
false); |
| 80 WindowAndroid windowAndroid = new WindowAndroid(getActivity()); | 76 WindowAndroid windowAndroid = new ActivityWindowAndroid(getActiv
ity()); |
| 81 ContentView contentView = ContentView.newInstance( | 77 ContentView contentView = ContentView.newInstance( |
| 82 getActivity(), nativeWebContents, windowAndroid); | 78 getActivity(), nativeWebContents, windowAndroid); |
| 83 contentView.destroy(); | 79 contentView.destroy(); |
| 84 } | 80 } |
| 85 }); | 81 }); |
| 86 | 82 |
| 87 // Process some more events to give a chance to the dialog to hide if it
were to. | 83 // Process some more events to give a chance to the dialog to hide if it
were to. |
| 88 getInstrumentation().waitForIdleSync(); | 84 getInstrumentation().waitForIdleSync(); |
| 89 | 85 |
| 90 // The popup should still be shown. | 86 // The popup should still be shown. |
| 91 assertNotNull("The select popup got hidden by destroying of unrelated Co
ntentViewCore.", | 87 assertNotNull("The select popup got hidden by destroying of unrelated Co
ntentViewCore.", |
| 92 SelectPopupDialog.getCurrent()); | 88 SelectPopupDialog.getCurrent()); |
| 93 } | 89 } |
| 94 } | 90 } |
| OLD | NEW |