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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java

Issue 1237303003: Move more tests from ChromeShellTest to ChromePublicTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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: chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
diff --git a/chrome/android/javatests_shell/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
similarity index 94%
rename from chrome/android/javatests_shell/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
rename to chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
index b8f068c9681f23f3efcea09fe7a820832c4f07e1..a3b876a25a9551beb3216fa183f07da10d3eb868 100644
--- a/chrome/android/javatests_shell/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
@@ -17,16 +17,16 @@ import android.test.suitebuilder.annotation.SmallTest;
import org.chromium.base.ThreadUtils;
import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.base.test.util.Feature;
+import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.preferences.website.ContentSetting;
import org.chromium.chrome.browser.preferences.website.PushNotificationInfo;
import org.chromium.chrome.browser.widget.RoundedIconGenerator;
-import org.chromium.chrome.shell.ChromeShellTestBase;
+import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.TestHttpServerClient;
import org.chromium.chrome.test.util.browser.notifications.MockNotificationManagerProxy;
import org.chromium.chrome.test.util.browser.notifications.MockNotificationManagerProxy.NotificationEntry;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
-import org.chromium.content.browser.test.util.JavaScriptUtils;
import java.util.Arrays;
import java.util.List;
@@ -39,7 +39,7 @@ import java.util.concurrent.TimeoutException;
*/
// TODO(peter): remove @SuppressLint once crbug.com/501900 is fixed.
@SuppressLint("NewApi")
-public class NotificationUIManagerTest extends ChromeShellTestBase {
+public class NotificationUIManagerTest extends ChromeActivityTestCaseBase<ChromeActivity> {
private static final String NOTIFICATION_TEST_PAGE =
TestHttpServerClient.getUrl("chrome/test/data/notifications/android_test.html");
@@ -51,6 +51,10 @@ public class NotificationUIManagerTest extends ChromeShellTestBase {
private MockNotificationManagerProxy mMockNotificationManager;
+ public NotificationUIManagerTest() {
+ super(ChromeActivity.class);
+ }
+
/**
* Returns the origin of the HTTP server the test is being ran on.
*/
@@ -85,18 +89,6 @@ public class NotificationUIManagerTest extends ChromeShellTestBase {
}
/**
- * Runs the Javascript |code| in the current tab, and waits for the result to be available.
- *
- * @param code The JavaScript code to execute in the current tab.
- * @return A JSON-formatted string with the result of executing the |code|.
- */
- private String runJavaScriptCodeInCurrentTab(String code) throws InterruptedException,
- TimeoutException {
- return JavaScriptUtils.executeJavaScriptAndWaitForResult(
- getActivity().getActiveContentViewCore().getWebContents(), code);
- }
-
- /**
* Shows a notification with |title| and |options|, waits until it has been displayed and then
* returns the Notification object to the caller. Requires that only a single notification is
* being displayed in the notification manager.
@@ -131,14 +123,12 @@ public class NotificationUIManagerTest extends ChromeShellTestBase {
}
@Override
- protected void setUp() throws Exception {
- super.setUp();
-
+ public void startMainActivity() throws InterruptedException {
+ // The NotificationUIManager must be overriden prior to the browser process starting.
mMockNotificationManager = new MockNotificationManagerProxy();
NotificationUIManager.overrideNotificationManagerForTesting(mMockNotificationManager);
- launchChromeShellWithUrl(NOTIFICATION_TEST_PAGE);
- assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading());
+ startMainActivityWithURL(NOTIFICATION_TEST_PAGE);
}
@Override

Powered by Google App Engine
This is Rietveld 408576698