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

Side by Side Diff: chrome/browser/sync/test_profile_sync_service.h

Issue 3305003: New authorization framework for sync. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_
6 #define CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ 6 #define CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 MOCK_METHOD0(RequestPause, bool()); 95 MOCK_METHOD0(RequestPause, bool());
96 MOCK_METHOD0(RequestResume, bool()); 96 MOCK_METHOD0(RequestResume, bool());
97 MOCK_METHOD0(RequestNudge, void()); 97 MOCK_METHOD0(RequestNudge, void());
98 98
99 void SetInitialSyncEndedForEnabledTypes() { 99 void SetInitialSyncEndedForEnabledTypes() {
100 UserShare* user_share = core_->syncapi()->GetUserShare(); 100 UserShare* user_share = core_->syncapi()->GetUserShare();
101 DirectoryManager* dir_manager = user_share->dir_manager.get(); 101 DirectoryManager* dir_manager = user_share->dir_manager.get();
102 102
103 ScopedDirLookup dir(dir_manager, user_share->authenticated_name); 103 ScopedDirLookup dir(dir_manager, user_share->name);
104 if (!dir.good()) 104 if (!dir.good())
105 FAIL(); 105 FAIL();
106 106
107 ModelSafeRoutingInfo enabled_types; 107 ModelSafeRoutingInfo enabled_types;
108 GetModelSafeRoutingInfo(&enabled_types); 108 GetModelSafeRoutingInfo(&enabled_types);
109 for (ModelSafeRoutingInfo::const_iterator i = enabled_types.begin(); 109 for (ModelSafeRoutingInfo::const_iterator i = enabled_types.begin();
110 i != enabled_types.end(); ++i) { 110 i != enabled_types.end(); ++i) {
111 dir->set_initial_sync_ended_for_type(i->first, true); 111 dir->set_initial_sync_ended_for_type(i->first, true);
112 } 112 }
113 } 113 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return new browser_sync::TestHttpBridgeFactory; 147 return new browser_sync::TestHttpBridgeFactory;
148 } 148 }
149 149
150 virtual void InitCore(const Core::DoInitializeOptions& options) { 150 virtual void InitCore(const Core::DoInitializeOptions& options) {
151 std::wstring user = L"testuser"; 151 std::wstring user = L"testuser";
152 core_loop()->PostTask(FROM_HERE, 152 core_loop()->PostTask(FROM_HERE,
153 NewRunnableMethod(core_.get(), 153 NewRunnableMethod(core_.get(),
154 &SyncBackendHost::Core::DoInitializeForTest, 154 &SyncBackendHost::Core::DoInitializeForTest,
155 user, 155 user,
156 options.http_bridge_factory, 156 options.http_bridge_factory,
157 options.auth_http_bridge_factory,
158 options.delete_sync_data_folder, 157 options.delete_sync_data_folder,
159 browser_sync::kDefaultNotificationMethod)); 158 browser_sync::kDefaultNotificationMethod));
160 159
161 // TODO(akalin): Figure out a better way to do this. 160 // TODO(akalin): Figure out a better way to do this.
162 if (synchronous_init_) { 161 if (synchronous_init_) {
163 // The SyncBackend posts a task to the current loop when 162 // The SyncBackend posts a task to the current loop when
164 // initialization completes. 163 // initialization completes.
165 MessageLoop::current()->Run(); 164 MessageLoop::current()->Run();
166 } 165 }
167 } 166 }
(...skipping 11 matching lines...) Expand all
179 bool synchronous_init_; 178 bool synchronous_init_;
180 179
181 }; 180 };
182 181
183 } // namespace browser_sync 182 } // namespace browser_sync
184 183
185 class TestProfileSyncService : public ProfileSyncService { 184 class TestProfileSyncService : public ProfileSyncService {
186 public: 185 public:
187 TestProfileSyncService(ProfileSyncFactory* factory, 186 TestProfileSyncService(ProfileSyncFactory* factory,
188 Profile* profile, 187 Profile* profile,
189 bool bootstrap_sync_authentication, 188 const std::string& test_user,
190 bool synchronous_backend_initialization, 189 bool synchronous_backend_initialization,
191 Task* initial_condition_setup_task) 190 Task* initial_condition_setup_task)
192 : ProfileSyncService(factory, profile, bootstrap_sync_authentication), 191 : ProfileSyncService(factory, profile,
192 !test_user.empty() ?
193 test_user : ""),
193 synchronous_backend_initialization_( 194 synchronous_backend_initialization_(
194 synchronous_backend_initialization), 195 synchronous_backend_initialization),
195 synchronous_sync_configuration_(false), 196 synchronous_sync_configuration_(false),
196 num_expected_resumes_(1), 197 num_expected_resumes_(1),
197 num_expected_pauses_(1), 198 num_expected_pauses_(1),
198 initial_condition_setup_task_(initial_condition_setup_task), 199 initial_condition_setup_task_(initial_condition_setup_task),
199 set_initial_sync_ended_on_init_(true) { 200 set_initial_sync_ended_on_init_(true) {
200 RegisterPreferences(); 201 RegisterPreferences();
201 SetSyncSetupCompleted(); 202 SetSyncSetupCompleted();
202 } 203 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 bool synchronous_sync_configuration_; 258 bool synchronous_sync_configuration_;
258 bool set_expect_resume_expectations_; 259 bool set_expect_resume_expectations_;
259 int num_expected_resumes_; 260 int num_expected_resumes_;
260 int num_expected_pauses_; 261 int num_expected_pauses_;
261 262
262 scoped_ptr<Task> initial_condition_setup_task_; 263 scoped_ptr<Task> initial_condition_setup_task_;
263 bool set_initial_sync_ended_on_init_; 264 bool set_initial_sync_ended_on_init_;
264 }; 265 };
265 266
266 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ 267 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698