summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/profile_sync_test_util.h
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-15 01:49:54 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-15 01:49:54 +0000
commit3fd04f5fba94f0312e1ba5da0aca9fdd56578145 (patch)
tree09f7c30f34f9f89dd32e0048bd328ab3b7583c57 /chrome/browser/sync/profile_sync_test_util.h
parent3372d98ec174306ff2beb1942216200ad3c8722b (diff)
downloadchromium_src-3fd04f5fba94f0312e1ba5da0aca9fdd56578145.zip
chromium_src-3fd04f5fba94f0312e1ba5da0aca9fdd56578145.tar.gz
chromium_src-3fd04f5fba94f0312e1ba5da0aca9fdd56578145.tar.bz2
Turn password sync on by default.
BUG=61252 TEST=none Review URL: http://codereview.chromium.org/6249006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/profile_sync_test_util.h')
-rw-r--r--chrome/browser/sync/profile_sync_test_util.h35
1 files changed, 33 insertions, 2 deletions
diff --git a/chrome/browser/sync/profile_sync_test_util.h b/chrome/browser/sync/profile_sync_test_util.h
index 4e28efa..80d1fbf 100644
--- a/chrome/browser/sync/profile_sync_test_util.h
+++ b/chrome/browser/sync/profile_sync_test_util.h
@@ -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 @@ 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) {
@@ -60,10 +66,33 @@ 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();
+
+ 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 @@ class TestModelAssociatorHelper {
}
~TestModelAssociatorHelper() {}
+ private:
+ browser_sync::TestIdFactory* id_factory_;
};
class ProfileSyncServiceObserverMock : public ProfileSyncServiceObserver {