diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-29 03:29:18 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-29 03:29:18 +0000 |
commit | 0a561205646f2e75f860b9662d249a0924f3bad6 (patch) | |
tree | c4004601868f444c7bc6453c21867c4aa308224d /chrome/browser/sync/engine | |
parent | 7bd80241b862451b05566797f4ef6debf98f5c45 (diff) | |
download | chromium_src-0a561205646f2e75f860b9662d249a0924f3bad6.zip chromium_src-0a561205646f2e75f860b9662d249a0924f3bad6.tar.gz chromium_src-0a561205646f2e75f860b9662d249a0924f3bad6.tar.bz2 |
[Sync] Pass cache_guid() to invalidation client
This is so that the server can detect and suppress notifications
to the browser instance which initiated the change.
BUG=87846
TEST=
Review URL: http://codereview.chromium.org/7248023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90920 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/engine')
-rw-r--r-- | chrome/browser/sync/engine/syncapi.cc | 16 | ||||
-rw-r--r-- | chrome/browser/sync/engine/syncapi_unittest.cc | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc index cb06e13..51e603c 100644 --- a/chrome/browser/sync/engine/syncapi.cc +++ b/chrome/browser/sync/engine/syncapi.cc @@ -1934,17 +1934,21 @@ bool SyncManager::SyncInternal::SignIn(const SyncCredentials& credentials) { // Retrieve and set the sync notifier state. This should be done // only after OpenDirectory is called. syncable::ScopedDirLookup lookup(dir_manager(), username_for_share()); + std::string unique_id; std::string state; if (lookup.good()) { + unique_id = lookup->cache_guid(); state = lookup->GetAndClearNotificationState(); + VLOG(1) << "Read notification unique ID: " << unique_id; + if (VLOG_IS_ON(1)) { + std::string encoded_state; + base::Base64Encode(state, &encoded_state); + VLOG(1) << "Read notification state: " << encoded_state; + } } else { - LOG(ERROR) << "Could not read notification state"; - } - if (VLOG_IS_ON(1)) { - std::string encoded_state; - base::Base64Encode(state, &encoded_state); - VLOG(1) << "Read notification state: " << encoded_state; + LOG(ERROR) << "Could not read notification unique ID/state"; } + sync_notifier_->SetUniqueId(unique_id); sync_notifier_->SetState(state); UpdateCredentials(credentials); diff --git a/chrome/browser/sync/engine/syncapi_unittest.cc b/chrome/browser/sync/engine/syncapi_unittest.cc index 2ff2f53..438fe7a 100644 --- a/chrome/browser/sync/engine/syncapi_unittest.cc +++ b/chrome/browser/sync/engine/syncapi_unittest.cc @@ -677,6 +677,7 @@ class SyncNotifierMock : public sync_notifier::SyncNotifier { public: MOCK_METHOD1(AddObserver, void(sync_notifier::SyncNotifierObserver*)); MOCK_METHOD1(RemoveObserver, void(sync_notifier::SyncNotifierObserver*)); + MOCK_METHOD1(SetUniqueId, void(const std::string&)); MOCK_METHOD1(SetState, void(const std::string&)); MOCK_METHOD2(UpdateCredentials, void(const std::string&, const std::string&)); @@ -710,6 +711,7 @@ class SyncManagerTest : public testing::Test, sync_notifier_mock_ = new StrictMock<SyncNotifierMock>(); EXPECT_CALL(*sync_notifier_mock_, AddObserver(_)). WillOnce(Invoke(this, &SyncManagerTest::SyncNotifierAddObserver)); + EXPECT_CALL(*sync_notifier_mock_, SetUniqueId(_)); EXPECT_CALL(*sync_notifier_mock_, SetState("")); EXPECT_CALL(*sync_notifier_mock_, UpdateCredentials(credentials.email, credentials.sync_token)); |