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

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

Issue 2755863004: Convert clicklistener tests with CommandLineTestRule support (Closed)
Patch Set: Rebase 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"));
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698