| Index: chrome/browser/sync/notifier/p2p_notifier_unittest.cc
|
| diff --git a/chrome/browser/sync/notifier/p2p_notifier_unittest.cc b/chrome/browser/sync/notifier/p2p_notifier_unittest.cc
|
| index b8565c36520702115d45f3cd7f7e22c3eccd1787..70363815b26c2ae2ebb96b1c29f314baa11000d4 100644
|
| --- a/chrome/browser/sync/notifier/p2p_notifier_unittest.cc
|
| +++ b/chrome/browser/sync/notifier/p2p_notifier_unittest.cc
|
| @@ -75,9 +75,8 @@ class P2PNotifierTest : public testing::Test {
|
| }
|
|
|
| syncable::ModelTypePayloadMap MakePayloadMap(
|
| - const syncable::ModelTypeSet& types) {
|
| - return syncable::ModelTypePayloadMapFromBitSet(
|
| - syncable::ModelTypeBitSetFromSet(types), "");
|
| + syncable::ModelEnumSet types) {
|
| + return syncable::ModelTypePayloadMapFromEnumSet(types, "");
|
| }
|
|
|
| MessageLoop message_loop_;
|
| @@ -101,21 +100,21 @@ TEST_F(P2PNotifierTest, P2PNotificationTarget) {
|
| TEST_F(P2PNotifierTest, P2PNotificationDataIsTargeted) {
|
| {
|
| const P2PNotificationData notification_data(
|
| - "sender", NOTIFY_SELF, syncable::ModelTypeSet());
|
| + "sender", NOTIFY_SELF, syncable::ModelEnumSet());
|
| EXPECT_TRUE(notification_data.IsTargeted("sender"));
|
| EXPECT_FALSE(notification_data.IsTargeted("other1"));
|
| EXPECT_FALSE(notification_data.IsTargeted("other2"));
|
| }
|
| {
|
| const P2PNotificationData notification_data(
|
| - "sender", NOTIFY_OTHERS, syncable::ModelTypeSet());
|
| + "sender", NOTIFY_OTHERS, syncable::ModelEnumSet());
|
| EXPECT_FALSE(notification_data.IsTargeted("sender"));
|
| EXPECT_TRUE(notification_data.IsTargeted("other1"));
|
| EXPECT_TRUE(notification_data.IsTargeted("other2"));
|
| }
|
| {
|
| const P2PNotificationData notification_data(
|
| - "sender", NOTIFY_ALL, syncable::ModelTypeSet());
|
| + "sender", NOTIFY_ALL, syncable::ModelEnumSet());
|
| EXPECT_TRUE(notification_data.IsTargeted("sender"));
|
| EXPECT_TRUE(notification_data.IsTargeted("other1"));
|
| EXPECT_TRUE(notification_data.IsTargeted("other2"));
|
| @@ -127,7 +126,7 @@ TEST_F(P2PNotifierTest, P2PNotificationDataDefault) {
|
| EXPECT_TRUE(notification_data.IsTargeted(""));
|
| EXPECT_FALSE(notification_data.IsTargeted("other1"));
|
| EXPECT_FALSE(notification_data.IsTargeted("other2"));
|
| - EXPECT_TRUE(notification_data.GetChangedTypes().empty());
|
| + EXPECT_TRUE(notification_data.GetChangedTypes().Empty());
|
| const std::string& notification_data_str = notification_data.ToString();
|
| EXPECT_EQ(
|
| "{\"changedTypes\":[],\"notificationType\":\"notifySelf\","
|
| @@ -139,15 +138,14 @@ TEST_F(P2PNotifierTest, P2PNotificationDataDefault) {
|
| }
|
|
|
| TEST_F(P2PNotifierTest, P2PNotificationDataNonDefault) {
|
| - syncable::ModelTypeSet changed_types;
|
| - changed_types.insert(syncable::BOOKMARKS);
|
| - changed_types.insert(syncable::THEMES);
|
| + const syncable::ModelEnumSet changed_types(
|
| + syncable::BOOKMARKS, syncable::THEMES);
|
| const P2PNotificationData notification_data(
|
| "sender", NOTIFY_ALL, changed_types);
|
| EXPECT_TRUE(notification_data.IsTargeted("sender"));
|
| EXPECT_TRUE(notification_data.IsTargeted("other1"));
|
| EXPECT_TRUE(notification_data.IsTargeted("other2"));
|
| - EXPECT_EQ(changed_types, notification_data.GetChangedTypes());
|
| + EXPECT_TRUE(notification_data.GetChangedTypes().Equals(changed_types));
|
| const std::string& notification_data_str = notification_data.ToString();
|
| EXPECT_EQ(
|
| "{\"changedTypes\":[\"Bookmarks\",\"Themes\"],"
|
| @@ -160,9 +158,8 @@ TEST_F(P2PNotifierTest, P2PNotificationDataNonDefault) {
|
| }
|
|
|
| TEST_F(P2PNotifierTest, NotificationsBasic) {
|
| - syncable::ModelTypeSet enabled_types;
|
| - enabled_types.insert(syncable::BOOKMARKS);
|
| - enabled_types.insert(syncable::PREFERENCES);
|
| + syncable::ModelEnumSet enabled_types(
|
| + syncable::BOOKMARKS, syncable::PREFERENCES);
|
|
|
| EXPECT_CALL(mock_observer_, OnNotificationStateChange(true));
|
| EXPECT_CALL(mock_observer_,
|
| @@ -174,21 +171,18 @@ TEST_F(P2PNotifierTest, NotificationsBasic) {
|
| // Sent with target NOTIFY_OTHERS so should not be propagated to
|
| // |mock_observer_|.
|
| {
|
| - syncable::ModelTypeSet changed_types;
|
| - enabled_types.insert(syncable::THEMES);
|
| - enabled_types.insert(syncable::APPS);
|
| + syncable::ModelEnumSet changed_types(
|
| + syncable::THEMES, syncable::APPS);
|
| p2p_notifier_->SendNotification(changed_types);
|
| }
|
| }
|
|
|
| TEST_F(P2PNotifierTest, SendNotificationData) {
|
| - syncable::ModelTypeSet enabled_types;
|
| - enabled_types.insert(syncable::BOOKMARKS);
|
| - enabled_types.insert(syncable::PREFERENCES);
|
| + syncable::ModelEnumSet enabled_types(
|
| + syncable::BOOKMARKS, syncable::PREFERENCES);
|
|
|
| - syncable::ModelTypeSet changed_types;
|
| - changed_types.insert(syncable::THEMES);
|
| - changed_types.insert(syncable::APPS);
|
| + syncable::ModelEnumSet changed_types(
|
| + syncable::THEMES, syncable::APPS);
|
|
|
| const syncable::ModelTypePayloadMap& changed_payload_map =
|
| MakePayloadMap(changed_types);
|
| @@ -219,7 +213,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
|
| // Should be dropped.
|
| Mock::VerifyAndClearExpectations(&mock_observer_);
|
| p2p_notifier_->SendNotificationDataForTest(
|
| - P2PNotificationData("sender", NOTIFY_SELF, syncable::ModelTypeSet()));
|
| + P2PNotificationData("sender", NOTIFY_SELF, syncable::ModelEnumSet()));
|
|
|
| // Should be dropped.
|
| p2p_notifier_->SendNotificationDataForTest(
|
| @@ -234,7 +228,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
|
| // Should be dropped.
|
| Mock::VerifyAndClearExpectations(&mock_observer_);
|
| p2p_notifier_->SendNotificationDataForTest(
|
| - P2PNotificationData("sender2", NOTIFY_OTHERS, syncable::ModelTypeSet()));
|
| + P2PNotificationData("sender2", NOTIFY_OTHERS, syncable::ModelEnumSet()));
|
|
|
| // Should be propagated.
|
| Mock::VerifyAndClearExpectations(&mock_observer_);
|
| @@ -251,7 +245,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
|
| // Should be dropped.
|
| Mock::VerifyAndClearExpectations(&mock_observer_);
|
| p2p_notifier_->SendNotificationDataForTest(
|
| - P2PNotificationData("sender2", NOTIFY_ALL, syncable::ModelTypeSet()));
|
| + P2PNotificationData("sender2", NOTIFY_ALL, syncable::ModelEnumSet()));
|
| }
|
|
|
| } // namespace
|
|
|