ContentView->ContentViewCore.getContainerView in chrome/ tests

Many places that don't need ContentView proper and just need the View
managed by ContentViewCore.
BUG=360664
NOTRY=true

Review URL: https://codereview.chromium.org/251443004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266979 0039d316-1c4b-4281-b951-d872f2087c98
parent c7d9b359
...@@ -84,7 +84,7 @@ public class NavigationPopupTest extends ChromeShellTestBase { ...@@ -84,7 +84,7 @@ public class NavigationPopupTest extends ChromeShellTestBase {
final NavigationPopup popup = new NavigationPopup( final NavigationPopup popup = new NavigationPopup(
mActivity, client, true); mActivity, client, true);
popup.setWidth(300); popup.setWidth(300);
popup.setAnchorView(mActivity.getActiveContentView()); popup.setAnchorView(mActivity.getActiveContentViewCore().getContainerView());
ThreadUtils.runOnUiThreadBlocking(new Runnable() { ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override @Override
public void run() { public void run() {
...@@ -128,7 +128,7 @@ public class NavigationPopupTest extends ChromeShellTestBase { ...@@ -128,7 +128,7 @@ public class NavigationPopupTest extends ChromeShellTestBase {
final NavigationPopup popup = new NavigationPopup( final NavigationPopup popup = new NavigationPopup(
mActivity, client, true); mActivity, client, true);
popup.setWidth(300); popup.setWidth(300);
popup.setAnchorView(mActivity.getActiveContentView()); popup.setAnchorView(mActivity.getActiveContentViewCore().getContainerView());
ThreadUtils.runOnUiThreadBlocking(new Runnable() { ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override @Override
public void run() { public void run() {
......
...@@ -12,7 +12,6 @@ import org.chromium.base.CommandLine; ...@@ -12,7 +12,6 @@ import org.chromium.base.CommandLine;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils; import org.chromium.base.test.util.UrlUtils;
import org.chromium.chrome.shell.ChromeShellTestBase; import org.chromium.chrome.shell.ChromeShellTestBase;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.test.util.Criteria; import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper; import org.chromium.content.browser.test.util.CriteriaHelper;
...@@ -501,13 +500,13 @@ public class AutofillDialogControllerTest extends ChromeShellTestBase { ...@@ -501,13 +500,13 @@ public class AutofillDialogControllerTest extends ChromeShellTestBase {
setUpAndRequestAutocomplete(url, requestFullBilling, requestShipping, requestPhoneNumbers); setUpAndRequestAutocomplete(url, requestFullBilling, requestShipping, requestPhoneNumbers);
ContentView view = getActivity().getActiveContentView(); final ContentViewCore viewCore = getActivity().getActiveContentViewCore();
assertEquals(actualId + " did not match", assertEquals(actualId + " did not match",
expected, DOMUtils.getNodeValue(view.getContentViewCore(), actualId)); expected, DOMUtils.getNodeValue(viewCore, actualId));
if (requestCcInfo) { if (requestCcInfo) {
assertEquals("cc-csc did not match", assertEquals("cc-csc did not match",
TEST_CC_CSC, DOMUtils.getNodeValue(view.getContentViewCore(), "id-opt-cc-csc")); TEST_CC_CSC, DOMUtils.getNodeValue(viewCore, "id-opt-cc-csc"));
} }
} }
...@@ -518,8 +517,7 @@ public class AutofillDialogControllerTest extends ChromeShellTestBase { ...@@ -518,8 +517,7 @@ public class AutofillDialogControllerTest extends ChromeShellTestBase {
generatePage(requestFullBilling, requestShipping, requestPhoneNumbers), generatePage(requestFullBilling, requestShipping, requestPhoneNumbers),
requestFullBilling, requestShipping, requestPhoneNumbers); requestFullBilling, requestShipping, requestPhoneNumbers);
final ContentView view = getActivity().getActiveContentView(); final ContentViewCore viewCore = getActivity().getActiveContentViewCore();
final ContentViewCore viewCore = view.getContentViewCore();
assertEquals("billing name did not match", assertEquals("billing name did not match",
TEST_NAME, DOMUtils.getNodeValue(viewCore, "id-billing-name")); TEST_NAME, DOMUtils.getNodeValue(viewCore, "id-billing-name"));
......
...@@ -185,7 +185,7 @@ public class AutofillPopupTest extends ChromeShellTestBase { ...@@ -185,7 +185,7 @@ public class AutofillPopupTest extends ChromeShellTestBase {
public void testClickAutofillPopupSuggestion() public void testClickAutofillPopupSuggestion()
throws InterruptedException, ExecutionException, TimeoutException { throws InterruptedException, ExecutionException, TimeoutException {
loadAndFillForm(BASIC_PAGE_DATA, "J"); loadAndFillForm(BASIC_PAGE_DATA, "J");
final ContentViewCore viewCore = getActivity().getActiveContentView().getContentViewCore(); final ContentViewCore viewCore = getActivity().getActiveContentViewCore();
assertEquals("First name did not match", assertEquals("First name did not match",
FIRST_NAME, DOMUtils.getNodeValue(viewCore, "fn")); FIRST_NAME, DOMUtils.getNodeValue(viewCore, "fn"));
......
...@@ -44,7 +44,7 @@ public class AutofillTest extends ChromeShellTestBase { ...@@ -44,7 +44,7 @@ public class AutofillTest extends ChromeShellTestBase {
mMockAutofillCallback = new MockAutofillCallback(); mMockAutofillCallback = new MockAutofillCallback();
mWindowAndroid = new ActivityWindowAndroid(activity); mWindowAndroid = new ActivityWindowAndroid(activity);
final ViewAndroidDelegate viewDelegate = final ViewAndroidDelegate viewDelegate =
activity.getActiveContentView().getContentViewCore().getViewAndroidDelegate(); activity.getActiveContentViewCore().getViewAndroidDelegate();
UiUtils.runOnUiThread(getActivity(), new Runnable() { UiUtils.runOnUiThread(getActivity(), new Runnable() {
@Override @Override
......
...@@ -266,7 +266,7 @@ public class ModalDialogTest extends ChromeShellTestBase { ...@@ -266,7 +266,7 @@ public class ModalDialogTest extends ChromeShellTestBase {
clickCancel(jsDialog); clickCancel(jsDialog);
scriptEvent.waitUntilHasValue(); scriptEvent.waitUntilHasValue();
scriptEvent.evaluateJavaScript(getActivity().getActiveContentView().getContentViewCore(), scriptEvent.evaluateJavaScript(getActivity().getActiveContentViewCore(),
"alert('Android');"); "alert('Android');");
assertTrue("No further dialog boxes should be shown.", scriptEvent.waitUntilHasValue()); assertTrue("No further dialog boxes should be shown.", scriptEvent.waitUntilHasValue());
} }
...@@ -316,7 +316,7 @@ public class ModalDialogTest extends ChromeShellTestBase { ...@@ -316,7 +316,7 @@ public class ModalDialogTest extends ChromeShellTestBase {
private OnEvaluateJavaScriptResultHelper executeJavaScriptAndWaitForDialog( private OnEvaluateJavaScriptResultHelper executeJavaScriptAndWaitForDialog(
final OnEvaluateJavaScriptResultHelper helper, String script) final OnEvaluateJavaScriptResultHelper helper, String script)
throws InterruptedException { throws InterruptedException {
helper.evaluateJavaScript(getActivity().getActiveContentView().getContentViewCore(), helper.evaluateJavaScript(getActivity().getActiveContentViewCore(),
script); script);
boolean criteriaSatisfied = CriteriaHelper.pollForCriteria( boolean criteriaSatisfied = CriteriaHelper.pollForCriteria(
new JavascriptAppModalDialogShownCriteria(true)); new JavascriptAppModalDialogShownCriteria(true));
......
...@@ -32,7 +32,6 @@ import org.chromium.chrome.shell.sync.SyncController; ...@@ -32,7 +32,6 @@ import org.chromium.chrome.shell.sync.SyncController;
import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
import org.chromium.content.browser.ActivityContentVideoViewClient; import org.chromium.content.browser.ActivityContentVideoViewClient;
import org.chromium.content.browser.BrowserStartupController; import org.chromium.content.browser.BrowserStartupController;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.DeviceUtils; import org.chromium.content.browser.DeviceUtils;
import org.chromium.content.common.ContentSwitches; import org.chromium.content.common.ContentSwitches;
...@@ -250,14 +249,6 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe ...@@ -250,14 +249,6 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe
return mTabManager != null ? mTabManager.getCurrentTab() : null; return mTabManager != null ? mTabManager.getCurrentTab() : null;
} }
/**
* @return The ContentView of the active tab.
*/
public ContentView getActiveContentView() {
ChromeShellTab tab = getActiveTab();
return tab != null ? tab.getContentView() : null;
}
/** /**
* @return The ContentViewCore of the active tab. * @return The ContentViewCore of the active tab.
*/ */
......
...@@ -8,7 +8,6 @@ import android.test.suitebuilder.annotation.SmallTest; ...@@ -8,7 +8,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewCore; import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.ContentViewRenderView; import org.chromium.content.browser.ContentViewRenderView;
...@@ -43,22 +42,17 @@ public class ChromeShellUrlTest extends ChromeShellTestBase { ...@@ -43,22 +42,17 @@ public class ChromeShellUrlTest extends ChromeShellTestBase {
// Make sure the activity was created as expected. // Make sure the activity was created as expected.
assertNotNull(activity); assertNotNull(activity);
// Ensure we have a ContentView and ContentViewCore. // Ensure we have a valid ContentViewCore.
final AtomicReference<ContentView> contentView = new AtomicReference<ContentView>();
final AtomicReference<ContentViewCore> contentViewCore = final AtomicReference<ContentViewCore> contentViewCore =
new AtomicReference<ContentViewCore>(); new AtomicReference<ContentViewCore>();
ThreadUtils.runOnUiThreadBlocking(new Runnable() { ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override @Override
public void run() { public void run() {
ContentView activeContentView = activity.getActiveContentView(); contentViewCore.set(activity.getActiveContentViewCore());
contentView.set(activeContentView);
if (activeContentView != null) {
contentViewCore.set(activeContentView.getContentViewCore());
}
} }
}); });
assertNotNull(contentView.get());
assertNotNull(contentViewCore.get()); assertNotNull(contentViewCore.get());
assertNotNull(contentViewCore.get().getContainerView());
// Ensure the correct page has been loaded, ie. not interstitial, and title/url should // Ensure the correct page has been loaded, ie. not interstitial, and title/url should
// be sane. Note, a typical correct title is: "Welcome to Chromium", whereas a wrong one // be sane. Note, a typical correct title is: "Welcome to Chromium", whereas a wrong one
...@@ -105,7 +99,7 @@ public class ChromeShellUrlTest extends ChromeShellTestBase { ...@@ -105,7 +99,7 @@ public class ChromeShellUrlTest extends ChromeShellTestBase {
new ContentViewRenderView(getInstrumentation().getTargetContext(), new ContentViewRenderView(getInstrumentation().getTargetContext(),
activity.getWindowAndroid()); activity.getWindowAndroid());
contentViewRenderView.setCurrentContentViewCore( contentViewRenderView.setCurrentContentViewCore(
activity.getActiveContentView().getContentViewCore()); activity.getActiveContentViewCore());
} }
}); });
} catch (Throwable e) { } catch (Throwable e) {
......
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