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

Unified Diff: chrome/browser/sync/profile_sync_service_session_unittest.cc

Issue 3825005: Fix syncing of sessions. Numerous changes have been made. Currently, the mode... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebased again Created 10 years, 2 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 | « chrome/browser/sync/glue/session_model_associator.cc ('k') | chrome/browser/sync/sync_setup_flow.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service_session_unittest.cc
===================================================================
--- chrome/browser/sync/profile_sync_service_session_unittest.cc (revision 63212)
+++ chrome/browser/sync/profile_sync_service_session_unittest.cc (working copy)
@@ -56,8 +56,7 @@
public:
ProfileSyncServiceSessionTest()
: window_bounds_(0, 1, 2, 3),
- notified_of_update_(false),
- notification_sync_id_(0) {}
+ notified_of_update_(false) {}
ProfileSyncService* sync_service() { return sync_service_.get(); }
@@ -76,24 +75,15 @@
service()->SetWindowBounds(window_id_, window_bounds_, false);
registrar_.Add(this, NotificationType::FOREIGN_SESSION_UPDATED,
NotificationService::AllSources());
- registrar_.Add(this, NotificationType::FOREIGN_SESSION_DELETED,
- NotificationService::AllSources());
}
void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
switch (type.value) {
- case NotificationType::FOREIGN_SESSION_UPDATED: {
+ case NotificationType::FOREIGN_SESSION_UPDATED:
notified_of_update_ = true;
- notification_sync_id_ = *Details<int64>(details).ptr();
break;
- }
- case NotificationType::FOREIGN_SESSION_DELETED: {
- notified_of_update_ = true;
- notification_sync_id_ = -1;
- break;
- }
default:
NOTREACHED();
break;
@@ -147,7 +137,6 @@
TestIdFactory ids_;
const gfx::Rect window_bounds_;
bool notified_of_update_;
- int64 notification_sync_id_;
NotificationRegistrar registrar_;
};
@@ -236,7 +225,7 @@
// Check that this machine's data is not included in the foreign windows.
ScopedVector<ForeignSession> foreign_sessions;
- model_associator_->GetSessionDataFromSyncModel(&foreign_sessions.get());
+ model_associator_->GetSessionData(&foreign_sessions.get());
ASSERT_EQ(foreign_sessions.size(), 0U);
// Get the windows for this machine from the node and check that they were
@@ -309,6 +298,7 @@
sync_api::ReadNode root(&trans);
ASSERT_TRUE(root.InitByTagLookup(kSessionsTag));
model_associator_->UpdateSyncModel(&specifics, &trans, &root);
+ model_associator_->UpdateFromSyncModel(&trans);
}
// Check that the foreign session was written to a node and retrieve the data.
@@ -320,8 +310,8 @@
model_associator_->GetChromeNodeFromSyncId(sync_id));
ASSERT_TRUE(sync_specifics != NULL);
ScopedVector<ForeignSession> foreign_sessions;
- model_associator_->GetSessionDataFromSyncModel(&foreign_sessions.get());
- ASSERT_EQ(foreign_sessions.size(), 1U);
+ model_associator_->GetSessionData(&foreign_sessions.get());
+ ASSERT_EQ(1U, foreign_sessions.size());
ASSERT_EQ(1U, foreign_sessions[0]->windows.size());
ASSERT_EQ(1U, foreign_sessions[0]->windows[0]->tabs.size());
ASSERT_EQ(1U, foreign_sessions[0]->windows[0]->tabs[0]->navigations.size());
@@ -364,13 +354,11 @@
scoped_ptr<SyncManager::ChangeRecord> record(new SyncManager::ChangeRecord);
record->action = SyncManager::ChangeRecord::ACTION_UPDATE;
record->id = node_id;
- ASSERT_EQ(notification_sync_id_, 0);
ASSERT_FALSE(notified_of_update_);
{
sync_api::WriteTransaction trans(backend()->GetUserShareHandle());
change_processor_->ApplyChangesFromSyncModel(&trans, record.get(), 1);
}
- ASSERT_EQ(notification_sync_id_, node_id);
ASSERT_TRUE(notified_of_update_);
}
@@ -385,13 +373,11 @@
scoped_ptr<SyncManager::ChangeRecord> record(new SyncManager::ChangeRecord);
record->action = SyncManager::ChangeRecord::ACTION_ADD;
record->id = node_id;
- ASSERT_EQ(notification_sync_id_, 0);
ASSERT_FALSE(notified_of_update_);
{
sync_api::WriteTransaction trans(backend()->GetUserShareHandle());
change_processor_->ApplyChangesFromSyncModel(&trans, record.get(), 1);
}
- ASSERT_EQ(notification_sync_id_, node_id);
ASSERT_TRUE(notified_of_update_);
}
@@ -406,13 +392,11 @@
scoped_ptr<SyncManager::ChangeRecord> record(new SyncManager::ChangeRecord);
record->action = SyncManager::ChangeRecord::ACTION_DELETE;
record->id = node_id;
- ASSERT_EQ(notification_sync_id_, 0);
ASSERT_FALSE(notified_of_update_);
{
sync_api::WriteTransaction trans(backend()->GetUserShareHandle());
change_processor_->ApplyChangesFromSyncModel(&trans, record.get(), 1);
}
- ASSERT_EQ(notification_sync_id_, -1);
ASSERT_TRUE(notified_of_update_);
}
« no previous file with comments | « chrome/browser/sync/glue/session_model_associator.cc ('k') | chrome/browser/sync/sync_setup_flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698