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

Unified Diff: content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java

Issue 2632043002: Create ContentShellActivityTestRule and BaseJUnitRunner (Closed)
Patch Set: Change javadoc Created 3 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java
diff --git a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java
index f782574b169c8067d5d84d6affc4c37408fc5a6b..e5f810482fbfeccda03447d3b56fddb02c9e6b55 100644
--- a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java
+++ b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,12 @@ package org.chromium.content_shell_apk;
import android.support.test.filters.SmallTest;
+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.Feature;
import org.chromium.base.test.util.RetryOnFailure;
import org.chromium.base.test.util.UrlUtils;
@@ -16,31 +22,36 @@ import java.util.concurrent.ExecutionException;
/**
* Test suite to verify the behavior of the shell management logic.
*/
-public class ContentShellShellManagementTest extends ContentShellTestBase {
+@RunWith(BaseJUnit4ClassRunner.class)
+public class ContentShellShellManagementTest {
+ @Rule
+ public ContentShellActivityTestRule mActivityTestRule = new ContentShellActivityTestRule();
private static final String TEST_PAGE_1 = UrlUtils.encodeHtmlDataUri(
"<html><body style='background: red;'></body></html>");
private static final String TEST_PAGE_2 = UrlUtils.encodeHtmlDataUri(
"<html><body style='background: green;'></body></html>");
+ @Test
@SmallTest
@Feature({"Main"})
@RetryOnFailure
public void testMultipleShellsLaunched() throws InterruptedException, ExecutionException {
- final ContentShellActivity activity = launchContentShellWithUrl(TEST_PAGE_1);
- assertEquals(TEST_PAGE_1, activity.getActiveShell().getContentViewCore()
- .getWebContents().getUrl());
+ final ContentShellActivity activity =
+ mActivityTestRule.launchContentShellWithUrl(TEST_PAGE_1);
+ Assert.assertEquals(TEST_PAGE_1,
+ activity.getActiveShell().getContentViewCore().getWebContents().getUrl());
Shell previousActiveShell = activity.getActiveShell();
- assertFalse(previousActiveShell.isDestroyed());
+ Assert.assertFalse(previousActiveShell.isDestroyed());
- loadNewShell(TEST_PAGE_2);
- assertEquals(TEST_PAGE_2, activity.getActiveShell().getContentViewCore()
- .getWebContents().getUrl());
+ mActivityTestRule.loadNewShell(TEST_PAGE_2);
+ Assert.assertEquals(TEST_PAGE_2,
+ activity.getActiveShell().getContentViewCore().getWebContents().getUrl());
- assertNotSame(previousActiveShell, activity.getActiveShell());
- assertTrue(previousActiveShell.isDestroyed());
- assertFalse(previousActiveShell.getContentViewCore().isAlive());
+ Assert.assertNotSame(previousActiveShell, activity.getActiveShell());
+ Assert.assertTrue(previousActiveShell.isDestroyed());
+ Assert.assertFalse(previousActiveShell.getContentViewCore().isAlive());
}
}

Powered by Google App Engine
This is Rietveld 408576698