diff options
author | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-29 22:38:15 +0000 |
---|---|---|
committer | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-29 22:38:15 +0000 |
commit | 08085eb8978a9d317f28bc144658aa01b0d4f9be (patch) | |
tree | cce383a6533a4a3ffeac48abf9f222c901f797f8 | |
parent | c7d9b35982ebc5ae46c553f0569f45cfe29f7b86 (diff) | |
download | chromium_src-08085eb8978a9d317f28bc144658aa01b0d4f9be.zip chromium_src-08085eb8978a9d317f28bc144658aa01b0d4f9be.tar.gz chromium_src-08085eb8978a9d317f28bc144658aa01b0d4f9be.tar.bz2 |
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
7 files changed, 15 insertions, 32 deletions
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java index 8fdd89a..e57d34f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/NavigationPopupTest.java @@ -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() { diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillDialogControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillDialogControllerTest.java index 20bd852..34d21e1 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillDialogControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillDialogControllerTest.java @@ -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")); diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java index 136c107..8abd24a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupTest.java @@ -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")); diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java index 008955f..b7c097a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java @@ -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 diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/test/ModalDialogTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/test/ModalDialogTest.java index 3eaaec2..bb2b608 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/test/ModalDialogTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/test/ModalDialogTest.java @@ -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)); diff --git a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java index cf919db..a0f37ba 100644 --- a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java +++ b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellActivity.java @@ -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; @@ -251,14 +250,6 @@ public class ChromeShellActivity extends Activity implements AppMenuPropertiesDe } /** - * @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. */ public ContentViewCore getActiveContentViewCore() { diff --git a/chrome/android/shell/javatests/src/org/chromium/chrome/shell/ChromeShellUrlTest.java b/chrome/android/shell/javatests/src/org/chromium/chrome/shell/ChromeShellUrlTest.java index 62ab37f..a7be42a 100644 --- a/chrome/android/shell/javatests/src/org/chromium/chrome/shell/ChromeShellUrlTest.java +++ b/chrome/android/shell/javatests/src/org/chromium/chrome/shell/ChromeShellUrlTest.java @@ -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 +} |