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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/EmailAddressDetectionTest.java

Issue 2766393004: Convert most of the rest of instrumentation tests in content (Closed)
Patch Set: Keep @CommenLineFlags Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/javatests/src/org/chromium/content/browser/EmailAddressDetectionTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/EmailAddressDetectionTest.java b/content/public/android/javatests/src/org/chromium/content/browser/EmailAddressDetectionTest.java
index e9a23f3e5566c451b848adbbdaf47de218268932..af1250d4463d1e23477be7c765448837f5a19025 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/EmailAddressDetectionTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/EmailAddressDetectionTest.java
@@ -6,6 +6,12 @@ package org.chromium.content.browser;
import android.support.test.filters.MediumTest;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.RetryOnFailure;
@@ -14,33 +20,40 @@ import org.chromium.content.common.ContentSwitches;
/**
* Test suite for email address detection.
*/
+@RunWith(BaseJUnit4ClassRunner.class)
@CommandLineFlags.Add({ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
-public class EmailAddressDetectionTest extends ContentDetectionTestBase {
+public class EmailAddressDetectionTest {
+ @Rule
+ public ContentDetectionActivityTestRule mActivityTestRule =
+ new ContentDetectionActivityTestRule();
private static final String EMAIL_INTENT_PREFIX = "mailto:";
private boolean isExpectedEmailIntent(String intentUrl, String expectedContent) {
if (intentUrl == null) return false;
- final String expectedUrl = EMAIL_INTENT_PREFIX + urlForContent(expectedContent);
+ final String expectedUrl =
+ EMAIL_INTENT_PREFIX + mActivityTestRule.urlForContent(expectedContent);
return intentUrl.equals(expectedUrl);
}
+ @Test
@MediumTest
@Feature({"ContentDetection", "TabContents"})
@RetryOnFailure
public void testValidEmailAddresses() throws Throwable {
- startActivityWithTestUrl("content/test/data/android/content_detection/email.html");
+ mActivityTestRule.launchContentShellWithUrlSync(
+ "content/test/data/android/content_detection/email.html");
// valid_1: i.want.a.pony@chromium.org.
- String intentUrl = scrollAndTapExpectingIntent("valid_1");
- assertTrue(isExpectedEmailIntent(intentUrl, "i.want.a.pony@chromium.org"));
+ String intentUrl = mActivityTestRule.scrollAndTapExpectingIntent("valid_1");
+ Assert.assertTrue(isExpectedEmailIntent(intentUrl, "i.want.a.pony@chromium.org"));
// valid_2: nyan_cat@chromium.org.
- intentUrl = scrollAndTapExpectingIntent("valid_2");
- assertTrue(isExpectedEmailIntent(intentUrl, "nyan_cat@chromium.org"));
+ intentUrl = mActivityTestRule.scrollAndTapExpectingIntent("valid_2");
+ Assert.assertTrue(isExpectedEmailIntent(intentUrl, "nyan_cat@chromium.org"));
// valid_3: 123@456.com.
- intentUrl = scrollAndTapExpectingIntent("valid_3");
- assertTrue(isExpectedEmailIntent(intentUrl, "123@456.com"));
+ intentUrl = mActivityTestRule.scrollAndTapExpectingIntent("valid_3");
+ Assert.assertTrue(isExpectedEmailIntent(intentUrl, "123@456.com"));
}
}

Powered by Google App Engine
This is Rietveld 408576698