summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/engine
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/sync/engine')
-rw-r--r--chrome/browser/sync/engine/syncapi.cc16
-rw-r--r--chrome/browser/sync/engine/syncapi_unittest.cc2
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));