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

Unified Diff: chrome/browser/sync/profile_sync_test_util.h

Issue 3913005: sync: enable password sync by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/debug
Patch Set: fix mac 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
Index: chrome/browser/sync/profile_sync_test_util.h
diff --git a/chrome/browser/sync/profile_sync_test_util.h b/chrome/browser/sync/profile_sync_test_util.h
index aa8584e58cbb01280e8b8612c275e66210d9f056..6e9b77a955d43940b586cfca9a74f1a2ce5b3882 100644
--- a/chrome/browser/sync/profile_sync_test_util.h
+++ b/chrome/browser/sync/profile_sync_test_util.h
@@ -19,11 +19,13 @@
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/webdata/web_database.h"
+#include "chrome/browser/sync/abstract_profile_sync_service_test.h"
#include "chrome/browser/sync/glue/bookmark_change_processor.h"
#include "chrome/browser/sync/glue/bookmark_data_type_controller.h"
#include "chrome/browser/sync/glue/bookmark_model_associator.h"
#include "chrome/browser/sync/glue/change_processor.h"
#include "chrome/browser/sync/glue/data_type_manager_impl.h"
+#include "chrome/browser/sync/glue/sync_backend_host.h"
#include "chrome/browser/sync/profile_sync_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/unrecoverable_error_handler.h"
@@ -52,6 +54,8 @@ ACTION_P(InvokeTask, task) {
class TestModelAssociatorHelper {
public:
+ TestModelAssociatorHelper(browser_sync::TestIdFactory* id_factory)
+ : id_factory_(id_factory) {}
template <class ModelAssociatorImpl>
bool GetSyncIdForTaggedNode(ModelAssociatorImpl* associator,
const std::string& tag, int64* sync_id) {
@@ -61,10 +65,32 @@ class TestModelAssociatorHelper {
return false;
}
- sync_api::WriteTransaction trans(
+ browser_sync::SyncBackendHost::UserShareHandle share(
associator->sync_service()->backend()->GetUserShareHandle());
+ bool root_exists = false;
+ ModelType type = ModelAssociatorImpl::model_type();
+ {
+ sync_api::WriteTransaction trans(share);
+ sync_api::ReadNode uber_root(&trans);
+ uber_root.InitByRootLookup();
+
+ // Look up the top level data type node.
+ sync_api::ReadNode root_lookup(&trans);
+ root_exists = root_lookup.InitByTagLookup(
+ ProfileSyncServiceTestHelper::GetTagForType(type));
+ }
+
+ if (!root_exists) {
+ bool created = ProfileSyncServiceTestHelper::CreateRoot(type,
+ associator->sync_service(), id_factory_);
+ if (!created)
+ return false;
+ }
+
+ sync_api::WriteTransaction trans(share);
sync_api::ReadNode root(&trans);
- root.InitByRootLookup();
+ EXPECT_TRUE(root.InitByTagLookup(
+ ProfileSyncServiceTestHelper::GetTagForType(type)));
// First, try to find a node with the title among the root's children.
// This will be the case if we are testing model persistence, and
@@ -98,6 +124,8 @@ class TestModelAssociatorHelper {
}
~TestModelAssociatorHelper() {}
+ private:
+ browser_sync::TestIdFactory* id_factory_;
};
class ProfileSyncServiceObserverMock : public ProfileSyncServiceObserver {
« no previous file with comments | « chrome/browser/sync/profile_sync_service_unittest.cc ('k') | chrome/browser/sync/test_profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698