Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java

Issue 2496763002: Disable content intent detectors in the renderer (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.android_webview.test; 5 package org.chromium.android_webview.test;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.test.suitebuilder.annotation.SmallTest; 8 import android.test.suitebuilder.annotation.SmallTest;
9 import android.util.Pair; 9 import android.util.Pair;
10 10
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 }); 1008 });
1009 assertEquals(intentContent, 1009 assertEquals(intentContent,
1010 getActivity().getLastSentIntent().getData().toString()); 1010 getActivity().getLastSentIntent().getData().toString());
1011 } finally { 1011 } finally {
1012 getActivity().setIgnoreStartActivity(false); 1012 getActivity().setIgnoreStartActivity(false);
1013 } 1013 }
1014 } 1014 }
1015 1015
1016 @SmallTest 1016 @SmallTest
1017 @Feature({"AndroidWebView"}) 1017 @Feature({"AndroidWebView"})
1018 @CommandLineFlags.Add({ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
1018 public void testNullContentsClientClickableEmail() throws Throwable { 1019 public void testNullContentsClientClickableEmail() throws Throwable {
1019 doTestNullContentsClientClickableContent(TEST_EMAIL, TEST_EMAIL_URI); 1020 doTestNullContentsClientClickableContent(TEST_EMAIL, TEST_EMAIL_URI);
1020 } 1021 }
1021 1022
1022 @SmallTest 1023 @SmallTest
1023 @Feature({"AndroidWebView"}) 1024 @Feature({"AndroidWebView"})
1024 @CommandLineFlags.Add({ContentSwitches.NETWORK_COUNTRY_ISO + "=us"}) 1025 @CommandLineFlags.Add({ContentSwitches.NETWORK_COUNTRY_ISO + "=us",
1026 ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
1025 public void testNullContentsClientClickablePhone() throws Throwable { 1027 public void testNullContentsClientClickablePhone() throws Throwable {
1026 doTestNullContentsClientClickableContent(TEST_PHONE, TEST_PHONE_URI); 1028 doTestNullContentsClientClickableContent(TEST_PHONE, TEST_PHONE_URI);
1027 } 1029 }
1028 1030
1029 @SmallTest 1031 @SmallTest
1030 @Feature({"AndroidWebView"}) 1032 @Feature({"AndroidWebView"})
1033 @CommandLineFlags.Add({ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
1031 public void testNullContentsClientClickableAddress() throws Throwable { 1034 public void testNullContentsClientClickableAddress() throws Throwable {
1032 doTestNullContentsClientClickableContent(TEST_ADDRESS, TEST_ADDRESS_URI) ; 1035 doTestNullContentsClientClickableContent(TEST_ADDRESS, TEST_ADDRESS_URI) ;
1033 } 1036 }
1034 1037
1035 private void doTestClickableContent(String pageContent, String intentContent , 1038 private void doTestClickableContent(String pageContent, String intentContent ,
1036 boolean inMainFrame) throws Throwable { 1039 boolean inMainFrame) throws Throwable {
1037 standardSetup(); 1040 standardSetup();
1038 1041
1039 final String findContentJs = setupForContentClickTest(pageContent, inMai nFrame); 1042 final String findContentJs = setupForContentClickTest(pageContent, inMai nFrame);
1040 int callCount = mShouldOverrideUrlLoadingHelper.getCallCount(); 1043 int callCount = mShouldOverrideUrlLoadingHelper.getCallCount();
1041 DOMUtils.clickNodeByJs(this, mAwContents.getContentViewCore(), findConte ntJs); 1044 DOMUtils.clickNodeByJs(this, mAwContents.getContentViewCore(), findConte ntJs);
1042 mShouldOverrideUrlLoadingHelper.waitForCallback(callCount); 1045 mShouldOverrideUrlLoadingHelper.waitForCallback(callCount);
1043 assertEquals(intentContent, 1046 assertEquals(intentContent,
1044 mShouldOverrideUrlLoadingHelper.getShouldOverrideUrlLoadingUrl() ); 1047 mShouldOverrideUrlLoadingHelper.getShouldOverrideUrlLoadingUrl() );
1045 assertFalse(mShouldOverrideUrlLoadingHelper.isRedirect()); 1048 assertFalse(mShouldOverrideUrlLoadingHelper.isRedirect());
1046 assertTrue(mShouldOverrideUrlLoadingHelper.hasUserGesture()); 1049 assertTrue(mShouldOverrideUrlLoadingHelper.hasUserGesture());
1047 assertEquals(inMainFrame, mShouldOverrideUrlLoadingHelper.isMainFrame()) ; 1050 assertEquals(inMainFrame, mShouldOverrideUrlLoadingHelper.isMainFrame()) ;
1048 } 1051 }
1049 1052
1050 @SmallTest 1053 @SmallTest
1051 @Feature({"AndroidWebView"}) 1054 @Feature({"AndroidWebView"})
1055 @CommandLineFlags.Add({ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
1052 public void testClickableEmail() throws Throwable { 1056 public void testClickableEmail() throws Throwable {
1053 doTestClickableContent(TEST_EMAIL, TEST_EMAIL_URI, true); 1057 doTestClickableContent(TEST_EMAIL, TEST_EMAIL_URI, true);
1054 } 1058 }
1055 1059
1056 @SmallTest 1060 @SmallTest
1057 @Feature({"AndroidWebView"}) 1061 @Feature({"AndroidWebView"})
1058 @CommandLineFlags.Add({ContentSwitches.NETWORK_COUNTRY_ISO + "=us"}) 1062 @CommandLineFlags.Add({ContentSwitches.NETWORK_COUNTRY_ISO + "=us",
1063 ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
1059 public void testClickablePhone() throws Throwable { 1064 public void testClickablePhone() throws Throwable {
1060 doTestClickableContent(TEST_PHONE, TEST_PHONE_URI, true); 1065 doTestClickableContent(TEST_PHONE, TEST_PHONE_URI, true);
1061 } 1066 }
1062 1067
1063 @SmallTest 1068 @SmallTest
1064 @Feature({"AndroidWebView"}) 1069 @Feature({"AndroidWebView"})
1070 @CommandLineFlags.Add({ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
1065 public void testClickableAddress() throws Throwable { 1071 public void testClickableAddress() throws Throwable {
1066 doTestClickableContent(TEST_ADDRESS, TEST_ADDRESS_URI, true); 1072 doTestClickableContent(TEST_ADDRESS, TEST_ADDRESS_URI, true);
1067 } 1073 }
1068 1074
1069 @SmallTest 1075 @SmallTest
1070 @Feature({"AndroidWebView"}) 1076 @Feature({"AndroidWebView"})
1077 @CommandLineFlags.Add({ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
1071 public void testClickableEmailInIframe() throws Throwable { 1078 public void testClickableEmailInIframe() throws Throwable {
1072 doTestClickableContent(TEST_EMAIL, TEST_EMAIL_URI, false); 1079 doTestClickableContent(TEST_EMAIL, TEST_EMAIL_URI, false);
1073 } 1080 }
1074 1081
1075 @SmallTest 1082 @SmallTest
1076 @Feature({"AndroidWebView"}) 1083 @Feature({"AndroidWebView"})
1077 @CommandLineFlags.Add({ContentSwitches.NETWORK_COUNTRY_ISO + "=us"}) 1084 @CommandLineFlags.Add({ContentSwitches.NETWORK_COUNTRY_ISO + "=us",
1085 ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
1078 public void testClickablePhoneInIframe() throws Throwable { 1086 public void testClickablePhoneInIframe() throws Throwable {
1079 doTestClickableContent(TEST_PHONE, TEST_PHONE_URI, false); 1087 doTestClickableContent(TEST_PHONE, TEST_PHONE_URI, false);
1080 } 1088 }
1081 1089
1082 @SmallTest 1090 @SmallTest
1083 @Feature({"AndroidWebView"}) 1091 @Feature({"AndroidWebView"})
1092 @CommandLineFlags.Add({ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
1084 public void testClickableAddressInIframe() throws Throwable { 1093 public void testClickableAddressInIframe() throws Throwable {
1085 doTestClickableContent(TEST_ADDRESS, TEST_ADDRESS_URI, false); 1094 doTestClickableContent(TEST_ADDRESS, TEST_ADDRESS_URI, false);
1086 } 1095 }
1087 } 1096 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698