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 {
final NavigationPopup popup = new NavigationPopup(
mActivity, client, true);
popup.setWidth(300);
popup.setAnchorView(mActivity.getActiveContentView());
popup.setAnchorView(mActivity.getActiveContentViewCore().getContainerView());
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
......@@ -128,7 +128,7 @@ public class NavigationPopupTest extends ChromeShellTestBase {
final NavigationPopup popup = new NavigationPopup(
mActivity, client, true);
popup.setWidth(300);
popup.setAnchorView(mActivity.getActiveContentView());
popup.setAnchorView(mActivity.getActiveContentViewCore().getContainerView());
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
......
......@@ -12,7 +12,6 @@ import org.chromium.base.CommandLine;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils;
import org.chromium.chrome.shell.ChromeShellTestBase;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
......@@ -501,13 +500,13 @@ public class AutofillDialogControllerTest extends ChromeShellTestBase {
setUpAndRequestAutocomplete(url, requestFullBilling, requestShipping, requestPhoneNumbers);
ContentView view = getActivity().getActiveContentView();
final ContentViewCore viewCore = getActivity().getActiveContentViewCore();
assertEquals(actualId + " did not match",
expected, DOMUtils.getNodeValue(view.getContentViewCore(), actualId));
expected, DOMUtils.getNodeValue(viewCore, actualId));
if (requestCcInfo) {
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 {
generatePage(requestFullBilling, requestShipping, requestPhoneNumbers),
requestFullBilling, requestShipping, requestPhoneNumbers);
final ContentView view = getActivity().getActiveContentView();
final ContentViewCore viewCore = view.getContentViewCore();
final ContentViewCore viewCore = getActivity().getActiveContentViewCore();
assertEquals("billing name did not match",
TEST_NAME, DOMUtils.getNodeValue(viewCore, "id-billing-name"));
......
......@@ -185,7 +185,7 @@ public class AutofillPopupTest extends ChromeShellTestBase {
public void testClickAutofillPopupSuggestion()
throws InterruptedException, ExecutionException, TimeoutException {
loadAndFillForm(BASIC_PAGE_DATA, "J");
final ContentViewCore viewCore = getActivity().getActiveContentView().getContentViewCore();
final ContentViewCore viewCore = getActivity().getActiveContentViewCore();
assertEquals("First name did not match",
FIRST_NAME, DOMUtils.getNodeValue(viewCore, "fn"));
......
......@@ -44,7 +44,7 @@ public class AutofillTest extends ChromeShellTestBase {
mMockAutofillCallback = new MockAutofillCallback();
mWindowAndroid = new ActivityWindowAndroid(activity);
final ViewAndroidDelegate viewDelegate =
activity.getActiveContentView().getContentViewCore().getViewAndroidDelegate();
activity.getActiveContentViewCore().getViewAndroidDelegate();
UiUtils.runOnUiThread(getActivity(), new Runnable() {
@Override
......
......@@ -266,7 +266,7 @@ public class ModalDialogTest extends ChromeShellTestBase {
clickCancel(jsDialog);
scriptEvent.waitUntilHasValue();
scriptEvent.evaluateJavaScript(getActivity().getActiveContentView().getContentViewCore(),
scriptEvent.evaluateJavaScript(getActivity().getActiveContentViewCore(),
"alert('Android');");
assertTrue("No further dialog boxes should be shown.", scriptEvent.waitUntilHasValue());
}
......@@ -316,7 +316,7 @@ public class ModalDialogTest extends ChromeShellTestBase {
private OnEvaluateJavaScriptResultHelper executeJavaScriptAndWaitForDialog(
final OnEvaluateJavaScriptResultHelper helper, String script)
throws InterruptedException {
helper.evaluateJavaScript(getActivity().getActiveContentView().getContentViewCore(),
helper.evaluateJavaScript(getActivity().getActiveContentViewCore(),
script);
boolean criteriaSatisfied = CriteriaHelper.pollForCriteria(
new JavascriptAppModalDialogShownCriteria(true));
......
......@@ -32,7 +32,6 @@ import org.chromium.chrome.shell.sync.SyncController;
import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils;
import org.chromium.content.browser.ActivityContentVideoViewClient;
import org.chromium.content.browser.BrowserStartupController;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.DeviceUtils;
import org.chromium.content.common.ContentSwitches;
......@@ -250,14 +249,6 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe
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.
*/
......
......@@ -8,7 +8,6 @@ import android.test.suitebuilder.annotation.SmallTest;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.ContentViewRenderView;
......@@ -43,22 +42,17 @@ public class ChromeShellUrlTest extends ChromeShellTestBase {
// Make sure the activity was created as expected.
assertNotNull(activity);
// Ensure we have a ContentView and ContentViewCore.
final AtomicReference<ContentView> contentView = new AtomicReference<ContentView>();
// Ensure we have a valid ContentViewCore.
final AtomicReference<ContentViewCore> contentViewCore =
new AtomicReference<ContentViewCore>();
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
ContentView activeContentView = activity.getActiveContentView();
contentView.set(activeContentView);
if (activeContentView != null) {
contentViewCore.set(activeContentView.getContentViewCore());
}
contentViewCore.set(activity.getActiveContentViewCore());
}
});
assertNotNull(contentView.get());
assertNotNull(contentViewCore.get());
assertNotNull(contentViewCore.get().getContainerView());
// 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
......@@ -105,11 +99,11 @@ public class ChromeShellUrlTest extends ChromeShellTestBase {
new ContentViewRenderView(getInstrumentation().getTargetContext(),
activity.getWindowAndroid());
contentViewRenderView.setCurrentContentViewCore(
activity.getActiveContentView().getContentViewCore());
activity.getActiveContentViewCore());
}
});
} catch (Throwable e) {
fail("Could not create a ContentViewRenderView: " + e);
}
}
}
\ No newline at end of file
}
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