OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.content_shell_apk; | 5 package org.chromium.content_shell_apk; |
6 | 6 |
7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
8 | 8 |
9 import android.annotation.TargetApi; | 9 import android.annotation.TargetApi; |
10 import android.app.Activity; | 10 import android.app.Activity; |
(...skipping 14 matching lines...) Expand all Loading... |
25 import org.chromium.base.test.util.UrlUtils; | 25 import org.chromium.base.test.util.UrlUtils; |
26 import org.chromium.content.browser.ContentView; | 26 import org.chromium.content.browser.ContentView; |
27 import org.chromium.content.browser.ContentViewCore; | 27 import org.chromium.content.browser.ContentViewCore; |
28 import org.chromium.content.browser.test.util.Criteria; | 28 import org.chromium.content.browser.test.util.Criteria; |
29 import org.chromium.content.browser.test.util.CriteriaHelper; | 29 import org.chromium.content.browser.test.util.CriteriaHelper; |
30 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; | 30 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; |
31 import org.chromium.content_public.browser.LoadUrlParams; | 31 import org.chromium.content_public.browser.LoadUrlParams; |
32 import org.chromium.content_public.browser.NavigationController; | 32 import org.chromium.content_public.browser.NavigationController; |
33 import org.chromium.content_public.browser.WebContents; | 33 import org.chromium.content_public.browser.WebContents; |
34 import org.chromium.content_shell.Shell; | 34 import org.chromium.content_shell.Shell; |
| 35 import org.chromium.content_shell.ShellViewAndroidDelegate.OnCursorUpdateHelper; |
35 | 36 |
36 import java.util.concurrent.Callable; | 37 import java.util.concurrent.Callable; |
37 import java.util.concurrent.ExecutionException; | 38 import java.util.concurrent.ExecutionException; |
38 import java.util.concurrent.TimeUnit; | 39 import java.util.concurrent.TimeUnit; |
39 | 40 |
40 /** | 41 /** |
41 * Implementation of utility methods for ContentShellTestBase and ContentShellAc
tivityTestRule to | 42 * Implementation of utility methods for ContentShellTestBase and ContentShellAc
tivityTestRule to |
42 * wrap around during instrumentation test JUnit3 to JUnit4 migration | 43 * wrap around during instrumentation test JUnit3 to JUnit4 migration |
43 * | 44 * |
44 * Please do not use this class' methods in places other than {@link ContentShel
lTestBase} | 45 * Please do not use this class' methods in places other than {@link ContentShel
lTestBase} |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (TextUtils.isEmpty( | 112 if (TextUtils.isEmpty( |
112 shell.getContentViewCore().getWebContents().getLastC
ommittedUrl())) { | 113 shell.getContentViewCore().getWebContents().getLastC
ommittedUrl())) { |
113 updateFailureReason("Shell's URL is empty or null."); | 114 updateFailureReason("Shell's URL is empty or null."); |
114 return false; | 115 return false; |
115 } | 116 } |
116 return true; | 117 return true; |
117 } | 118 } |
118 }, WAIT_FOR_ACTIVE_SHELL_LOADING_TIMEOUT, CriteriaHelper.DEFAULT_POLLING
_INTERVAL); | 119 }, WAIT_FOR_ACTIVE_SHELL_LOADING_TIMEOUT, CriteriaHelper.DEFAULT_POLLING
_INTERVAL); |
119 } | 120 } |
120 | 121 |
| 122 OnCursorUpdateHelper getOnCursorUpdateHelper() throws ExecutionException { |
| 123 return ThreadUtils.runOnUiThreadBlocking(new Callable<OnCursorUpdateHelp
er>() { |
| 124 @Override |
| 125 public OnCursorUpdateHelper call() { |
| 126 return mCallback.getActivityForTestCommon() |
| 127 .getActiveShell() |
| 128 .getViewAndroidDelegate() |
| 129 .getOnCursorUpdateHelper(); |
| 130 } |
| 131 }); |
| 132 } |
| 133 |
121 ContentViewCore getContentViewCore() { | 134 ContentViewCore getContentViewCore() { |
122 return mCallback.getActivityForTestCommon().getActiveShell().getContentV
iewCore(); | 135 return mCallback.getActivityForTestCommon().getActiveShell().getContentV
iewCore(); |
123 } | 136 } |
124 | 137 |
125 WebContents getWebContents() { | 138 WebContents getWebContents() { |
126 return mCallback.getActivityForTestCommon().getActiveShell().getWebConte
nts(); | 139 return mCallback.getActivityForTestCommon().getActiveShell().getWebConte
nts(); |
127 } | 140 } |
128 | 141 |
129 void loadUrl(final NavigationController navigationController, | 142 void loadUrl(final NavigationController navigationController, |
130 TestCallbackHelperContainer callbackHelperContainer, final LoadUrlPa
rams params) | 143 TestCallbackHelperContainer callbackHelperContainer, final LoadUrlPa
rams params) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 Instrumentation getInstrumentationForTestCommon(); | 206 Instrumentation getInstrumentationForTestCommon(); |
194 T launchActivityWithIntentForTestCommon(Intent t); | 207 T launchActivityWithIntentForTestCommon(Intent t); |
195 T getActivityForTestCommon(); | 208 T getActivityForTestCommon(); |
196 void runOnUiThreadForTestCommon(Runnable runnable) throws Throwable; | 209 void runOnUiThreadForTestCommon(Runnable runnable) throws Throwable; |
197 ContentViewCore getContentViewCoreForTestCommon(); | 210 ContentViewCore getContentViewCoreForTestCommon(); |
198 ContentShellActivity launchContentShellWithUrlForTestCommon(String url); | 211 ContentShellActivity launchContentShellWithUrlForTestCommon(String url); |
199 WebContents getWebContentsForTestCommon(); | 212 WebContents getWebContentsForTestCommon(); |
200 void waitForActiveShellToBeDoneLoadingForTestCommon(); | 213 void waitForActiveShellToBeDoneLoadingForTestCommon(); |
201 } | 214 } |
202 } | 215 } |
OLD | NEW |