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

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

Issue 6249006: Turn password sync on by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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
===================================================================
--- chrome/browser/sync/profile_sync_test_util.h (revision 71392)
+++ chrome/browser/sync/profile_sync_test_util.h (working copy)
@@ -18,11 +18,13 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.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"
@@ -51,6 +53,10 @@
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) {
@@ -60,10 +66,33 @@
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();
+
+ sync_api::ReadNode root(&trans);
+ root_exists = root.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
@@ -97,6 +126,8 @@
}
~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