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

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

Issue 878163004: [Android] Convert ContentShellTest.apk to isolate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad rebase Created 5 years, 10 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 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.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.test.suitebuilder.annotation.MediumTest; 7 import android.test.suitebuilder.annotation.MediumTest;
8 8
9 import org.chromium.base.test.util.Feature; 9 import org.chromium.base.test.util.Feature;
10 10
11 /** 11 /**
12 * Test suite for email address detection. 12 * Test suite for email address detection.
13 */ 13 */
14 public class EmailAddressDetectionTest extends ContentDetectionTestBase { 14 public class EmailAddressDetectionTest extends ContentDetectionTestBase {
15 15
16 private static final String EMAIL_INTENT_PREFIX = "mailto:"; 16 private static final String EMAIL_INTENT_PREFIX = "mailto:";
17 17
18 private boolean isExpectedEmailIntent(String intentUrl, String expectedConte nt) { 18 private boolean isExpectedEmailIntent(String intentUrl, String expectedConte nt) {
19 if (intentUrl == null) return false; 19 if (intentUrl == null) return false;
20 final String expectedUrl = EMAIL_INTENT_PREFIX + urlForContent(expectedC ontent); 20 final String expectedUrl = EMAIL_INTENT_PREFIX + urlForContent(expectedC ontent);
21 return intentUrl.equals(expectedUrl); 21 return intentUrl.equals(expectedUrl);
22 } 22 }
23 23
24 @MediumTest 24 @MediumTest
25 @Feature({"ContentDetection", "TabContents"}) 25 @Feature({"ContentDetection", "TabContents"})
26 public void testValidEmailAddresses() throws Throwable { 26 public void testValidEmailAddresses() throws Throwable {
27 startActivityWithTestUrl("content/content_detection/email.html"); 27 startActivityWithTestUrl("content/test/data/android/content_detection/em ail.html");
28 assertWaitForPageScaleFactorMatch(1.0f); 28 assertWaitForPageScaleFactorMatch(1.0f);
29 29
30 // valid_1: i.want.a.pony@chromium.org. 30 // valid_1: i.want.a.pony@chromium.org.
31 String intentUrl = scrollAndTapExpectingIntent("valid_1"); 31 String intentUrl = scrollAndTapExpectingIntent("valid_1");
32 assertTrue(isExpectedEmailIntent(intentUrl, "i.want.a.pony@chromium.org" )); 32 assertTrue(isExpectedEmailIntent(intentUrl, "i.want.a.pony@chromium.org" ));
33 33
34 // valid_2: nyan_cat@chromium.org. 34 // valid_2: nyan_cat@chromium.org.
35 intentUrl = scrollAndTapExpectingIntent("valid_2"); 35 intentUrl = scrollAndTapExpectingIntent("valid_2");
36 assertTrue(isExpectedEmailIntent(intentUrl, "nyan_cat@chromium.org")); 36 assertTrue(isExpectedEmailIntent(intentUrl, "nyan_cat@chromium.org"));
37 37
38 // valid_3: 123@456.com. 38 // valid_3: 123@456.com.
39 intentUrl = scrollAndTapExpectingIntent("valid_3"); 39 intentUrl = scrollAndTapExpectingIntent("valid_3");
40 assertTrue(isExpectedEmailIntent(intentUrl, "123@456.com")); 40 assertTrue(isExpectedEmailIntent(intentUrl, "123@456.com"));
41 } 41 }
42 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698