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

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

Issue 6375007: [Sync] Refactored ProfileSyncService and remove its backend() function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment 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
« no previous file with comments | « no previous file | chrome/browser/sync/abstract_profile_sync_service_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/abstract_profile_sync_service_test.h
diff --git a/chrome/browser/sync/abstract_profile_sync_service_test.h b/chrome/browser/sync/abstract_profile_sync_service_test.h
index a0f1276f36aaa6e9e5b8e541f3eb55a0b82d7b2d..522af540163518f0391b7b17244dcb662064f9ee 100644
--- a/chrome/browser/sync/abstract_profile_sync_service_test.h
+++ b/chrome/browser/sync/abstract_profile_sync_service_test.h
@@ -13,115 +13,37 @@
#include "base/task.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/net/gaia/token_service.h"
-#include "chrome/browser/sync/engine/syncapi.h"
-#include "chrome/browser/sync/glue/autofill_model_associator.h"
-#include "chrome/browser/sync/glue/autofill_profile_model_associator.h"
-#include "chrome/browser/sync/glue/password_model_associator.h"
-#include "chrome/browser/sync/glue/preference_model_associator.h"
-#include "chrome/browser/sync/glue/session_model_associator.h"
-#include "chrome/browser/sync/glue/typed_url_model_associator.h"
#include "chrome/browser/sync/profile_sync_factory_mock.h"
-#include "chrome/browser/sync/protocol/sync.pb.h"
-#include "chrome/browser/sync/syncable/directory_manager.h"
#include "chrome/browser/sync/syncable/model_type.h"
-#include "chrome/browser/sync/syncable/syncable.h"
-#include "chrome/browser/sync/test_profile_sync_service.h"
-#include "chrome/browser/sync/util/cryptographer.h"
-#include "chrome/test/profile_mock.h"
-#include "chrome/test/sync/engine/test_id_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
-using browser_sync::TestIdFactory;
-using sync_api::UserShare;
-using syncable::BASE_VERSION;
-using syncable::CREATE;
-using syncable::DirectoryManager;
-using syncable::IS_DEL;
-using syncable::IS_DIR;
-using syncable::IS_UNAPPLIED_UPDATE;
-using syncable::IS_UNSYNCED;
-using syncable::ModelType;
-using syncable::MutableEntry;
-using syncable::SERVER_IS_DIR;
-using syncable::SERVER_VERSION;
-using syncable::SPECIFICS;
-using syncable::ScopedDirLookup;
-using syncable::UNIQUE_SERVER_TAG;
-using syncable::UNITTEST;
-using syncable::WriteTransaction;
+class ProfileSyncService;
+class TestProfileSyncService;
+
+namespace browser_sync {
+class TestIdFactory;
+} // namespace browser_sync
+
+namespace sync_api {
+struct UserShare;
+} // namespace sync_api
class ProfileSyncServiceTestHelper {
public:
- static const std::string GetTagForType(ModelType model_type) {
- switch (model_type) {
- case syncable::AUTOFILL:
- return browser_sync::kAutofillTag;
- case syncable::AUTOFILL_PROFILE:
- return browser_sync::kAutofillProfileTag;
- case syncable::PREFERENCES:
- return browser_sync::kPreferencesTag;
- case syncable::PASSWORDS:
- return browser_sync::kPasswordTag;
- case syncable::NIGORI:
- return browser_sync::kNigoriTag;
- case syncable::TYPED_URLS:
- return browser_sync::kTypedUrlTag;
- case syncable::SESSIONS:
- return browser_sync::kSessionsTag;
- case syncable::BOOKMARKS:
- return "google_chrome_bookmarks";
- default:
- NOTREACHED();
- }
- return std::string();
- }
-
- static bool CreateRoot(ModelType model_type, ProfileSyncService* service,
- TestIdFactory* ids) {
- UserShare* user_share = service->backend()->GetUserShareHandle();
- DirectoryManager* dir_manager = user_share->dir_manager.get();
-
- ScopedDirLookup dir(dir_manager, user_share->name);
- if (!dir.good())
- return false;
-
- std::string tag_name = GetTagForType(model_type);
-
- WriteTransaction wtrans(dir, UNITTEST, __FILE__, __LINE__);
- MutableEntry node(&wtrans,
- CREATE,
- wtrans.root_id(),
- tag_name);
- node.Put(UNIQUE_SERVER_TAG, tag_name);
- node.Put(IS_DIR, true);
- node.Put(SERVER_IS_DIR, false);
- node.Put(IS_UNSYNCED, false);
- node.Put(IS_UNAPPLIED_UPDATE, false);
- node.Put(SERVER_VERSION, 20);
- node.Put(BASE_VERSION, 20);
- node.Put(IS_DEL, false);
- node.Put(syncable::ID, ids->MakeServer(tag_name));
- sync_pb::EntitySpecifics specifics;
- syncable::AddDefaultExtensionValue(model_type, &specifics);
- node.Put(SPECIFICS, specifics);
-
- return true;
- }
+ static const std::string GetTagForType(syncable::ModelType model_type);
+
+ static bool CreateRoot(syncable::ModelType model_type,
+ sync_api::UserShare* service,
+ browser_sync::TestIdFactory* ids);
};
class AbstractProfileSyncServiceTest : public testing::Test {
public:
- AbstractProfileSyncServiceTest()
- : ui_thread_(BrowserThread::UI, &message_loop_) {}
+ AbstractProfileSyncServiceTest();
- bool CreateRoot(ModelType model_type) {
- return ProfileSyncServiceTestHelper::CreateRoot(model_type,
- service_.get(),
- service_->id_factory());
- }
+ bool CreateRoot(syncable::ModelType model_type);
protected:
-
MessageLoopForUI message_loop_;
BrowserThread ui_thread_;
ProfileSyncFactoryMock factory_;
@@ -131,20 +53,17 @@ class AbstractProfileSyncServiceTest : public testing::Test {
class CreateRootTask : public Task {
public:
- CreateRootTask(AbstractProfileSyncServiceTest* test, ModelType model_type)
- : test_(test), model_type_(model_type), success_(false) {
- }
+ CreateRootTask(AbstractProfileSyncServiceTest* test,
+ syncable::ModelType model_type);
- virtual ~CreateRootTask() {}
- virtual void Run() {
- success_ = test_->CreateRoot(model_type_);
- }
+ virtual ~CreateRootTask();
+ virtual void Run();
- bool success() { return success_; }
+ bool success();
private:
AbstractProfileSyncServiceTest* test_;
- ModelType model_type_;
+ syncable::ModelType model_type_;
bool success_;
};
« no previous file with comments | « no previous file | chrome/browser/sync/abstract_profile_sync_service_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698