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

Unified Diff: content/browser/notifications/notification_database_unittest.cc

Issue 1025743002: Write the assigned notification id to the stored notification data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « content/browser/notifications/notification_database.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/notifications/notification_database_unittest.cc
diff --git a/content/browser/notifications/notification_database_unittest.cc b/content/browser/notifications/notification_database_unittest.cc
index 207b238cd3846f1b542d0483415f20a88f4a38ce..65c537ec192085355d6ba2bda7186a4658c0e20c 100644
--- a/content/browser/notifications/notification_database_unittest.cc
+++ b/content/browser/notifications/notification_database_unittest.cc
@@ -199,6 +199,30 @@ TEST_F(NotificationDatabaseTest, NotificationIdIncrements) {
EXPECT_EQ(notification_id, 3);
}
+TEST_F(NotificationDatabaseTest, NotificationIdIncrementsStorage) {
+ scoped_ptr<NotificationDatabase> database(CreateDatabaseInMemory());
+ ASSERT_EQ(NotificationDatabase::STATUS_OK,
+ database->Open(true /* create_if_missing */));
+
+ GURL origin("https://example.com");
+
+ NotificationDatabaseData database_data;
+ database_data.notification_id = -1;
+
+ int64_t notification_id = 0;
+ ASSERT_EQ(NotificationDatabase::STATUS_OK,
+ database->WriteNotificationData(origin,
+ database_data,
+ &notification_id));
+
+ ASSERT_EQ(NotificationDatabase::STATUS_OK,
+ database->ReadNotificationData(notification_id,
+ origin,
+ &database_data));
+
+ EXPECT_EQ(notification_id, database_data.notification_id);
+}
+
TEST_F(NotificationDatabaseTest, NotificationIdCorruption) {
base::ScopedTempDir database_dir;
ASSERT_TRUE(database_dir.CreateUniqueTempDir());
@@ -322,7 +346,8 @@ TEST_F(NotificationDatabaseTest, ReadNotificationDataReflection) {
// Verify that all members retrieved from the database are exactly the same
// as the ones that were written to it. This tests the serialization behavior.
- EXPECT_EQ(database_data.notification_id, read_database_data.notification_id);
+ EXPECT_EQ(notification_id, read_database_data.notification_id);
+
EXPECT_EQ(database_data.origin, read_database_data.origin);
EXPECT_EQ(database_data.service_worker_registration_id,
read_database_data.service_worker_registration_id);
« no previous file with comments | « content/browser/notifications/notification_database.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698