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

Side by Side Diff: chrome/browser/sync/abstract_profile_sync_service_test.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix. And rebase Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" 5 #include "chrome/browser/sync/abstract_profile_sync_service_test.h"
6 6
7 #include "chrome/browser/sync/engine/syncapi.h" 7 #include "chrome/browser/sync/engine/syncapi.h"
8 #include "chrome/browser/sync/glue/autofill_model_associator.h"
9 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h"
10 #include "chrome/browser/sync/glue/password_model_associator.h"
11 #include "chrome/browser/sync/glue/preference_model_associator.h"
12 #include "chrome/browser/sync/glue/session_model_associator.h"
13 #include "chrome/browser/sync/glue/typed_url_model_associator.h"
14 #include "chrome/browser/sync/protocol/sync.pb.h" 8 #include "chrome/browser/sync/protocol/sync.pb.h"
15 #include "chrome/browser/sync/syncable/directory_manager.h" 9 #include "chrome/browser/sync/syncable/directory_manager.h"
16 #include "chrome/browser/sync/syncable/syncable.h" 10 #include "chrome/browser/sync/syncable/syncable.h"
17 #include "chrome/browser/sync/test_profile_sync_service.h" 11 #include "chrome/browser/sync/test_profile_sync_service.h"
18 #include "chrome/browser/sync/util/cryptographer.h" 12 #include "chrome/browser/sync/util/cryptographer.h"
19 #include "chrome/test/sync/engine/test_id_factory.h" 13 #include "chrome/test/sync/engine/test_id_factory.h"
20 14
21 using browser_sync::TestIdFactory; 15 using browser_sync::TestIdFactory;
22 using sync_api::UserShare; 16 using sync_api::UserShare;
23 using syncable::BASE_VERSION; 17 using syncable::BASE_VERSION;
24 using syncable::CREATE; 18 using syncable::CREATE;
25 using syncable::DirectoryManager; 19 using syncable::DirectoryManager;
26 using syncable::IS_DEL; 20 using syncable::IS_DEL;
27 using syncable::IS_DIR; 21 using syncable::IS_DIR;
28 using syncable::IS_UNAPPLIED_UPDATE; 22 using syncable::IS_UNAPPLIED_UPDATE;
29 using syncable::IS_UNSYNCED; 23 using syncable::IS_UNSYNCED;
30 using syncable::ModelType; 24 using syncable::ModelType;
31 using syncable::MutableEntry; 25 using syncable::MutableEntry;
32 using syncable::SERVER_IS_DIR; 26 using syncable::SERVER_IS_DIR;
33 using syncable::SERVER_VERSION; 27 using syncable::SERVER_VERSION;
34 using syncable::SPECIFICS; 28 using syncable::SPECIFICS;
35 using syncable::ScopedDirLookup; 29 using syncable::ScopedDirLookup;
36 using syncable::UNIQUE_SERVER_TAG; 30 using syncable::UNIQUE_SERVER_TAG;
37 using syncable::UNITTEST; 31 using syncable::UNITTEST;
38 using syncable::WriteTransaction; 32 using syncable::WriteTransaction;
39 33
40 const std::string ProfileSyncServiceTestHelper::GetTagForType( 34 const std::string ProfileSyncServiceTestHelper::GetTagForType(
41 ModelType model_type) { 35 ModelType model_type) {
42 switch (model_type) { 36 return syncable::ModelTypeToRootTag(model_type);
43 case syncable::AUTOFILL:
44 return browser_sync::kAutofillTag;
45 case syncable::AUTOFILL_PROFILE:
46 return browser_sync::kAutofillProfileTag;
47 case syncable::PREFERENCES:
48 return browser_sync::kPreferencesTag;
49 case syncable::PASSWORDS:
50 return browser_sync::kPasswordTag;
51 case syncable::NIGORI:
52 return browser_sync::kNigoriTag;
53 case syncable::TYPED_URLS:
54 return browser_sync::kTypedUrlTag;
55 case syncable::SESSIONS:
56 return browser_sync::kSessionsTag;
57 case syncable::BOOKMARKS:
58 return "google_chrome_bookmarks";
59 default:
60 NOTREACHED();
61 }
62 return std::string();
63 } 37 }
64 38
65 bool ProfileSyncServiceTestHelper::CreateRoot( 39 bool ProfileSyncServiceTestHelper::CreateRoot(
66 ModelType model_type, UserShare* user_share, 40 ModelType model_type, UserShare* user_share,
67 TestIdFactory* ids) { 41 TestIdFactory* ids) {
68 DirectoryManager* dir_manager = user_share->dir_manager.get(); 42 DirectoryManager* dir_manager = user_share->dir_manager.get();
69 43
70 ScopedDirLookup dir(dir_manager, user_share->name); 44 ScopedDirLookup dir(dir_manager, user_share->name);
71 if (!dir.good()) 45 if (!dir.good())
72 return false; 46 return false;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 104 }
131 105
132 CreateRootTask::~CreateRootTask() {} 106 CreateRootTask::~CreateRootTask() {}
133 void CreateRootTask::Run() { 107 void CreateRootTask::Run() {
134 success_ = test_->CreateRoot(model_type_); 108 success_ = test_->CreateRoot(model_type_);
135 } 109 }
136 110
137 bool CreateRootTask::success() { 111 bool CreateRootTask::success() {
138 return success_; 112 return success_;
139 } 113 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_prepopulate_data.cc ('k') | chrome/browser/sync/glue/app_data_type_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698