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

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

Issue 7918001: [Sync] Move ChangeRecord into its own file (change_record.{h,cc}) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
Index: chrome/browser/sync/profile_sync_service_session_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_session_unittest.cc b/chrome/browser/sync/profile_sync_service_session_unittest.cc
index bd2ef223d7aa3001fb2e0524ab80d878734a2190..228ee38823b22bc105eaaed6c99d4c33efe3e544 100644
--- a/chrome/browser/sync/profile_sync_service_session_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_session_unittest.cc
@@ -19,9 +19,9 @@
#include "chrome/browser/sync/glue/session_data_type_controller.h"
#include "chrome/browser/sync/glue/session_model_associator.h"
#include "chrome/browser/sync/glue/sync_backend_host.h"
+#include "chrome/browser/sync/internal_api/change_record.h"
#include "chrome/browser/sync/internal_api/read_node.h"
#include "chrome/browser/sync/internal_api/read_transaction.h"
-#include "chrome/browser/sync/internal_api/sync_manager.h"
#include "chrome/browser/sync/internal_api/write_transaction.h"
#include "chrome/browser/sync/profile_sync_factory_mock.h"
#include "chrome/browser/sync/profile_sync_test_util.h"
@@ -49,7 +49,7 @@ using browser_sync::SessionChangeProcessor;
using browser_sync::SessionDataTypeController;
using browser_sync::SessionModelAssociator;
using browser_sync::SyncBackendHost;
-using sync_api::SyncManager;
+using sync_api::ChangeRecord;
using testing::_;
using testing::Return;
using browser_sync::TestIdFactory;
@@ -155,6 +155,15 @@ class ProfileSyncServiceSessionTest
return true;
}
+ sync_api::ImmutableChangeRecordList MakeSingletonChangeRecordList(
+ int64 node_id, ChangeRecord::Action action) {
+ ChangeRecord record;
+ record.action = action;
+ record.id = node_id;
+ sync_api::ChangeRecordList records(1, record);
+ return sync_api::ImmutableChangeRecordList(&records);
+ }
+
BrowserThread io_thread_;
// Path used in testing.
ScopedTempDir temp_dir_;
@@ -355,13 +364,12 @@ TEST_F(ProfileSyncServiceSessionTest, UpdatedSyncNodeActionUpdate) {
ASSERT_TRUE(task.success());
int64 node_id = model_associator_->GetSyncIdFromSessionTag(
model_associator_->GetCurrentMachineTag());
- scoped_ptr<SyncManager::ChangeRecord> record(new SyncManager::ChangeRecord);
- record->action = SyncManager::ChangeRecord::ACTION_UPDATE;
- record->id = node_id;
ASSERT_FALSE(notified_of_update_);
{
sync_api::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare());
- change_processor_->ApplyChangesFromSyncModel(&trans, record.get(), 1);
+ change_processor_->ApplyChangesFromSyncModel(
+ &trans,
+ MakeSingletonChangeRecordList(node_id, ChangeRecord::ACTION_UPDATE));
}
ASSERT_TRUE(notified_of_update_);
}
@@ -374,13 +382,12 @@ TEST_F(ProfileSyncServiceSessionTest, UpdatedSyncNodeActionAdd) {
int64 node_id = model_associator_->GetSyncIdFromSessionTag(
model_associator_->GetCurrentMachineTag());
- scoped_ptr<SyncManager::ChangeRecord> record(new SyncManager::ChangeRecord);
- record->action = SyncManager::ChangeRecord::ACTION_ADD;
- record->id = node_id;
ASSERT_FALSE(notified_of_update_);
{
sync_api::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare());
- change_processor_->ApplyChangesFromSyncModel(&trans, record.get(), 1);
+ change_processor_->ApplyChangesFromSyncModel(
+ &trans,
+ MakeSingletonChangeRecordList(node_id, ChangeRecord::ACTION_ADD));
}
ASSERT_TRUE(notified_of_update_);
}
@@ -393,13 +400,12 @@ TEST_F(ProfileSyncServiceSessionTest, UpdatedSyncNodeActionDelete) {
int64 node_id = model_associator_->GetSyncIdFromSessionTag(
model_associator_->GetCurrentMachineTag());
- scoped_ptr<SyncManager::ChangeRecord> record(new SyncManager::ChangeRecord);
- record->action = SyncManager::ChangeRecord::ACTION_DELETE;
- record->id = node_id;
ASSERT_FALSE(notified_of_update_);
{
sync_api::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare());
- change_processor_->ApplyChangesFromSyncModel(&trans, record.get(), 1);
+ change_processor_->ApplyChangesFromSyncModel(
+ &trans,
+ MakeSingletonChangeRecordList(node_id, ChangeRecord::ACTION_DELETE));
}
ASSERT_TRUE(notified_of_update_);
}

Powered by Google App Engine
This is Rietveld 408576698