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

Side by Side Diff: content/shell/android/javatests/src/org/chromium/content_shell/EmailAddressDetectionTest.java

Issue 11085008: [Android] Upstream content detection and ChromeBrowserProvider tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean-up for review. Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.content_shell;
6
7 import android.test.suitebuilder.annotation.MediumTest;
8
9 import org.chromium.base.test.util.DisabledTest;
10 import org.chromium.base.test.util.Feature;
11
12 /**
13 * Test suite for email address detection.
14 */
15 public class EmailAddressDetectionTest extends ContentDetectionTestBase {
16
17 private static final String EMAIL_INTENT_PREFIX = "mailto:";
18
19 private boolean isExpectedEmailIntent(String intentUrl, String expectedConte nt) {
20 if (intentUrl == null) return false;
21 final String expectedUrl = EMAIL_INTENT_PREFIX + urlForContent(expectedC ontent);
22 return intentUrl.equals(expectedUrl);
23 }
24
25 @MediumTest
26 @Feature({"ContentDetection", "TabContents"})
27 public void testValidEmailAddresses() throws Throwable {
28 startActivityWithTestUrl("content/content_detection/email.html");
29
30 // valid_1: i.want.a.pony@chromium.org.
31 String intentUrl = scrollAndTapExpectingIntent("valid_1");
32 assertTrue(isExpectedEmailIntent(intentUrl, "i.want.a.pony@chromium.org" ));
33
34 // valid_2: nyan_cat@chromium.org.
35 intentUrl = scrollAndTapExpectingIntent("valid_2");
36 assertTrue(isExpectedEmailIntent(intentUrl, "nyan_cat@chromium.org"));
37
38 // valid_3: 123@456.com.
39 intentUrl = scrollAndTapExpectingIntent("valid_3");
40 assertTrue(isExpectedEmailIntent(intentUrl, "123@456.com"));
41 }
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698