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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java

Issue 1969983002: Change Physical Web notification display behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Spell out "current" Created 4 years, 7 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 | « chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java
index b8f6a91f3514a43636c9a063de9d9978d48d6452..79514792b2bbb71651ffc61df2ed61b150ebbf26 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlManagerTest.java
@@ -28,7 +28,7 @@ public class UrlManagerTest extends InstrumentationTestCase {
private static final String DESC1 = "Example Website";
private static final String URL2 = "https://google.com/";
private static final String TITLE2 = "Google";
- private static final String DESC2 = "Search the Web";
+ private static final String DESC2 = "Search the web";
private static final String PREF_PHYSICAL_WEB = "physical_web";
private static final int PHYSICAL_WEB_OFF = 0;
private static final int PHYSICAL_WEB_ON = 1;
@@ -223,6 +223,55 @@ public class UrlManagerTest extends InstrumentationTestCase {
}
@SmallTest
+ public void testAddUrlInCacheWithOthersMakesNoNotification() throws Exception {
+ addPwsResult1();
+ addPwsResult2();
+ addPwsResult1();
+ mUrlManager.addUrl(URL1);
+ mUrlManager.addUrl(URL2);
+ mUrlManager.removeUrl(URL1);
+ getInstrumentation().waitForIdleSync();
+ mMockNotificationManagerProxy.cancelAll();
+ mUrlManager.addUrl(URL1);
+ getInstrumentation().waitForIdleSync();
+
+ // Make sure that no notification is shown.
+ List<NotificationEntry> notifications = mMockNotificationManagerProxy.getNotifications();
+ assertEquals(0, notifications.size());
+ }
+
+ @SmallTest
+ public void testAddUrlInCacheWithNoOthersMakesNotification() throws Exception {
+ addPwsResult1();
+ addPwsResult1();
+ mUrlManager.addUrl(URL1);
+ mUrlManager.removeUrl(URL1);
+ getInstrumentation().waitForIdleSync();
+ mMockNotificationManagerProxy.cancelAll();
+ mUrlManager.addUrl(URL1);
+ getInstrumentation().waitForIdleSync();
+
+ // Make sure that a notification was shown.
+ List<NotificationEntry> notifications = mMockNotificationManagerProxy.getNotifications();
+ assertEquals(1, notifications.size());
+ }
+
+ @SmallTest
+ public void testAddUrlNotInCacheWithOthersMakesNotification() throws Exception {
+ addPwsResult1();
+ addPwsResult2();
+ mUrlManager.addUrl(URL1);
+ getInstrumentation().waitForIdleSync();
+ mMockNotificationManagerProxy.cancelAll();
+ mUrlManager.addUrl(URL2);
+ getInstrumentation().waitForIdleSync();
+
+ // Make sure that a notification was shown.
+ List<NotificationEntry> notifications = mMockNotificationManagerProxy.getNotifications();
+ assertEquals(1, notifications.size());
+ }
+
+ @SmallTest
public void testRemoveOnlyUrlClearsNotification() throws Exception {
addPwsResult1();
mUrlManager.addUrl(URL1);
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/physicalweb/UrlInfoTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698