| Index: content/public/android/javatests/src/org/chromium/content/browser/ClickListenerTest.java
|
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ClickListenerTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ClickListenerTest.java
|
| index c16cb9a8e899e353314e4dd288b392d0ee0dd6e2..ace34990bf8e79554131e9542319456b08c282d0 100644
|
| --- a/content/public/android/javatests/src/org/chromium/content/browser/ClickListenerTest.java
|
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/ClickListenerTest.java
|
| @@ -6,7 +6,14 @@ package org.chromium.content.browser;
|
|
|
| import android.support.test.filters.MediumTest;
|
|
|
| -import org.chromium.base.test.util.CommandLineFlags;
|
| +import org.junit.Assert;
|
| +import org.junit.Before;
|
| +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.CommandLineTestRule;
|
| import org.chromium.base.test.util.Feature;
|
| import org.chromium.base.test.util.RetryOnFailure;
|
| import org.chromium.content.common.ContentSwitches;
|
| @@ -14,41 +21,58 @@ import org.chromium.content.common.ContentSwitches;
|
| /**
|
| * Test suite for click listener validation in content detection.
|
| */
|
| -@CommandLineFlags.Add({ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION})
|
| -public class ClickListenerTest extends ContentDetectionTestBase {
|
| +@RunWith(BaseJUnit4ClassRunner.class)
|
| +public class ClickListenerTest {
|
| + @Rule
|
| + public ContentDetectionActivityTestRule mActivityTestRule =
|
| + new ContentDetectionActivityTestRule();
|
| + @Rule
|
| + public CommandLineTestRule mCommandLineTestRule =
|
| + new CommandLineTestRule(ContentSwitches.ENABLE_CONTENT_INTENT_DETECTION);
|
| +
|
| + @Before
|
| + public void setUp() {
|
| + // mCommandLineTestRule.setUp();
|
| + }
|
|
|
| + @Test
|
| @MediumTest
|
| @Feature({"ContentDetection", "TabContents"})
|
| @RetryOnFailure
|
| public void testClickContentOnLink() throws Throwable {
|
| - startActivityWithTestUrl(
|
| + mActivityTestRule.launchContentShellWithUrlSync(
|
| "content/test/data/android/content_detection/click_listeners.html");
|
|
|
| // Clicks on addresses in links should change the url.
|
| - scrollAndTapNavigatingOut("linktest");
|
| - assertTrue(isCurrentTestUrl("content/test/data/android/content_detection/empty.html"));
|
| + mActivityTestRule.scrollAndTapNavigatingOut("linktest");
|
| + Assert.assertTrue(mActivityTestRule.isCurrentTestUrl(
|
| + "content/test/data/android/content_detection/empty.html"));
|
| }
|
|
|
| + @Test
|
| @MediumTest
|
| @Feature({"ContentDetection", "TabContents"})
|
| public void testClickContentOnJSListener1() throws Throwable {
|
| - startActivityWithTestUrl(
|
| + mActivityTestRule.launchContentShellWithUrlSync(
|
| "content/test/data/android/content_detection/click_listeners.html");
|
|
|
| // Clicks on addresses in elements listening to click events should be
|
| // processed normally without address detection.
|
| - scrollAndTapNavigatingOut("clicktest1");
|
| - assertTrue(isCurrentTestUrl("content/test/data/android/content_detection/empty.html"));
|
| + mActivityTestRule.scrollAndTapNavigatingOut("clicktest1");
|
| + Assert.assertTrue(mActivityTestRule.isCurrentTestUrl(
|
| + "content/test/data/android/content_detection/empty.html"));
|
| }
|
|
|
| + @Test
|
| @MediumTest
|
| @Feature({"ContentDetection", "TabContents"})
|
| public void testClickContentOnJSListener2() throws Throwable {
|
| - startActivityWithTestUrl(
|
| + mActivityTestRule.launchContentShellWithUrlSync(
|
| "content/test/data/android/content_detection/click_listeners.html");
|
|
|
| // Same as previous test, but using addEventListener instead of onclick.
|
| - scrollAndTapNavigatingOut("clicktest2");
|
| - assertTrue(isCurrentTestUrl("content/test/data/android/content_detection/empty.html"));
|
| + mActivityTestRule.scrollAndTapNavigatingOut("clicktest2");
|
| + Assert.assertTrue(mActivityTestRule.isCurrentTestUrl(
|
| + "content/test/data/android/content_detection/empty.html"));
|
| }
|
| }
|
|
|