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

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

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/signin/signin_manager.h" 9 #include "chrome/browser/signin/signin_manager.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 service_->UnsuppressAndStart(); 238 service_->UnsuppressAndStart();
239 EXPECT_TRUE(service_->sync_initialized()); 239 EXPECT_TRUE(service_->sync_initialized());
240 EXPECT_FALSE(profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart)); 240 EXPECT_FALSE(profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
241 } 241 }
242 242
243 TEST_F(ProfileSyncServiceTest, JsControllerHandlersBasic) { 243 TEST_F(ProfileSyncServiceTest, JsControllerHandlersBasic) {
244 StartSyncService(); 244 StartSyncService();
245 EXPECT_TRUE(service_->sync_initialized()); 245 EXPECT_TRUE(service_->sync_initialized());
246 EXPECT_TRUE(service_->GetBackendForTest() != NULL); 246 EXPECT_TRUE(service_->GetBackendForTest() != NULL);
247 247
248 csync::JsController* js_controller = service_->GetJsController(); 248 syncer::JsController* js_controller = service_->GetJsController();
249 StrictMock<csync::MockJsEventHandler> event_handler; 249 StrictMock<syncer::MockJsEventHandler> event_handler;
250 js_controller->AddJsEventHandler(&event_handler); 250 js_controller->AddJsEventHandler(&event_handler);
251 js_controller->RemoveJsEventHandler(&event_handler); 251 js_controller->RemoveJsEventHandler(&event_handler);
252 } 252 }
253 253
254 TEST_F(ProfileSyncServiceTest, 254 TEST_F(ProfileSyncServiceTest,
255 JsControllerHandlersDelayedBackendInitialization) { 255 JsControllerHandlersDelayedBackendInitialization) {
256 StartSyncServiceAndSetInitialSyncEnded(true, false, false, true, true, false); 256 StartSyncServiceAndSetInitialSyncEnded(true, false, false, true, true, false);
257 257
258 StrictMock<csync::MockJsEventHandler> event_handler; 258 StrictMock<syncer::MockJsEventHandler> event_handler;
259 EXPECT_CALL(event_handler, HandleJsEvent(_, _)).Times(AtLeast(1)); 259 EXPECT_CALL(event_handler, HandleJsEvent(_, _)).Times(AtLeast(1));
260 260
261 EXPECT_EQ(NULL, service_->GetBackendForTest()); 261 EXPECT_EQ(NULL, service_->GetBackendForTest());
262 EXPECT_FALSE(service_->sync_initialized()); 262 EXPECT_FALSE(service_->sync_initialized());
263 263
264 csync::JsController* js_controller = service_->GetJsController(); 264 syncer::JsController* js_controller = service_->GetJsController();
265 js_controller->AddJsEventHandler(&event_handler); 265 js_controller->AddJsEventHandler(&event_handler);
266 // Since we're doing synchronous initialization, backend should be 266 // Since we're doing synchronous initialization, backend should be
267 // initialized by this call. 267 // initialized by this call.
268 IssueTestTokens(); 268 IssueTestTokens();
269 EXPECT_TRUE(service_->sync_initialized()); 269 EXPECT_TRUE(service_->sync_initialized());
270 js_controller->RemoveJsEventHandler(&event_handler); 270 js_controller->RemoveJsEventHandler(&event_handler);
271 } 271 }
272 272
273 TEST_F(ProfileSyncServiceTest, JsControllerProcessJsMessageBasic) { 273 TEST_F(ProfileSyncServiceTest, JsControllerProcessJsMessageBasic) {
274 StartSyncService(); 274 StartSyncService();
275 275
276 StrictMock<csync::MockJsReplyHandler> reply_handler; 276 StrictMock<syncer::MockJsReplyHandler> reply_handler;
277 277
278 ListValue arg_list1; 278 ListValue arg_list1;
279 arg_list1.Append(Value::CreateBooleanValue(false)); 279 arg_list1.Append(Value::CreateBooleanValue(false));
280 csync::JsArgList args1(&arg_list1); 280 syncer::JsArgList args1(&arg_list1);
281 EXPECT_CALL(reply_handler, 281 EXPECT_CALL(reply_handler,
282 HandleJsReply("getNotificationState", HasArgs(args1))); 282 HandleJsReply("getNotificationState", HasArgs(args1)));
283 283
284 { 284 {
285 csync::JsController* js_controller = service_->GetJsController(); 285 syncer::JsController* js_controller = service_->GetJsController();
286 js_controller->ProcessJsMessage("getNotificationState", args1, 286 js_controller->ProcessJsMessage("getNotificationState", args1,
287 reply_handler.AsWeakHandle()); 287 reply_handler.AsWeakHandle());
288 } 288 }
289 289
290 // This forces the sync thread to process the message and reply. 290 // This forces the sync thread to process the message and reply.
291 service_.reset(); 291 service_.reset();
292 ui_loop_.RunAllPending(); 292 ui_loop_.RunAllPending();
293 } 293 }
294 294
295 TEST_F(ProfileSyncServiceTest, 295 TEST_F(ProfileSyncServiceTest,
296 JsControllerProcessJsMessageBasicDelayedBackendInitialization) { 296 JsControllerProcessJsMessageBasicDelayedBackendInitialization) {
297 StartSyncServiceAndSetInitialSyncEnded(true, false, false, true, true, false); 297 StartSyncServiceAndSetInitialSyncEnded(true, false, false, true, true, false);
298 298
299 StrictMock<csync::MockJsReplyHandler> reply_handler; 299 StrictMock<syncer::MockJsReplyHandler> reply_handler;
300 300
301 ListValue arg_list1; 301 ListValue arg_list1;
302 arg_list1.Append(Value::CreateBooleanValue(false)); 302 arg_list1.Append(Value::CreateBooleanValue(false));
303 csync::JsArgList args1(&arg_list1); 303 syncer::JsArgList args1(&arg_list1);
304 EXPECT_CALL(reply_handler, 304 EXPECT_CALL(reply_handler,
305 HandleJsReply("getNotificationState", HasArgs(args1))); 305 HandleJsReply("getNotificationState", HasArgs(args1)));
306 306
307 { 307 {
308 csync::JsController* js_controller = service_->GetJsController(); 308 syncer::JsController* js_controller = service_->GetJsController();
309 js_controller->ProcessJsMessage("getNotificationState", 309 js_controller->ProcessJsMessage("getNotificationState",
310 args1, reply_handler.AsWeakHandle()); 310 args1, reply_handler.AsWeakHandle());
311 } 311 }
312 312
313 IssueTestTokens(); 313 IssueTestTokens();
314 314
315 // This forces the sync thread to process the message and reply. 315 // This forces the sync thread to process the message and reply.
316 service_.reset(); 316 service_.reset();
317 ui_loop_.RunAllPending(); 317 ui_loop_.RunAllPending();
318 } 318 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // The backend is not ready. Ensure the PSS knows this. 378 // The backend is not ready. Ensure the PSS knows this.
379 EXPECT_FALSE(service_->sync_initialized()); 379 EXPECT_FALSE(service_->sync_initialized());
380 380
381 // Ensure we will be prepared to initialize a fresh DB next time. 381 // Ensure we will be prepared to initialize a fresh DB next time.
382 EXPECT_FALSE(service_->HasSyncSetupCompleted()); 382 EXPECT_FALSE(service_->HasSyncSetupCompleted());
383 } 383 }
384 384
385 } // namespace 385 } // namespace
386 386
387 } // namespace browser_sync 387 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_typed_url_unittest.cc ('k') | chrome/browser/sync/retry_verifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698