| Index: chrome/browser/sync/glue/chrome_sync_notification_bridge_unittest.cc
|
| diff --git a/chrome/browser/sync/glue/chrome_sync_notification_bridge_unittest.cc b/chrome/browser/sync/glue/chrome_sync_notification_bridge_unittest.cc
|
| index 382e63c1cb065955915314222c8441f12622117c..1fabd18050830a82dc465fd234f601c7816d66a3 100644
|
| --- a/chrome/browser/sync/glue/chrome_sync_notification_bridge_unittest.cc
|
| +++ b/chrome/browser/sync/glue/chrome_sync_notification_bridge_unittest.cc
|
| @@ -22,9 +22,9 @@
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/test/test_browser_thread.h"
|
| #include "sync/internal_api/public/base/model_type.h"
|
| -#include "sync/internal_api/public/base/model_type_state_map.h"
|
| +#include "sync/internal_api/public/base/model_type_invalidation_map.h"
|
| #include "sync/notifier/fake_invalidation_handler.h"
|
| -#include "sync/notifier/object_id_state_map_test_util.h"
|
| +#include "sync/notifier/object_id_invalidation_map_test_util.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -68,14 +68,14 @@ class ChromeSyncNotificationBridgeTest : public testing::Test {
|
| }
|
|
|
| void VerifyAndDestroyObserver(
|
| - const syncer::ModelTypeStateMap& expected_states,
|
| + const syncer::ModelTypeInvalidationMap& expected_invalidations,
|
| syncer::IncomingInvalidationSource expected_source) {
|
| ASSERT_TRUE(sync_thread_.message_loop_proxy()->PostTask(
|
| FROM_HERE,
|
| base::Bind(&ChromeSyncNotificationBridgeTest::
|
| VerifyAndDestroyObserverOnSyncThread,
|
| base::Unretained(this),
|
| - expected_states,
|
| + expected_invalidations,
|
| expected_source)));
|
| BlockForSyncThread();
|
| }
|
| @@ -102,25 +102,27 @@ class ChromeSyncNotificationBridgeTest : public testing::Test {
|
|
|
| void TriggerRefreshNotification(
|
| int type,
|
| - const syncer::ModelTypeStateMap& state_map) {
|
| + const syncer::ModelTypeInvalidationMap& invalidation_map) {
|
| content::NotificationService::current()->Notify(
|
| type,
|
| content::Source<Profile>(&mock_profile_),
|
| - content::Details<const syncer::ModelTypeStateMap>(&state_map));
|
| + content::Details<const syncer::ModelTypeInvalidationMap>(
|
| + &invalidation_map));
|
| BlockForSyncThread();
|
| }
|
|
|
| private:
|
| void VerifyAndDestroyObserverOnSyncThread(
|
| - const syncer::ModelTypeStateMap& expected_states,
|
| + const syncer::ModelTypeInvalidationMap& expected_invalidations,
|
| syncer::IncomingInvalidationSource expected_source) {
|
| DCHECK(sync_thread_.message_loop_proxy()->RunsTasksOnCurrentThread());
|
| if (sync_handler_.get()) {
|
| sync_handler_notification_success_ =
|
| (sync_handler_->GetInvalidationCount() == 1) &&
|
| - ObjectIdStateMapEquals(
|
| - sync_handler_->GetLastInvalidationIdStateMap(),
|
| - syncer::ModelTypeStateMapToObjectIdStateMap(expected_states)) &&
|
| + ObjectIdInvalidationMapEquals(
|
| + sync_handler_->GetLastInvalidationMap(),
|
| + syncer::ModelTypeInvalidationMapToObjectIdInvalidationMap(
|
| + expected_invalidations)) &&
|
| (sync_handler_->GetLastInvalidationSource() == expected_source);
|
| bridge_->UnregisterHandler(sync_handler_.get());
|
| } else {
|
| @@ -167,28 +169,28 @@ class ChromeSyncNotificationBridgeTest : public testing::Test {
|
| // invalidation, and ensures the bridge posts a LOCAL_INVALIDATION
|
| // with the proper state to it.
|
| TEST_F(ChromeSyncNotificationBridgeTest, LocalNotification) {
|
| - syncer::ModelTypeStateMap state_map;
|
| - state_map.insert(
|
| - std::make_pair(syncer::SESSIONS, syncer::InvalidationState()));
|
| + const syncer::ModelTypeSet types(syncer::SESSIONS);
|
| + const syncer::ModelTypeInvalidationMap& invalidation_map =
|
| + ModelTypeSetToInvalidationMap(types, std::string());
|
| CreateObserver();
|
| UpdateEnabledTypes(syncer::ModelTypeSet(syncer::SESSIONS));
|
| TriggerRefreshNotification(chrome::NOTIFICATION_SYNC_REFRESH_LOCAL,
|
| - state_map);
|
| - VerifyAndDestroyObserver(state_map, syncer::LOCAL_INVALIDATION);
|
| + invalidation_map);
|
| + VerifyAndDestroyObserver(invalidation_map, syncer::LOCAL_INVALIDATION);
|
| }
|
|
|
| // Adds an observer on the sync thread, triggers a remote refresh
|
| // invalidation, and ensures the bridge posts a REMOTE_INVALIDATION
|
| // with the proper state to it.
|
| TEST_F(ChromeSyncNotificationBridgeTest, RemoteNotification) {
|
| - syncer::ModelTypeStateMap state_map;
|
| - state_map.insert(
|
| - std::make_pair(syncer::SESSIONS, syncer::InvalidationState()));
|
| + const syncer::ModelTypeSet types(syncer::SESSIONS);
|
| + const syncer::ModelTypeInvalidationMap& invalidation_map =
|
| + ModelTypeSetToInvalidationMap(types, std::string());
|
| CreateObserver();
|
| UpdateEnabledTypes(syncer::ModelTypeSet(syncer::SESSIONS));
|
| TriggerRefreshNotification(chrome::NOTIFICATION_SYNC_REFRESH_REMOTE,
|
| - state_map);
|
| - VerifyAndDestroyObserver(state_map, syncer::REMOTE_INVALIDATION);
|
| + invalidation_map);
|
| + VerifyAndDestroyObserver(invalidation_map, syncer::REMOTE_INVALIDATION);
|
| }
|
|
|
| // Adds an observer on the sync thread, triggers a local refresh
|
| @@ -197,14 +199,14 @@ TEST_F(ChromeSyncNotificationBridgeTest, RemoteNotification) {
|
| TEST_F(ChromeSyncNotificationBridgeTest, LocalNotificationEmptyPayloadMap) {
|
| const syncer::ModelTypeSet enabled_types(
|
| syncer::BOOKMARKS, syncer::PASSWORDS);
|
| - const syncer::ModelTypeStateMap enabled_types_state_map =
|
| - syncer::ModelTypeSetToStateMap(enabled_types, std::string());
|
| + const syncer::ModelTypeInvalidationMap enabled_types_invalidation_map =
|
| + syncer::ModelTypeSetToInvalidationMap(enabled_types, std::string());
|
| CreateObserver();
|
| UpdateEnabledTypes(enabled_types);
|
| TriggerRefreshNotification(chrome::NOTIFICATION_SYNC_REFRESH_LOCAL,
|
| - syncer::ModelTypeStateMap());
|
| + syncer::ModelTypeInvalidationMap());
|
| VerifyAndDestroyObserver(
|
| - enabled_types_state_map, syncer::LOCAL_INVALIDATION);
|
| + enabled_types_invalidation_map, syncer::LOCAL_INVALIDATION);
|
| }
|
|
|
| // Adds an observer on the sync thread, triggers a remote refresh
|
| @@ -213,14 +215,14 @@ TEST_F(ChromeSyncNotificationBridgeTest, LocalNotificationEmptyPayloadMap) {
|
| TEST_F(ChromeSyncNotificationBridgeTest, RemoteNotificationEmptyPayloadMap) {
|
| const syncer::ModelTypeSet enabled_types(
|
| syncer::BOOKMARKS, syncer::TYPED_URLS);
|
| - const syncer::ModelTypeStateMap enabled_types_state_map =
|
| - syncer::ModelTypeSetToStateMap(enabled_types, std::string());
|
| + const syncer::ModelTypeInvalidationMap enabled_types_invalidation_map =
|
| + syncer::ModelTypeSetToInvalidationMap(enabled_types, std::string());
|
| CreateObserver();
|
| UpdateEnabledTypes(enabled_types);
|
| TriggerRefreshNotification(chrome::NOTIFICATION_SYNC_REFRESH_REMOTE,
|
| - syncer::ModelTypeStateMap());
|
| + syncer::ModelTypeInvalidationMap());
|
| VerifyAndDestroyObserver(
|
| - enabled_types_state_map, syncer::REMOTE_INVALIDATION);
|
| + enabled_types_invalidation_map, syncer::REMOTE_INVALIDATION);
|
| }
|
|
|
| } // namespace
|
|
|