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

Unified Diff: chrome/browser/notifications/sync_notifier/chrome_notifier_service_unittest.cc

Issue 12717010: Widen Data Pipes and newer protobufs (Closed) Base URL: http://git.chromium.org/chromium/src.git@newProtobufs
Patch Set: Synced Notifications newer protobufs - CR fixes per DCheng Created 7 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
Index: chrome/browser/notifications/sync_notifier/chrome_notifier_service_unittest.cc
diff --git a/chrome/browser/notifications/sync_notifier/chrome_notifier_service_unittest.cc b/chrome/browser/notifications/sync_notifier/chrome_notifier_service_unittest.cc
index f9322e2141e2ba2afda6c2be3eb2976ea1b8edfc..1cc08f89d0a6fe6e117be3c6c9078f19e5ed33ed 100644
--- a/chrome/browser/notifications/sync_notifier/chrome_notifier_service_unittest.cc
+++ b/chrome/browser/notifications/sync_notifier/chrome_notifier_service_unittest.cc
@@ -52,6 +52,7 @@ const sync_pb::CoalescedSyncedNotification_ReadState kUnread =
std::string GetNotificationId(const SyncData& sync_data) {
SyncedNotificationSpecifics specifics = sync_data.GetSpecifics().
synced_notification();
+
return specifics.coalesced_notification().key();
}
@@ -219,13 +220,16 @@ class ChromeNotifierServiceTest : public testing::Test {
SyncedNotificationSpecifics* specifics =
entity_specifics.mutable_synced_notification();
- specifics->mutable_coalesced_notification()->
+ specifics->
+ mutable_coalesced_notification()->
set_app_id(app_id);
- specifics->mutable_coalesced_notification()->
+ specifics->
+ mutable_coalesced_notification()->
set_key(key);
- specifics->mutable_coalesced_notification()->
+ specifics->
+ mutable_coalesced_notification()->
mutable_render_info()->
mutable_expanded_info()->
mutable_simple_expanded_layout()->
@@ -361,13 +365,13 @@ TEST_F(ChromeNotifierServiceTest, LocalRemoteBothNonEmptyNoOverlap) {
// Ensure the local store now has all local and remote notifications.
EXPECT_EQ(7U, notifier.GetAllSyncData(SYNCED_NOTIFICATIONS).size());
- EXPECT_TRUE(notifier.FindNotificationById(kKey1));
- EXPECT_TRUE(notifier.FindNotificationById(kKey2));
- EXPECT_TRUE(notifier.FindNotificationById(kKey3));
- EXPECT_TRUE(notifier.FindNotificationById(kKey4));
- EXPECT_TRUE(notifier.FindNotificationById(kKey5));
- EXPECT_TRUE(notifier.FindNotificationById(kKey6));
- EXPECT_TRUE(notifier.FindNotificationById(kKey7));
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey1));
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey2));
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey3));
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey4));
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey5));
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey6));
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey7));
// Test the type conversion and construction functions.
for (SyncDataList::const_iterator iter = initial_data.begin();
@@ -375,15 +379,16 @@ TEST_F(ChromeNotifierServiceTest, LocalRemoteBothNonEmptyNoOverlap) {
scoped_ptr<SyncedNotification> notification1(
ChromeNotifierService::CreateNotificationFromSyncData(*iter));
// TODO(petewil): Revisit this when we add version info to notifications.
- const std::string& id = notification1->notification_id();
- const SyncedNotification* notification2 = notifier.FindNotificationById(id);
+ const std::string& key = notification1->key();
+ const SyncedNotification* notification2 =
+ notifier.FindNotificationByKey(key);
EXPECT_TRUE(NULL != notification2);
EXPECT_TRUE(notification1->EqualsIgnoringReadState(*notification2));
EXPECT_EQ(notification1->read_state(), notification2->read_state());
}
- EXPECT_TRUE(notifier.FindNotificationById(kKey1));
- EXPECT_TRUE(notifier.FindNotificationById(kKey2));
- EXPECT_TRUE(notifier.FindNotificationById(kKey3));
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey1));
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey2));
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey3));
}
// Test the local store having the read bit unset, the remote store having
@@ -415,11 +420,11 @@ TEST_F(ChromeNotifierServiceTest, ModelAssocBothNonEmptyReadMismatch1) {
// state of the first is now read.
EXPECT_EQ(2U, notifier.GetAllSyncData(syncer::SYNCED_NOTIFICATIONS).size());
SyncedNotification* notification1 =
- notifier.FindNotificationById(kKey1);
+ notifier.FindNotificationByKey(kKey1);
EXPECT_FALSE(NULL == notification1);
- EXPECT_EQ(SyncedNotification::kDismissed, notification1->read_state());
- EXPECT_TRUE(notifier.FindNotificationById(kKey2));
- EXPECT_FALSE(notifier.FindNotificationById(kKey3));
+ EXPECT_EQ(kDismissed, notification1->read_state());
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey2));
+ EXPECT_FALSE(notifier.FindNotificationByKey(kKey3));
// Ensure no new data will be sent to the remote store for notification1.
EXPECT_EQ(0U, processor()->change_list_size());
@@ -455,11 +460,11 @@ TEST_F(ChromeNotifierServiceTest, ModelAssocBothNonEmptyReadMismatch2) {
// state of the first is now read.
EXPECT_EQ(2U, notifier.GetAllSyncData(syncer::SYNCED_NOTIFICATIONS).size());
SyncedNotification* notification1 =
- notifier.FindNotificationById(kKey1);
+ notifier.FindNotificationByKey(kKey1);
EXPECT_FALSE(NULL == notification1);
- EXPECT_EQ(SyncedNotification::kDismissed, notification1->read_state());
- EXPECT_TRUE(notifier.FindNotificationById(kKey2));
- EXPECT_FALSE(notifier.FindNotificationById(kKey3));
+ EXPECT_EQ(kDismissed, notification1->read_state());
+ EXPECT_TRUE(notifier.FindNotificationByKey(kKey2));
+ EXPECT_FALSE(notifier.FindNotificationByKey(kKey3));
// Ensure the new data will be sent to the remote store for notification1.
EXPECT_EQ(1U, processor()->change_list_size());
@@ -493,11 +498,11 @@ TEST_F(ChromeNotifierServiceTest, ModelAssocBothNonEmptyWithUpdate) {
// Ensure the local store still has only one notification
EXPECT_EQ(1U, notifier.GetAllSyncData(syncer::SYNCED_NOTIFICATIONS).size());
SyncedNotification* notification1 =
- notifier.FindNotificationById(kKey1);
+ notifier.FindNotificationByKey(kKey1);
+
EXPECT_FALSE(NULL == notification1);
- EXPECT_EQ(SyncedNotification::kUnread, notification1->read_state());
+ EXPECT_EQ(kUnread, notification1->read_state());
EXPECT_EQ("One", notification1->title());
- EXPECT_EQ("Eleven", notification1->first_external_id());
// Ensure no new data will be sent to the remote store for notification1.
EXPECT_EQ(0U, processor()->change_list_size());

Powered by Google App Engine
This is Rietveld 408576698