OLD | NEW |
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 EXPECT_TRUE(service_->sync_initialized()); | 266 EXPECT_TRUE(service_->sync_initialized()); |
267 js_controller->RemoveJsEventHandler(&event_handler); | 267 js_controller->RemoveJsEventHandler(&event_handler); |
268 } | 268 } |
269 | 269 |
270 TEST_F(ProfileSyncServiceTest, JsControllerProcessJsMessageBasic) { | 270 TEST_F(ProfileSyncServiceTest, JsControllerProcessJsMessageBasic) { |
271 StartSyncService(); | 271 StartSyncService(); |
272 | 272 |
273 StrictMock<syncer::MockJsReplyHandler> reply_handler; | 273 StrictMock<syncer::MockJsReplyHandler> reply_handler; |
274 | 274 |
275 ListValue arg_list1; | 275 ListValue arg_list1; |
276 arg_list1.Append(Value::CreateBooleanValue(false)); | 276 arg_list1.Append(Value::CreateStringValue("TRANSIENT_NOTIFICATION_ERROR")); |
277 syncer::JsArgList args1(&arg_list1); | 277 syncer::JsArgList args1(&arg_list1); |
278 EXPECT_CALL(reply_handler, | 278 EXPECT_CALL(reply_handler, |
279 HandleJsReply("getNotificationState", HasArgs(args1))); | 279 HandleJsReply("getNotificationState", HasArgs(args1))); |
280 | 280 |
281 { | 281 { |
282 syncer::JsController* js_controller = service_->GetJsController(); | 282 syncer::JsController* js_controller = service_->GetJsController(); |
283 js_controller->ProcessJsMessage("getNotificationState", args1, | 283 js_controller->ProcessJsMessage("getNotificationState", args1, |
284 reply_handler.AsWeakHandle()); | 284 reply_handler.AsWeakHandle()); |
285 } | 285 } |
286 | 286 |
287 // This forces the sync thread to process the message and reply. | 287 // This forces the sync thread to process the message and reply. |
288 service_.reset(); | 288 service_.reset(); |
289 ui_loop_.RunAllPending(); | 289 ui_loop_.RunAllPending(); |
290 } | 290 } |
291 | 291 |
292 TEST_F(ProfileSyncServiceTest, | 292 TEST_F(ProfileSyncServiceTest, |
293 JsControllerProcessJsMessageBasicDelayedBackendInitialization) { | 293 JsControllerProcessJsMessageBasicDelayedBackendInitialization) { |
294 StartSyncServiceAndSetInitialSyncEnded(true, false, false, true, | 294 StartSyncServiceAndSetInitialSyncEnded(true, false, false, true, |
295 syncer::STORAGE_IN_MEMORY); | 295 syncer::STORAGE_IN_MEMORY); |
296 | 296 |
297 StrictMock<syncer::MockJsReplyHandler> reply_handler; | 297 StrictMock<syncer::MockJsReplyHandler> reply_handler; |
298 | 298 |
299 ListValue arg_list1; | 299 ListValue arg_list1; |
300 arg_list1.Append(Value::CreateBooleanValue(false)); | 300 arg_list1.Append(Value::CreateStringValue("TRANSIENT_NOTIFICATION_ERROR")); |
301 syncer::JsArgList args1(&arg_list1); | 301 syncer::JsArgList args1(&arg_list1); |
302 EXPECT_CALL(reply_handler, | 302 EXPECT_CALL(reply_handler, |
303 HandleJsReply("getNotificationState", HasArgs(args1))); | 303 HandleJsReply("getNotificationState", HasArgs(args1))); |
304 | 304 |
305 { | 305 { |
306 syncer::JsController* js_controller = service_->GetJsController(); | 306 syncer::JsController* js_controller = service_->GetJsController(); |
307 js_controller->ProcessJsMessage("getNotificationState", | 307 js_controller->ProcessJsMessage("getNotificationState", |
308 args1, reply_handler.AsWeakHandle()); | 308 args1, reply_handler.AsWeakHandle()); |
309 } | 309 } |
310 | 310 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 service_->UpdateRegisteredInvalidationIds(&observer, ids); | 421 service_->UpdateRegisteredInvalidationIds(&observer, ids); |
422 | 422 |
423 service_->StopAndSuppress(); | 423 service_->StopAndSuppress(); |
424 service_->UnsuppressAndStart(); | 424 service_->UnsuppressAndStart(); |
425 | 425 |
426 service_->GetBackendForTest()->EmitOnNotificationsEnabled(); | 426 service_->GetBackendForTest()->EmitOnNotificationsEnabled(); |
427 } | 427 } |
428 | 428 |
429 } // namespace | 429 } // namespace |
430 } // namespace browser_sync | 430 } // namespace browser_sync |
OLD | NEW |