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

Unified Diff: sync/notifier/p2p_notifier_unittest.cc

Issue 10837214: Refactor ModelTypePayloadMap and ObjectIdPayloadMap to StateMaps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test Created 8 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
« no previous file with comments | « sync/notifier/p2p_notifier.cc ('k') | sync/notifier/sync_notifier_factory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/p2p_notifier_unittest.cc
diff --git a/sync/notifier/p2p_notifier_unittest.cc b/sync/notifier/p2p_notifier_unittest.cc
index 97033ea72700633003e4b4974993ab09c1fe98b7..9ad6f8a186724b0ad311de5c83f85aac9d65b129 100644
--- a/sync/notifier/p2p_notifier_unittest.cc
+++ b/sync/notifier/p2p_notifier_unittest.cc
@@ -8,8 +8,9 @@
#include "jingle/notifier/listener/fake_push_client.h"
#include "sync/internal_api/public/base/model_type.h"
-#include "sync/internal_api/public/base/model_type_payload_map.h"
+#include "sync/internal_api/public/base/model_type_state_map.h"
#include "sync/notifier/mock_sync_notifier_observer.h"
+#include "sync/notifier/object_id_state_map_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
@@ -35,8 +36,8 @@ class P2PNotifierTest : public testing::Test {
p2p_notifier_.UnregisterHandler(&mock_observer_);
}
- ModelTypePayloadMap MakePayloadMap(ModelTypeSet types) {
- return ModelTypePayloadMapFromEnumSet(types, std::string());
+ ModelTypeStateMap MakeStateMap(ModelTypeSet types) {
+ return ModelTypeSetToStateMap(types, std::string());
}
// Simulate receiving all the notifications we sent out since last
@@ -145,7 +146,8 @@ TEST_F(P2PNotifierTest, NotificationsBasic) {
EXPECT_CALL(mock_observer_, OnNotificationsEnabled());
EXPECT_CALL(mock_observer_, OnIncomingNotification(
- ModelTypePayloadMapToObjectIdPayloadMap(MakePayloadMap(enabled_types)),
+ ModelTypeStateMapToObjectIdStateMap(MakeStateMap(
+ enabled_types)),
REMOTE_NOTIFICATION));
p2p_notifier_.UpdateRegisteredIds(&mock_observer_,
@@ -191,15 +193,15 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
EXPECT_CALL(mock_observer_, OnNotificationsEnabled());
EXPECT_CALL(mock_observer_,
OnIncomingNotification(
- ModelTypePayloadMapToObjectIdPayloadMap(
- MakePayloadMap(enabled_types)),
+ ModelTypeStateMapToObjectIdStateMap(
+ MakeStateMap(enabled_types)),
REMOTE_NOTIFICATION));
p2p_notifier_.UpdateRegisteredIds(&mock_observer_,
ModelTypeSetToObjectIdSet(enabled_types));
- const ModelTypePayloadMap& expected_payload_map =
- MakePayloadMap(expected_types);
+ const ModelTypeStateMap& expected_state_map =
+ MakeStateMap(expected_types);
p2p_notifier_.SetUniqueId("sender");
p2p_notifier_.UpdateCredentials("foo@bar.com", "fake_token");
@@ -218,7 +220,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
// Should be propagated.
Mock::VerifyAndClearExpectations(&mock_observer_);
EXPECT_CALL(mock_observer_, OnIncomingNotification(
- ModelTypePayloadMapToObjectIdPayloadMap(expected_payload_map),
+ ModelTypeStateMapToObjectIdStateMap(expected_state_map),
REMOTE_NOTIFICATION));
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender", NOTIFY_SELF, changed_types));
@@ -248,7 +250,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
// Should be propagated.
Mock::VerifyAndClearExpectations(&mock_observer_);
EXPECT_CALL(mock_observer_, OnIncomingNotification(
- ModelTypePayloadMapToObjectIdPayloadMap(expected_payload_map),
+ ModelTypeStateMapToObjectIdStateMap(expected_state_map),
REMOTE_NOTIFICATION));
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender2", NOTIFY_OTHERS, changed_types));
@@ -265,7 +267,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
// Should be propagated.
Mock::VerifyAndClearExpectations(&mock_observer_);
EXPECT_CALL(mock_observer_, OnIncomingNotification(
- ModelTypePayloadMapToObjectIdPayloadMap(expected_payload_map),
+ ModelTypeStateMapToObjectIdStateMap(expected_state_map),
REMOTE_NOTIFICATION));
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender", NOTIFY_ALL, changed_types));
@@ -275,7 +277,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
// Should be propagated.
Mock::VerifyAndClearExpectations(&mock_observer_);
EXPECT_CALL(mock_observer_, OnIncomingNotification(
- ModelTypePayloadMapToObjectIdPayloadMap(expected_payload_map),
+ ModelTypeStateMapToObjectIdStateMap(expected_state_map),
REMOTE_NOTIFICATION));
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender2", NOTIFY_ALL, changed_types));
« no previous file with comments | « sync/notifier/p2p_notifier.cc ('k') | sync/notifier/sync_notifier_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698