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

Unified Diff: content/browser/service_worker/service_worker_context_unittest.cc

Issue 788073007: Cleanup geofence registrations when a service worker is unregistered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: slightly improve mock usage in test Created 6 years 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/browser/service_worker/service_worker_context_unittest.cc
diff --git a/content/browser/service_worker/service_worker_context_unittest.cc b/content/browser/service_worker/service_worker_context_unittest.cc
index e47c9e40f1a8bc9500b26816966a9a6e3a2d1946..a765464583b4205ec24caaacc8fde17098f3a124 100644
--- a/content/browser/service_worker/service_worker_context_unittest.cc
+++ b/content/browser/service_worker/service_worker_context_unittest.cc
@@ -111,6 +111,7 @@ enum NotificationType {
struct NotificationLog {
NotificationType type;
GURL pattern;
+ int64 registration_id;
};
} // namespace
@@ -136,10 +137,12 @@ class ServiceWorkerContextTest : public ServiceWorkerContextObserver,
log.pattern = pattern;
notifications_.push_back(log);
}
- void OnRegistrationDeleted(const GURL& pattern) override {
+ void OnRegistrationDeleted(int64 registration_id,
+ const GURL& pattern) override {
NotificationLog log;
log.type = REGISTRATION_DELETED;
log.pattern = pattern;
+ log.registration_id = registration_id;
notifications_.push_back(log);
}
void OnStorageWiped() override {
@@ -323,6 +326,7 @@ TEST_F(ServiceWorkerContextTest, Unregister) {
EXPECT_EQ(pattern, notifications_[0].pattern);
EXPECT_EQ(REGISTRATION_DELETED, notifications_[1].type);
EXPECT_EQ(pattern, notifications_[1].pattern);
+ EXPECT_EQ(registration_id, notifications_[1].registration_id);
}
// Make sure registrations are cleaned up when they are unregistered in bulk.
@@ -418,8 +422,10 @@ TEST_F(ServiceWorkerContextTest, UnregisterMultiple) {
EXPECT_EQ(origin3_p1, notifications_[3].pattern);
EXPECT_EQ(REGISTRATION_DELETED, notifications_[4].type);
EXPECT_EQ(origin1_p2, notifications_[4].pattern);
+ EXPECT_EQ(registration_id2, notifications_[4].registration_id);
EXPECT_EQ(REGISTRATION_DELETED, notifications_[5].type);
EXPECT_EQ(origin1_p1, notifications_[5].pattern);
+ EXPECT_EQ(registration_id1, notifications_[5].registration_id);
}
// Make sure registering a new script shares an existing registration.

Powered by Google App Engine
This is Rietveld 408576698