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

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

Issue 1262023003: Serialize Notification.direction == "auto" in the database (2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/browser/notifications/notification_database_data_unittest.cc
diff --git a/content/browser/notifications/notification_database_data_unittest.cc b/content/browser/notifications/notification_database_data_unittest.cc
index 2613108db5c4d0030237b569c11e99beae0f2320..1581051fcb3c74a8c3d7436b725dbda31a2b44b9 100644
--- a/content/browser/notifications/notification_database_data_unittest.cc
+++ b/content/browser/notifications/notification_database_data_unittest.cc
@@ -34,7 +34,7 @@ TEST(NotificationDatabaseDataTest, SerializeAndDeserializeData) {
PlatformNotificationData notification_data;
notification_data.title = base::ASCIIToUTF16(kNotificationTitle);
notification_data.direction =
- PlatformNotificationData::NotificationDirectionRightToLeft;
+ PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT;
notification_data.lang = kNotificationLang;
notification_data.body = base::ASCIIToUTF16(kNotificationBody);
notification_data.tag = kNotificationTag;
@@ -86,4 +86,30 @@ TEST(NotificationDatabaseDataTest, SerializeAndDeserializeData) {
EXPECT_EQ(developer_data[i], copied_notification_data.data[i]);
}
+TEST(NotificationDatabaseDataTest, SerializeAndDeserializeDirections) {
+ PlatformNotificationData::Direction directions[] = {
+ PlatformNotificationData::DIRECTION_LEFT_TO_RIGHT,
+ PlatformNotificationData::DIRECTION_RIGHT_TO_LEFT,
+ PlatformNotificationData::DIRECTION_AUTO
palmer 2015/08/03 20:42:46 Might be good to add a negative test case.
+ };
+
+ for (size_t i = 0; i < arraysize(directions); ++i) {
+ PlatformNotificationData notification_data;
+ notification_data.direction = directions[i];
+
+ NotificationDatabaseData database_data;
+ database_data.notification_data = notification_data;
+
+ std::string serialized_data;
+ ASSERT_TRUE(SerializeNotificationDatabaseData(database_data,
+ &serialized_data));
+
+ NotificationDatabaseData copied_data;
+ ASSERT_TRUE(DeserializeNotificationDatabaseData(serialized_data,
+ &copied_data));
+
+ EXPECT_EQ(directions[i], copied_data.notification_data.direction);
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698