Remove incognito parameter from AwContents

It is always false and not planned to be supported

BUG=


Review URL: https://chromiumcodereview.appspot.com/11785011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175887 0039d316-1c4b-4281-b951-d872f2087c98
parent fef31643
...@@ -262,18 +262,27 @@ public class AwContents { ...@@ -262,18 +262,27 @@ public class AwContents {
} }
} }
// TODO(kristianm): Delete this when privateBrowsing parameter is removed in Android
public AwContents(ViewGroup containerView,
ContentViewCore.InternalAccessDelegate internalAccessAdapter,
AwContentsClient contentsClient,
NativeWindow nativeWindow, boolean privateBrowsing,
boolean isAccessFromFileURLsGrantedByDefault) {
this(containerView, internalAccessAdapter, contentsClient, nativeWindow,
isAccessFromFileURLsGrantedByDefault);
}
/** /**
* @param containerView the view-hierarchy item this object will be bound to. * @param containerView the view-hierarchy item this object will be bound to.
* @param internalAccessAdapter to access private methods on containerView. * @param internalAccessAdapter to access private methods on containerView.
* @param contentsClient will receive API callbacks from this WebView Contents * @param contentsClient will receive API callbacks from this WebView Contents
* @param privateBrowsing whether this is a private browsing instance of WebView.
* @param isAccessFromFileURLsGrantedByDefault passed to ContentViewCore.initialize. * @param isAccessFromFileURLsGrantedByDefault passed to ContentViewCore.initialize.
* TODO(benm): Remove the nativeWindow parameter. * TODO(benm): Remove the nativeWindow parameter.
*/ */
public AwContents(ViewGroup containerView, public AwContents(ViewGroup containerView,
ContentViewCore.InternalAccessDelegate internalAccessAdapter, ContentViewCore.InternalAccessDelegate internalAccessAdapter,
AwContentsClient contentsClient, AwContentsClient contentsClient,
NativeWindow nativeWindow, boolean privateBrowsing, NativeWindow nativeWindow,
boolean isAccessFromFileURLsGrantedByDefault) { boolean isAccessFromFileURLsGrantedByDefault) {
mContainerView = containerView; mContainerView = containerView;
mInternalAccessAdapter = internalAccessAdapter; mInternalAccessAdapter = internalAccessAdapter;
...@@ -281,7 +290,7 @@ public class AwContents { ...@@ -281,7 +290,7 @@ public class AwContents {
// setup performs process initialisation work needed by AwContents. // setup performs process initialisation work needed by AwContents.
mContentViewCore = new ContentViewCore(containerView.getContext(), mContentViewCore = new ContentViewCore(containerView.getContext(),
ContentViewCore.PERSONALITY_VIEW); ContentViewCore.PERSONALITY_VIEW);
mNativeAwContents = nativeInit(contentsClient.getWebContentsDelegate(), privateBrowsing); mNativeAwContents = nativeInit(contentsClient.getWebContentsDelegate());
mContentsClient = contentsClient; mContentsClient = contentsClient;
mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNativeAwContents)); mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNativeAwContents));
mClientCallbackHandler = new ClientCallbackHandler(); mClientCallbackHandler = new ClientCallbackHandler();
...@@ -934,8 +943,7 @@ public class AwContents { ...@@ -934,8 +943,7 @@ public class AwContents {
// Native methods // Native methods
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
private native int nativeInit(AwWebContentsDelegate webViewWebContentsDelegate, private native int nativeInit(AwWebContentsDelegate webViewWebContentsDelegate);
boolean privateBrowsing);
private static native void nativeDestroy(int nativeAwContents); private static native void nativeDestroy(int nativeAwContents);
private static native void nativeSetAwDrawSWFunctionTable(int functionTablePointer); private static native void nativeSetAwDrawSWFunctionTable(int functionTablePointer);
private static native int nativeGetAwDrawGLFunction(); private static native int nativeGetAwDrawGLFunction();
......
...@@ -38,8 +38,6 @@ public class AndroidWebViewTestBase ...@@ -38,8 +38,6 @@ public class AndroidWebViewTestBase
extends ActivityInstrumentationTestCase2<AndroidWebViewTestRunnerActivity> { extends ActivityInstrumentationTestCase2<AndroidWebViewTestRunnerActivity> {
protected static int WAIT_TIMEOUT_SECONDS = 15; protected static int WAIT_TIMEOUT_SECONDS = 15;
private static final int CHECK_INTERVAL = 100; private static final int CHECK_INTERVAL = 100;
protected static final boolean NORMAL_VIEW = false;
protected static final boolean INCOGNITO_VIEW = true;
public AndroidWebViewTestBase() { public AndroidWebViewTestBase() {
super(AndroidWebViewTestRunnerActivity.class); super(AndroidWebViewTestRunnerActivity.class);
...@@ -202,19 +200,18 @@ public class AndroidWebViewTestBase ...@@ -202,19 +200,18 @@ public class AndroidWebViewTestBase
}); });
} }
protected AwTestContainerView createAwTestContainerView(final boolean incognito, protected AwTestContainerView createAwTestContainerView(
final AwContentsClient awContentsClient) { final AwContentsClient awContentsClient) {
return createAwTestContainerView(incognito, new AwTestContainerView(getActivity()), return createAwTestContainerView(new AwTestContainerView(getActivity()),
awContentsClient); awContentsClient);
} }
protected AwTestContainerView createAwTestContainerView(final boolean incognito, protected AwTestContainerView createAwTestContainerView(
final AwTestContainerView testContainerView, final AwTestContainerView testContainerView,
final AwContentsClient awContentsClient) { final AwContentsClient awContentsClient) {
testContainerView.initialize(new AwContents(testContainerView, testContainerView.initialize(new AwContents(testContainerView,
testContainerView.getInternalAccessDelegate(), testContainerView.getInternalAccessDelegate(),
awContentsClient, new ActivityNativeWindow(getActivity()), awContentsClient, new ActivityNativeWindow(getActivity()), false));
incognito, false));
getActivity().addView(testContainerView); getActivity().addView(testContainerView);
testContainerView.requestFocus(); testContainerView.requestFocus();
return testContainerView; return testContainerView;
...@@ -222,19 +219,12 @@ public class AndroidWebViewTestBase ...@@ -222,19 +219,12 @@ public class AndroidWebViewTestBase
protected AwTestContainerView createAwTestContainerViewOnMainSync( protected AwTestContainerView createAwTestContainerViewOnMainSync(
final AwContentsClient client) throws Exception { 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 = final AtomicReference<AwTestContainerView> testContainerView =
new AtomicReference<AwTestContainerView>(); new AtomicReference<AwTestContainerView>();
final Context context = getActivity();
getInstrumentation().runOnMainSync(new Runnable() { getInstrumentation().runOnMainSync(new Runnable() {
@Override @Override
public void run() { public void run() {
testContainerView.set(createAwTestContainerView(incognito, client)); testContainerView.set(createAwTestContainerView(client));
} }
}); });
return testContainerView.get(); return testContainerView.get();
......
...@@ -28,6 +28,7 @@ public class ArchiveTest extends AndroidWebViewTestBase { ...@@ -28,6 +28,7 @@ public class ArchiveTest extends AndroidWebViewTestBase {
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
mTestContainerView = createAwTestContainerViewOnMainSync(mContentsClient); mTestContainerView = createAwTestContainerViewOnMainSync(mContentsClient);
} }
......
...@@ -43,7 +43,7 @@ public class AwContentsTest extends AndroidWebViewTestBase { ...@@ -43,7 +43,7 @@ public class AwContentsTest extends AndroidWebViewTestBase {
@UiThreadTest @UiThreadTest
public void testCreateDestroy() throws Throwable { public void testCreateDestroy() throws Throwable {
// NOTE this test runs on UI thread, so we cannot call any async methods. // NOTE this test runs on UI thread, so we cannot call any async methods.
createAwTestContainerView(false, mContentsClient).getAwContents().destroy(); createAwTestContainerView(mContentsClient).getAwContents().destroy();
} }
private int callDocumentHasImagesSync(final AwContents awContents) private int callDocumentHasImagesSync(final AwContents awContents)
...@@ -98,7 +98,7 @@ public class AwContentsTest extends AndroidWebViewTestBase { ...@@ -98,7 +98,7 @@ public class AwContentsTest extends AndroidWebViewTestBase {
public void testClearCacheMemoryAndDisk() throws Throwable { public void testClearCacheMemoryAndDisk() throws Throwable {
final TestAwContentsClient contentClient = new TestAwContentsClient(); final TestAwContentsClient contentClient = new TestAwContentsClient();
final AwTestContainerView testContainer = final AwTestContainerView testContainer =
createAwTestContainerViewOnMainSync(false, contentClient); createAwTestContainerViewOnMainSync(contentClient);
final AwContents awContents = testContainer.getAwContents(); final AwContents awContents = testContainer.getAwContents();
TestWebServer webServer = null; TestWebServer webServer = null;
...@@ -151,7 +151,7 @@ public class AwContentsTest extends AndroidWebViewTestBase { ...@@ -151,7 +151,7 @@ public class AwContentsTest extends AndroidWebViewTestBase {
@Feature({"AndroidWebView"}) @Feature({"AndroidWebView"})
public void testClearCacheInQuickSuccession() throws Throwable { public void testClearCacheInQuickSuccession() throws Throwable {
final AwTestContainerView testContainer = final AwTestContainerView testContainer =
createAwTestContainerViewOnMainSync(false, new TestAwContentsClient()); createAwTestContainerViewOnMainSync(new TestAwContentsClient());
final AwContents awContents = testContainer.getAwContents(); final AwContents awContents = testContainer.getAwContents();
runTestOnUiThread(new Runnable() { runTestOnUiThread(new Runnable() {
......
...@@ -1081,8 +1081,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1081,8 +1081,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testJavaScriptEnabledNormal() throws Throwable { public void testJavaScriptEnabledWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsJavaScriptTestHelper(views.getContents0(), views.getClient0()), new AwSettingsJavaScriptTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsJavaScriptTestHelper(views.getContents1(), views.getClient1())); new AwSettingsJavaScriptTestHelper(views.getContents1(), views.getClient1()));
...@@ -1090,26 +1090,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1090,26 +1090,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testJavaScriptEnabledIncognito() throws Throwable { public void testJavaScriptEnabledDynamicWithTwoViews() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsJavaScriptTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsJavaScriptTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testJavaScriptEnabledBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsJavaScriptTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsJavaScriptTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testJavaScriptEnabledDynamicNormal() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsJavaScriptDynamicTestHelper(views.getContents0(), views.getClient0()), new AwSettingsJavaScriptDynamicTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsJavaScriptDynamicTestHelper(views.getContents1(), views.getClient1())); new AwSettingsJavaScriptDynamicTestHelper(views.getContents1(), views.getClient1()));
...@@ -1117,26 +1099,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1117,26 +1099,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testJavaScriptEnabledDynamicIncognito() throws Throwable { public void testPluginsEnabledWithTwoViews() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsJavaScriptDynamicTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsJavaScriptDynamicTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testJavaScriptEnabledDynamicBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsJavaScriptDynamicTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsJavaScriptDynamicTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testPluginsEnabledNormal() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsPluginsTestHelper(views.getContents0(), views.getClient0()), new AwSettingsPluginsTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsPluginsTestHelper(views.getContents1(), views.getClient1())); new AwSettingsPluginsTestHelper(views.getContents1(), views.getClient1()));
...@@ -1144,35 +1108,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1144,35 +1108,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testPluginsEnabledIncognito() throws Throwable { public void testStandardFontFamilyWithTwoViews() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsPluginsTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsPluginsTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testPluginsEnabledBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsPluginsTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsPluginsTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testStandardFontFamilyNormal() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW);
runPerViewSettingsTest(
new AwSettingsStandardFontFamilyTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsStandardFontFamilyTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testStandardFontFamilyIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsStandardFontFamilyTestHelper(views.getContents0(), views.getClient0()), new AwSettingsStandardFontFamilyTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsStandardFontFamilyTestHelper(views.getContents1(), views.getClient1())); new AwSettingsStandardFontFamilyTestHelper(views.getContents1(), views.getClient1()));
...@@ -1180,35 +1117,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1180,35 +1117,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testStandardFontFamilyBoth() throws Throwable { public void testDefaultFontSizeWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsStandardFontFamilyTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsStandardFontFamilyTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testDefaultFontSizeNormal() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW);
runPerViewSettingsTest(
new AwSettingsDefaultFontSizeTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsDefaultFontSizeTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testDefaultFontSizeIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsDefaultFontSizeTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsDefaultFontSizeTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testDefaultFontSizeBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsDefaultFontSizeTestHelper(views.getContents0(), views.getClient0()), new AwSettingsDefaultFontSizeTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsDefaultFontSizeTestHelper(views.getContents1(), views.getClient1())); new AwSettingsDefaultFontSizeTestHelper(views.getContents1(), views.getClient1()));
...@@ -1221,7 +1131,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1221,7 +1131,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
@SmallTest @SmallTest
public void testLoadsImagesAutomaticallyWithCachedImage() throws Throwable { public void testLoadsImagesAutomaticallyWithCachedImage() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
ContentSettings settings0 = getContentSettingsOnUiThread(views.getContents0()); ContentSettings settings0 = getContentSettingsOnUiThread(views.getContents0());
settings0.setJavaScriptEnabled(true); settings0.setJavaScriptEnabled(true);
ContentSettings settings1 = getContentSettingsOnUiThread(views.getContents1()); ContentSettings settings1 = getContentSettingsOnUiThread(views.getContents1());
...@@ -1324,8 +1234,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1324,8 +1234,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testLoadsImagesAutomaticallyNormal() throws Throwable { public void testLoadsImagesAutomaticallyWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsLoadImagesAutomaticallyTestHelper( new AwSettingsLoadImagesAutomaticallyTestHelper(
views.getContents0(), views.getClient0(), new ImagePageGenerator(0, true)), views.getContents0(), views.getClient0(), new ImagePageGenerator(0, true)),
...@@ -1335,48 +1245,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1335,48 +1245,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testLoadsImagesAutomaticallyIncognito() throws Throwable { public void testDefaultTextEncodingWithTwoViews() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsLoadImagesAutomaticallyTestHelper(
views.getContents0(), views.getClient0(), new ImagePageGenerator(0, true)),
new AwSettingsLoadImagesAutomaticallyTestHelper(
views.getContents1(), views.getClient1(), new ImagePageGenerator(1, true)));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testLoadsImagesAutomaticallyBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsLoadImagesAutomaticallyTestHelper(
views.getContents0(), views.getClient0(), new ImagePageGenerator(0, true)),
new AwSettingsLoadImagesAutomaticallyTestHelper(
views.getContents1(), views.getClient1(), new ImagePageGenerator(1, true)));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testDefaultTextEncodingNormal() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW);
runPerViewSettingsTest(
new AwSettingsDefaultTextEncodingTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsDefaultTextEncodingTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testDefaultTextEncodingIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsDefaultTextEncodingTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsDefaultTextEncodingTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testDefaultTextEncodingBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsDefaultTextEncodingTestHelper(views.getContents0(), views.getClient0()), new AwSettingsDefaultTextEncodingTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsDefaultTextEncodingTestHelper(views.getContents1(), views.getClient1())); new AwSettingsDefaultTextEncodingTestHelper(views.getContents1(), views.getClient1()));
...@@ -1489,26 +1359,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1489,26 +1359,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testUserAgentStringNormal() throws Throwable { public void testUserAgentStringWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsUserAgentStringTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsUserAgentStringTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testUserAgentStringIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsUserAgentStringTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsUserAgentStringTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testUserAgentStringBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsUserAgentStringTestHelper(views.getContents0(), views.getClient0()), new AwSettingsUserAgentStringTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsUserAgentStringTestHelper(views.getContents1(), views.getClient1())); new AwSettingsUserAgentStringTestHelper(views.getContents1(), views.getClient1()));
...@@ -1551,17 +1403,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1551,17 +1403,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testDomStorageEnabledNormal() throws Throwable { public void testDomStorageEnabledWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsDomStorageEnabledTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsDomStorageEnabledTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testDomStorageEnabledIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsDomStorageEnabledTestHelper(views.getContents0(), views.getClient0()), new AwSettingsDomStorageEnabledTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsDomStorageEnabledTestHelper(views.getContents1(), views.getClient1())); new AwSettingsDomStorageEnabledTestHelper(views.getContents1(), views.getClient1()));
...@@ -1569,39 +1412,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1569,39 +1412,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testDomStorageEnabledBoth() throws Throwable { public void testUniversalAccessFromFilesWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsDomStorageEnabledTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsDomStorageEnabledTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testUniversalAccessFromFilesNormal() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW);
runPerViewSettingsTest(
new AwSettingsUniversalAccessFromFilesTestHelper(views.getContents0(),
views.getClient0()),
new AwSettingsUniversalAccessFromFilesTestHelper(views.getContents1(),
views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testUniversalAccessFromFilesIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsUniversalAccessFromFilesTestHelper(views.getContents0(),
views.getClient0()),
new AwSettingsUniversalAccessFromFilesTestHelper(views.getContents1(),
views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testUniversalAccessFromFilesBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsUniversalAccessFromFilesTestHelper(views.getContents0(), new AwSettingsUniversalAccessFromFilesTestHelper(views.getContents0(),
views.getClient0()), views.getClient0()),
...@@ -1630,30 +1442,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1630,30 +1442,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testFileAccessFromFilesIframeNormal() throws Throwable { public void testFileAccessFromFilesIframeWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsFileAccessFromFilesIframeTestHelper(
views.getContents0(), views.getClient0()),
new AwSettingsFileAccessFromFilesIframeTestHelper(
views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testFileAccessFromFilesIframeIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsFileAccessFromFilesIframeTestHelper(
views.getContents0(), views.getClient0()),
new AwSettingsFileAccessFromFilesIframeTestHelper(
views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testFileAccessFromFilesIframeBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsFileAccessFromFilesIframeTestHelper( new AwSettingsFileAccessFromFilesIframeTestHelper(
views.getContents0(), views.getClient0()), views.getContents0(), views.getClient0()),
...@@ -1663,8 +1453,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1663,8 +1453,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testFileAccessFromFilesXhrNormal() throws Throwable { public void testFileAccessFromFilesXhrWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsFileAccessFromFilesXhrTestHelper(views.getContents0(), new AwSettingsFileAccessFromFilesXhrTestHelper(views.getContents0(),
views.getClient0()), views.getClient0()),
...@@ -1674,30 +1464,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1674,30 +1464,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testFileAccessFromFilesXhrIncognito() throws Throwable { public void testFileUrlAccessWithTwoViews() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsFileAccessFromFilesXhrTestHelper(views.getContents0(),
views.getClient0()),
new AwSettingsFileAccessFromFilesXhrTestHelper(views.getContents1(),
views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testFileAccessFromFilesXhrBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsFileAccessFromFilesXhrTestHelper(views.getContents0(),
views.getClient0()),
new AwSettingsFileAccessFromFilesXhrTestHelper(views.getContents1(),
views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testFileUrlAccessNormal() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsFileUrlAccessTestHelper(views.getContents0(), views.getClient0(), 0), new AwSettingsFileUrlAccessTestHelper(views.getContents0(), views.getClient0(), 0),
new AwSettingsFileUrlAccessTestHelper(views.getContents1(), views.getClient1(), 1)); new AwSettingsFileUrlAccessTestHelper(views.getContents1(), views.getClient1(), 1));
...@@ -1705,44 +1473,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1705,44 +1473,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testFileUrlAccessIncognito() throws Throwable { public void testContentUrlAccessWithTwoViews() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsFileUrlAccessTestHelper(views.getContents0(), views.getClient0(), 0),
new AwSettingsFileUrlAccessTestHelper(views.getContents1(), views.getClient1(), 1));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testFileUrlAccessBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsFileUrlAccessTestHelper(views.getContents0(), views.getClient0(), 0),
new AwSettingsFileUrlAccessTestHelper(views.getContents1(), views.getClient1(), 1));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testContentUrlAccessNormal() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW);
runPerViewSettingsTest(
new AwSettingsContentUrlAccessTestHelper(views.getContents0(), views.getClient0(), 0),
new AwSettingsContentUrlAccessTestHelper(views.getContents1(), views.getClient1(), 1));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testContentUrlAccessIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsContentUrlAccessTestHelper(views.getContents0(), views.getClient0(), 0),
new AwSettingsContentUrlAccessTestHelper(views.getContents1(), views.getClient1(), 1));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testContentUrlAccessBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsContentUrlAccessTestHelper(views.getContents0(), views.getClient0(), 0), new AwSettingsContentUrlAccessTestHelper(views.getContents0(), views.getClient0(), 0),
new AwSettingsContentUrlAccessTestHelper(views.getContents1(), views.getClient1(), 1)); new AwSettingsContentUrlAccessTestHelper(views.getContents1(), views.getClient1(), 1));
...@@ -1772,30 +1504,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1772,30 +1504,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences", "Navigation"}) @Feature({"AndroidWebView", "Preferences", "Navigation"})
public void testContentUrlFromFileNormal() throws Throwable { public void testContentUrlFromFileWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsContentUrlAccessFromFileTestHelper(
views.getContents0(), views.getClient0(), 0),
new AwSettingsContentUrlAccessFromFileTestHelper(
views.getContents1(), views.getClient1(), 1));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences", "Navigation"})
public void testContentUrlFromFileIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsContentUrlAccessFromFileTestHelper(
views.getContents0(), views.getClient0(), 0),
new AwSettingsContentUrlAccessFromFileTestHelper(
views.getContents1(), views.getClient1(), 1));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences", "Navigation"})
public void testContentUrlFromFileBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsContentUrlAccessFromFileTestHelper( new AwSettingsContentUrlAccessFromFileTestHelper(
views.getContents0(), views.getClient0(), 0), views.getContents0(), views.getClient0(), 0),
...@@ -1874,7 +1584,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -1874,7 +1584,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
public void testBlockNetworkLoadsWithHttpResources() throws Throwable { public void testBlockNetworkLoadsWithHttpResources() throws Throwable {
final TestAwContentsClient contentClient = new TestAwContentsClient(); final TestAwContentsClient contentClient = new TestAwContentsClient();
final AwTestContainerView testContainer = final AwTestContainerView testContainer =
createAwTestContainerViewOnMainSync(false, contentClient); createAwTestContainerViewOnMainSync(contentClient);
final AwContents awContents = testContainer.getAwContents(); final AwContents awContents = testContainer.getAwContents();
final ContentSettings contentSettings = getContentSettingsOnUiThread(awContents); final ContentSettings contentSettings = getContentSettingsOnUiThread(awContents);
final AwSettings awSettings = getAwSettingsOnUiThread(testContainer.getAwContents()); final AwSettings awSettings = getAwSettingsOnUiThread(testContainer.getAwContents());
...@@ -2017,17 +1727,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -2017,17 +1727,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testLayoutAlgorithmNormal() throws Throwable { public void testLayoutAlgorithmWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsLayoutAlgorithmTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsLayoutAlgorithmTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testLayoutAlgorithmIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsLayoutAlgorithmTestHelper(views.getContents0(), views.getClient0()), new AwSettingsLayoutAlgorithmTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsLayoutAlgorithmTestHelper(views.getContents1(), views.getClient1())); new AwSettingsLayoutAlgorithmTestHelper(views.getContents1(), views.getClient1()));
...@@ -2035,35 +1736,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -2035,35 +1736,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testLayoutAlgorithmBoth() throws Throwable { public void testTextZoomWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsLayoutAlgorithmTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsLayoutAlgorithmTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testTextZoomNormal() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW);
runPerViewSettingsTest(
new AwSettingsTextZoomTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsTextZoomTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testTextZoomIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsTextZoomTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsTextZoomTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testTextZoomBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsTextZoomTestHelper(views.getContents0(), views.getClient0()), new AwSettingsTextZoomTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsTextZoomTestHelper(views.getContents1(), views.getClient1())); new AwSettingsTextZoomTestHelper(views.getContents1(), views.getClient1()));
...@@ -2071,26 +1745,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -2071,26 +1745,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testJavaScriptPopupsNormal() throws Throwable { public void testJavaScriptPopupsWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
runPerViewSettingsTest(
new AwSettingsJavaScriptPopupsTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsJavaScriptPopupsTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testJavaScriptPopupsIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest(
new AwSettingsJavaScriptPopupsTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsJavaScriptPopupsTestHelper(views.getContents1(), views.getClient1()));
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testJavaScriptPopupsBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
runPerViewSettingsTest( runPerViewSettingsTest(
new AwSettingsJavaScriptPopupsTestHelper(views.getContents0(), views.getClient0()), new AwSettingsJavaScriptPopupsTestHelper(views.getContents0(), views.getClient0()),
new AwSettingsJavaScriptPopupsTestHelper(views.getContents1(), views.getClient1())); new AwSettingsJavaScriptPopupsTestHelper(views.getContents1(), views.getClient1()));
...@@ -2101,7 +1757,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -2101,7 +1757,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
public void testCacheMode() throws Throwable { public void testCacheMode() throws Throwable {
final TestAwContentsClient contentClient = new TestAwContentsClient(); final TestAwContentsClient contentClient = new TestAwContentsClient();
final AwTestContainerView testContainer = final AwTestContainerView testContainer =
createAwTestContainerViewOnMainSync(false, contentClient); createAwTestContainerViewOnMainSync(contentClient);
final AwContents awContents = testContainer.getAwContents(); final AwContents awContents = testContainer.getAwContents();
final AwSettings awSettings = getAwSettingsOnUiThread(testContainer.getAwContents()); final AwSettings awSettings = getAwSettingsOnUiThread(testContainer.getAwContents());
clearCacheOnUiThread(awContents, true); clearCacheOnUiThread(awContents, true);
...@@ -2150,7 +1806,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -2150,7 +1806,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
public void testCacheModeWithBlockedNetworkLoads() throws Throwable { public void testCacheModeWithBlockedNetworkLoads() throws Throwable {
final TestAwContentsClient contentClient = new TestAwContentsClient(); final TestAwContentsClient contentClient = new TestAwContentsClient();
final AwTestContainerView testContainer = final AwTestContainerView testContainer =
createAwTestContainerViewOnMainSync(false, contentClient); createAwTestContainerViewOnMainSync(contentClient);
final AwContents awContents = testContainer.getAwContents(); final AwContents awContents = testContainer.getAwContents();
final AwSettings awSettings = getAwSettingsOnUiThread(testContainer.getAwContents()); final AwSettings awSettings = getAwSettingsOnUiThread(testContainer.getAwContents());
clearCacheOnUiThread(awContents, true); clearCacheOnUiThread(awContents, true);
...@@ -2195,42 +1851,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -2195,42 +1851,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences"}) @Feature({"AndroidWebView", "Preferences"})
public void testCacheModeNormal() throws Throwable { public void testCacheModeWithTwoViews() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
TestWebServer webServer = null;
try {
webServer = new TestWebServer(false);
runPerViewSettingsTest(
new AwSettingsCacheModeTestHelper(
views.getContents0(), views.getClient0(), 0, webServer),
new AwSettingsCacheModeTestHelper(
views.getContents1(), views.getClient1(), 1, webServer));
} finally {
if (webServer != null) webServer.shutdown();
}
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testCacheModeIncognito() throws Throwable {
ViewPair views = createViews(INCOGNITO_VIEW, INCOGNITO_VIEW);
TestWebServer webServer = null;
try {
webServer = new TestWebServer(false);
runPerViewSettingsTest(
new AwSettingsCacheModeTestHelper(
views.getContents0(), views.getClient0(), 0, webServer),
new AwSettingsCacheModeTestHelper(
views.getContents1(), views.getClient1(), 1, webServer));
} finally {
if (webServer != null) webServer.shutdown();
}
}
@SmallTest
@Feature({"AndroidWebView", "Preferences"})
public void testCacheModeBoth() throws Throwable {
ViewPair views = createViews(NORMAL_VIEW, INCOGNITO_VIEW);
TestWebServer webServer = null; TestWebServer webServer = null;
try { try {
webServer = new TestWebServer(false); webServer = new TestWebServer(false);
...@@ -2301,7 +1923,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -2301,7 +1923,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
public void testAppCache() throws Throwable { public void testAppCache() throws Throwable {
final TestAwContentsClient contentClient = new TestAwContentsClient(); final TestAwContentsClient contentClient = new TestAwContentsClient();
final AwTestContainerView testContainer = final AwTestContainerView testContainer =
createAwTestContainerViewOnMainSync(false, contentClient); createAwTestContainerViewOnMainSync(contentClient);
final AwContents awContents = testContainer.getAwContents(); final AwContents awContents = testContainer.getAwContents();
final ContentSettings settings = getContentSettingsOnUiThread(awContents); final ContentSettings settings = getContentSettingsOnUiThread(awContents);
settings.setJavaScriptEnabled(true); settings.setJavaScriptEnabled(true);
...@@ -2335,11 +1957,11 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -2335,11 +1957,11 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Preferences", "AppCache"}) @Feature({"AndroidWebView", "Preferences", "AppCache"})
public void testAppCacheNormal() throws Throwable { public void testAppCacheWithTwoViews() throws Throwable {
// We don't use the test helper here, because making sure that AppCache // We don't use the test helper here, because making sure that AppCache
// is disabled takes a lot of time, so running through the usual drill // is disabled takes a lot of time, so running through the usual drill
// will take about 20 seconds. // will take about 20 seconds.
ViewPair views = createViews(NORMAL_VIEW, NORMAL_VIEW); ViewPair views = createViews();
ContentSettings settings0 = getContentSettingsOnUiThread(views.getContents0()); ContentSettings settings0 = getContentSettingsOnUiThread(views.getContents0());
settings0.setJavaScriptEnabled(true); settings0.setJavaScriptEnabled(true);
settings0.setAppCachePath("whatever"); settings0.setAppCachePath("whatever");
...@@ -2470,17 +2092,13 @@ public class AwSettingsTest extends AndroidWebViewTestBase { ...@@ -2470,17 +2092,13 @@ public class AwSettingsTest extends AndroidWebViewTestBase {
helper1.ensureSettingHasInitialValue(); helper1.ensureSettingHasInitialValue();
} }
private ViewPair createViews( private ViewPair createViews() throws Throwable {
boolean firstIsIncognito,
boolean secondIsIncognito) throws Throwable {
TestAwContentsClient client0 = new TestAwContentsClient(); TestAwContentsClient client0 = new TestAwContentsClient();
TestAwContentsClient client1 = new TestAwContentsClient(); TestAwContentsClient client1 = new TestAwContentsClient();
return new ViewPair( return new ViewPair(
createAwTestContainerViewOnMainSync( createAwTestContainerViewOnMainSync(client0).getAwContents(),
firstIsIncognito, client0).getAwContents(),
client0, client0,
createAwTestContainerViewOnMainSync( createAwTestContainerViewOnMainSync(client1).getAwContents(),
secondIsIncognito, client1).getAwContents(),
client1); client1);
} }
......
...@@ -21,8 +21,7 @@ base::LazyInstance<AwBrowserDependencyFactoryImpl>::Leaky g_lazy_instance; ...@@ -21,8 +21,7 @@ base::LazyInstance<AwBrowserDependencyFactoryImpl>::Leaky g_lazy_instance;
} // namespace } // namespace
AwBrowserDependencyFactoryImpl::AwBrowserDependencyFactoryImpl() { AwBrowserDependencyFactoryImpl::AwBrowserDependencyFactoryImpl() {}
}
AwBrowserDependencyFactoryImpl::~AwBrowserDependencyFactoryImpl() {} AwBrowserDependencyFactoryImpl::~AwBrowserDependencyFactoryImpl() {}
...@@ -31,18 +30,14 @@ void AwBrowserDependencyFactoryImpl::InstallInstance() { ...@@ -31,18 +30,14 @@ void AwBrowserDependencyFactoryImpl::InstallInstance() {
SetInstance(g_lazy_instance.Pointer()); SetInstance(g_lazy_instance.Pointer());
} }
content::BrowserContext* AwBrowserDependencyFactoryImpl::GetBrowserContext( content::BrowserContext* AwBrowserDependencyFactoryImpl::GetBrowserContext() {
bool incognito) {
// TODO(boliu): Remove incognito parameter.
LOG_IF(ERROR, incognito) << "Android WebView does not support incognito mode"
<< " yet. Creating normal profile instead.";
return static_cast<AwContentBrowserClient*>( return static_cast<AwContentBrowserClient*>(
content::GetContentClient()->browser())->GetAwBrowserContext(); content::GetContentClient()->browser())->GetAwBrowserContext();
} }
WebContents* AwBrowserDependencyFactoryImpl::CreateWebContents(bool incognito) { WebContents* AwBrowserDependencyFactoryImpl::CreateWebContents() {
return content::WebContents::Create( return content::WebContents::Create(
content::WebContents::CreateParams(GetBrowserContext(incognito))); content::WebContents::CreateParams(GetBrowserContext()));
} }
} // namespace android_webview } // namespace android_webview
...@@ -28,8 +28,8 @@ class AwBrowserDependencyFactoryImpl : public AwBrowserDependencyFactory { ...@@ -28,8 +28,8 @@ class AwBrowserDependencyFactoryImpl : public AwBrowserDependencyFactory {
static void InstallInstance(); static void InstallInstance();
// AwBrowserDependencyFactory // AwBrowserDependencyFactory
virtual content::BrowserContext* GetBrowserContext(bool incognito) OVERRIDE; virtual content::BrowserContext* GetBrowserContext() OVERRIDE;
virtual content::WebContents* CreateWebContents(bool incognito) OVERRIDE; virtual content::WebContents* CreateWebContents() OVERRIDE;
private: private:
DISALLOW_COPY_AND_ASSIGN(AwBrowserDependencyFactoryImpl); DISALLOW_COPY_AND_ASSIGN(AwBrowserDependencyFactoryImpl);
......
...@@ -37,10 +37,10 @@ class AwBrowserDependencyFactory { ...@@ -37,10 +37,10 @@ class AwBrowserDependencyFactory {
static AwBrowserDependencyFactory* GetInstance(); static AwBrowserDependencyFactory* GetInstance();
// Returns the current browser context based on the specified mode. // Returns the current browser context based on the specified mode.
virtual content::BrowserContext* GetBrowserContext(bool incognito) = 0; virtual content::BrowserContext* GetBrowserContext() = 0;
// Constructs and returns ownership of a WebContents instance. // Constructs and returns ownership of a WebContents instance.
virtual content::WebContents* CreateWebContents(bool incognito) = 0; virtual content::WebContents* CreateWebContents() = 0;
protected: protected:
AwBrowserDependencyFactory(); AwBrowserDependencyFactory();
......
...@@ -114,8 +114,7 @@ AwContents* AwContents::FromWebContents(WebContents* web_contents) { ...@@ -114,8 +114,7 @@ AwContents* AwContents::FromWebContents(WebContents* web_contents) {
AwContents::AwContents(JNIEnv* env, AwContents::AwContents(JNIEnv* env,
jobject obj, jobject obj,
jobject web_contents_delegate, jobject web_contents_delegate)
bool private_browsing)
: java_ref_(env, obj), : java_ref_(env, obj),
web_contents_delegate_( web_contents_delegate_(
new AwWebContentsDelegate(env, web_contents_delegate)), new AwWebContentsDelegate(env, web_contents_delegate)),
...@@ -130,7 +129,7 @@ AwContents::AwContents(JNIEnv* env, ...@@ -130,7 +129,7 @@ AwContents::AwContents(JNIEnv* env,
// TODO(joth): rather than create and set the WebContents here, expose the // TODO(joth): rather than create and set the WebContents here, expose the
// factory method to java side and have that orchestrate the construction // factory method to java side and have that orchestrate the construction
// order. // order.
SetWebContents(dependency_factory->CreateWebContents(private_browsing)); SetWebContents(dependency_factory->CreateWebContents());
} }
void AwContents::ResetCompositor() { void AwContents::ResetCompositor() {
...@@ -606,10 +605,8 @@ void AwContents::SetInterceptNavigationDelegate(JNIEnv* env, ...@@ -606,10 +605,8 @@ void AwContents::SetInterceptNavigationDelegate(JNIEnv* env,
static jint Init(JNIEnv* env, static jint Init(JNIEnv* env,
jobject obj, jobject obj,
jobject web_contents_delegate, jobject web_contents_delegate) {
jboolean private_browsing) { AwContents* tab = new AwContents(env, obj, web_contents_delegate);
AwContents* tab = new AwContents(env, obj, web_contents_delegate,
private_browsing);
return reinterpret_cast<jint>(tab); return reinterpret_cast<jint>(tab);
} }
......
...@@ -47,8 +47,7 @@ class AwContents : public FindHelper::Listener, ...@@ -47,8 +47,7 @@ class AwContents : public FindHelper::Listener,
AwContents(JNIEnv* env, AwContents(JNIEnv* env,
jobject obj, jobject obj,
jobject web_contents_delegate, jobject web_contents_delegate);
bool private_browsing);
virtual ~AwContents(); virtual ~AwContents();
void DrawGL(AwDrawGLInfo* draw_info); void DrawGL(AwDrawGLInfo* draw_info);
......
...@@ -32,7 +32,6 @@ M C CSM: Shouldn't use synchronized method, please narrow down the synchronizati ...@@ -32,7 +32,6 @@ M C CSM: Shouldn't use synchronized method, please narrow down the synchronizati
M C CST: Shouldn't use synchronized(this), please narrow down the synchronization scope. At HttpAuthDatabase.java M C CST: Shouldn't use synchronized(this), please narrow down the synchronization scope. At HttpAuthDatabase.java
M C CST: Shouldn't use synchronized(this), please narrow down the synchronization scope. At SimpleSynchronizedThis.java M C CST: Shouldn't use synchronized(this), please narrow down the synchronization scope. At SimpleSynchronizedThis.java
M C IJU: TestCase org.chromium.android_webview.test.AndroidWebViewTestBase defines setUp that doesn't call super.setUp() At AndroidWebViewTestBase.java M C IJU: TestCase org.chromium.android_webview.test.AndroidWebViewTestBase defines setUp that doesn't call super.setUp() At AndroidWebViewTestBase.java
M C IJU: TestCase org.chromium.android_webview.test.ArchiveTest defines setUp that doesn't call super.setUp() At ArchiveTest.java
M C IJU: TestCase org.chromium.android_webview.test.HttpAuthDatabaseTest defines setUp that doesn't call super.setUp() At HttpAuthDatabaseTest.java M C IJU: TestCase org.chromium.android_webview.test.HttpAuthDatabaseTest defines setUp that doesn't call super.setUp() At HttpAuthDatabaseTest.java
M C IJU: TestCase org.chromium.android_webview.test.HttpAuthDatabaseTest defines tearDown that doesn't call super.tearDown() At HttpAuthDatabaseTest.java M C IJU: TestCase org.chromium.android_webview.test.HttpAuthDatabaseTest defines tearDown that doesn't call super.tearDown() At HttpAuthDatabaseTest.java
M C IJU: TestCase org.chromium.chrome.testshell.ProviderBookmarkNodeTest defines setUp that doesn't call super.setUp() At ProviderBookmarkNodeTest.java M C IJU: TestCase org.chromium.chrome.testshell.ProviderBookmarkNodeTest defines setUp that doesn't call super.setUp() At ProviderBookmarkNodeTest.java
...@@ -65,7 +64,6 @@ M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$7. ...@@ -65,7 +64,6 @@ M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$7.
M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$8.method2() defined in anonymous class At JavaBridgeBasicsTest.java M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$8.method2() defined in anonymous class At JavaBridgeBasicsTest.java
M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$9.method() defined in anonymous class At JavaBridgeBasicsTest.java M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$9.method() defined in anonymous class At JavaBridgeBasicsTest.java
M C USELESS_STRING: Invocation of toString on certChain in org.chromium.net.X509Util.verifyServerCertificates(byte[][], String) At X509Util.java M C USELESS_STRING: Invocation of toString on certChain in org.chromium.net.X509Util.verifyServerCertificates(byte[][], String) At X509Util.java
M D DLS: Dead store to context in org.chromium.android_webview.test.AndroidWebViewTestBase.createAwTestContainerViewOnMainSync(boolean, AwContentsClient) At AndroidWebViewTestBase.java
M D DLS: Dead store to eventTime in org.chromium.content.browser.LongPressDetectorTest$1.run() At LongPressDetectorTest.java M D DLS: Dead store to eventTime in org.chromium.content.browser.LongPressDetectorTest$1.run() At LongPressDetectorTest.java
M D DLS: Dead store to prevEditableLength in org.chromium.content.browser.ImeAdapter$AdapterInputConnection.setEditableText(String, int, int, int, int) At ImeAdapter.java M D DLS: Dead store to prevEditableLength in org.chromium.content.browser.ImeAdapter$AdapterInputConnection.setEditableText(String, int, int, int, int) At ImeAdapter.java
M D DLS: Dead store to testUrl in org.chromium.android_webview.test.ClientOnPageFinishedTest.testOnPageFinishedNotCalledForValidSubresources() At ClientOnPageFinishedTest.java M D DLS: Dead store to testUrl in org.chromium.android_webview.test.ClientOnPageFinishedTest.testOnPageFinishedNotCalledForValidSubresources() At ClientOnPageFinishedTest.java
......
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