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; | 7 import android.test.suitebuilder.annotation.LargeTest; |
8 | 8 |
9 import org.chromium.base.test.util.DisabledTest; | 9 import org.chromium.base.test.util.DisabledTest; |
10 import org.chromium.base.test.util.Feature; | 10 import org.chromium.base.test.util.Feature; |
11 import org.chromium.base.test.util.UrlUtils; | 11 import org.chromium.base.test.util.UrlUtils; |
12 import org.chromium.content.browser.ContentView; | 12 import org.chromium.content.browser.ContentView; |
13 import org.chromium.content.browser.input.SelectPopupDialog; | 13 import org.chromium.content.browser.input.SelectPopupDialog; |
14 import org.chromium.content.browser.test.util.Criteria; | 14 import org.chromium.content.browser.test.util.Criteria; |
15 import org.chromium.content.browser.test.util.CriteriaHelper; | 15 import org.chromium.content.browser.test.util.CriteriaHelper; |
16 import org.chromium.content.browser.test.util.DOMUtils; | 16 import org.chromium.content.browser.test.util.DOMUtils; |
17 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; | 17 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; |
18 import org.chromium.content.browser.test.util.UiUtils; | 18 import org.chromium.content.browser.test.util.UiUtils; |
19 import org.chromium.chrome.browser.ContentViewUtil; | 19 import org.chromium.chrome.browser.ContentViewUtil; |
20 import org.chromium.chrome.testshell.ChromiumTestShellTestBase; | 20 import org.chromium.chrome.testshell.ChromiumTestShellTestBase; |
21 import org.chromium.ui.gfx.ActivityNativeWindow; | 21 import org.chromium.ui.WindowAndroid; |
22 | 22 |
23 import java.util.concurrent.TimeUnit; | 23 import java.util.concurrent.TimeUnit; |
24 | 24 |
25 public class SelectPopupOtherContentViewTest extends ChromiumTestShellTestBase { | 25 public class SelectPopupOtherContentViewTest extends ChromiumTestShellTestBase { |
26 private static final int WAIT_TIMEOUT_SECONDS = 2; | 26 private static final int WAIT_TIMEOUT_SECONDS = 2; |
27 private static final String SELECT_URL = UrlUtils.encodeHtmlDataUri( | 27 private static final String SELECT_URL = UrlUtils.encodeHtmlDataUri( |
28 "<html><body>" + | 28 "<html><body>" + |
29 "Which animal is the strongest:<br/>" + | 29 "Which animal is the strongest:<br/>" + |
30 "<select id=\"select\">" + | 30 "<select id=\"select\">" + |
31 "<option>Black bear</option>" + | 31 "<option>Black bear</option>" + |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Once clicked, the popup should show up. | 70 // Once clicked, the popup should show up. |
71 DOMUtils.clickNode(this, view, viewClient, "select"); | 71 DOMUtils.clickNode(this, view, viewClient, "select"); |
72 assertTrue("The select popup did not show up on click.", | 72 assertTrue("The select popup did not show up on click.", |
73 CriteriaHelper.pollForCriteria(new PopupShowingCriteria())); | 73 CriteriaHelper.pollForCriteria(new PopupShowingCriteria())); |
74 | 74 |
75 // Now create and destroy a different ContentView. | 75 // Now create and destroy a different ContentView. |
76 UiUtils.runOnUiThread(getActivity(), new Runnable() { | 76 UiUtils.runOnUiThread(getActivity(), new Runnable() { |
77 @Override | 77 @Override |
78 public void run() { | 78 public void run() { |
79 int nativeWebContents = ContentViewUtil.createNativeWebContents(
false); | 79 int nativeWebContents = ContentViewUtil.createNativeWebContents(
false); |
80 ActivityNativeWindow nativeWindow = new ActivityNativeWindow(get
Activity()); | 80 WindowAndroid nativeWindow = new WindowAndroid(getActivity()); |
81 ContentView contentView = ContentView.newInstance( | 81 ContentView contentView = ContentView.newInstance( |
82 getActivity(), nativeWebContents, | 82 getActivity(), nativeWebContents, |
83 nativeWindow, ContentView.PERSONALITY_CHROME); | 83 nativeWindow, ContentView.PERSONALITY_CHROME); |
84 contentView.destroy(); | 84 contentView.destroy(); |
85 } | 85 } |
86 }); | 86 }); |
87 | 87 |
88 // Process some more events to give a chance to the dialog to hide if it
were to. | 88 // Process some more events to give a chance to the dialog to hide if it
were to. |
89 getInstrumentation().waitForIdleSync(); | 89 getInstrumentation().waitForIdleSync(); |
90 | 90 |
91 // The popup should still be shown. | 91 // The popup should still be shown. |
92 assertNotNull("The select popup got hidden by destroying of unrelated Co
ntentViewCore.", | 92 assertNotNull("The select popup got hidden by destroying of unrelated Co
ntentViewCore.", |
93 SelectPopupDialog.getCurrent()); | 93 SelectPopupDialog.getCurrent()); |
94 } | 94 } |
95 } | 95 } |
OLD | NEW |