diff options
author | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-31 14:47:25 +0000 |
---|---|---|
committer | mnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-31 14:47:25 +0000 |
commit | 55cc34ef3dfeb7f61efd0f1e8d433802d6d2b236 (patch) | |
tree | 71bbfd3b0abbf0e2b7daca0d1935b683b0ca71ef /android_webview | |
parent | f939e7f0edaa50c61091d8c1e79f5ebfbaaac528 (diff) | |
download | chromium_src-55cc34ef3dfeb7f61efd0f1e8d433802d6d2b236.zip chromium_src-55cc34ef3dfeb7f61efd0f1e8d433802d6d2b236.tar.gz chromium_src-55cc34ef3dfeb7f61efd0f1e8d433802d6d2b236.tar.bz2 |
[Android] Refactor AndroidWebViewTestBase.
- Move getTitleOnUiThread into AndroidWebViewTestBase;
- add incognito mode flag to createAwTestContainerViewOnMainSync;
Review URL: https://chromiumcodereview.appspot.com/10908014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
2 files changed, 18 insertions, 11 deletions
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewLoadUrlTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewLoadUrlTest.java index 900c025..e2594d1 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewLoadUrlTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewLoadUrlTest.java @@ -19,16 +19,6 @@ import java.util.concurrent.Callable; * Test suite for loadUrl(). */ public class AndroidWebViewLoadUrlTest extends AndroidWebViewTestBase { - - private String getTitleOnUiThread(final ContentViewCore contentViewCore) throws Throwable { - return runTestOnUiThreadAndGetResult(new Callable<String>() { - @Override - public String call() throws Exception { - return contentViewCore.getTitle(); - } - }); - } - @SmallTest @Feature({"Android-WebView"}) public void testDataUrl() throws Throwable { diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestBase.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestBase.java index d375b32..906204b 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestBase.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidWebViewTestBase.java @@ -35,6 +35,8 @@ import java.util.concurrent.TimeoutException; public class AndroidWebViewTestBase extends ActivityInstrumentationTestCase2<AndroidWebViewTestRunnerActivity> { protected static int WAIT_TIMEOUT_SECONDS = 15; + protected static final boolean NORMAL_VIEW = false; + protected static final boolean INCOGNITO_VIEW = true; public AndroidWebViewTestBase() { super(AndroidWebViewTestRunnerActivity.class); @@ -149,15 +151,30 @@ public class AndroidWebViewTestBase protected AwTestContainerView createAwTestContainerViewOnMainSync( final AwContentsClient client) throws Exception { + return createAwTestContainerViewOnMainSync(NORMAL_VIEW, client); + } + + protected AwTestContainerView createAwTestContainerViewOnMainSync( + final boolean incognito, + final AwContentsClient client) throws Exception { final AtomicReference<AwTestContainerView> testContainerView = new AtomicReference<AwTestContainerView>(); final Context context = getActivity(); getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { - testContainerView.set(createAwTestContainerView(false, client)); + testContainerView.set(createAwTestContainerView(incognito, client)); } }); return testContainerView.get(); } + + protected String getTitleOnUiThread(final ContentViewCore contentViewCore) throws Throwable { + return runTestOnUiThreadAndGetResult(new Callable<String>() { + @Override + public String call() throws Exception { + return contentViewCore.getTitle(); + } + }); + } } |